2017년 5월 16일 화요일

Two player game: Firebase or Fusion Table?


I'd like your opinion on which would be best to use in this scenario: Firebase or a Fusion Table.  

I have a two-player game, and when Player1 makes a move, the screen should be automatically updated on Player2's device.

Firebase seems perfect, because it will update automatically, and is easier to implement - in the Firebase.DataChange, I check for the name of the game as a tag, and, if it is this game, then I update the screen.  The string for update is quite long (about 300 pieces of data).  The downside is that, if I am Player3, playing a different game, my phone will also respond to the Firebase.DataChange command.  Because it's a different game, it won't change my screen, but if there are a thousand users all playing different games at the same time, then my device will be continually bombarded Firebase.DataChange commands, and it might impact on the speed of my game (and other possible problems?).

A FusionTable won't update automatically, but I could set a clock in the game to check the fusion table every 20 seconds.  A 20-second delay between Player1's move and the new move appearing on Player2's device is fine for my purposes.   This would have the advantage that each player would be polling the FusionTable only 3 times a minute, but then there would be a search in the fusion table, so, with a thousand entries, say, it might take a little while.

Any thoughts or comments welcome.

--
I would add one important question: Firebase is experimental and might not be available some day - is this going to change?

--
It is not very likely that Firebase would not be available some day, unless Google decides to stop providing it, but the same is true for Fusion tables.
Firebase is experimental because its functionality is not crystallized yet, so you cannot really rely on the interface. This also means that you should not use it for apps that you want to publish in the Playstore (yet).
For now, your best bet is Fusion tables, unless you like experimenting - then tell us how you do after a while.

You are right to worry about scalability up front.

I haven't verified this for recent Firebase updates, but the part of the 
Designer component that restricts your app to a designated subset
of a shared firebase db might also control the scope of the Data Changed
callback events you receive.  So if you extend that attribute to include a game ID,
that might work.

For an entirely different approach, consider direct message passing
via SMS or BlueTooth, to bypass server problems or reduce the server
role to just matchmaking.

--
alternatively you also could use PubNub, which offers long polling

--

댓글 없음:

댓글 쓰기