Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two player chess game using Firebase

Edit: The answer is to use firebase realtime database.

I wrote a library for the next person.

https://github.com/flipflopapp/turnbased-games-with-firebase

-- Question --

I am implementing two player chess game (www.halfchess.com) and am considering using firebase messaging (instead of using sockets to create rooms and two player matches). The game would involve sending 60-100 chess moves as messages between two devices in two to three minutes (that can be android or iOS). My nodejs server would have code that enables device to device messaging (receiving from one player and sending to other).

I cannot use Google Game Services because I don't have google login implemented in my app (I only plan to keep facebook login). The advantages of using firebase (compared to sockets) is that I will have to write much lesser code (reconnections, etc) and it would take care of scalability issues.

My questions are :-

(1) Will there be problems when the users playing against each other are on two iOS devices (instead of android's)? (such as higher latency)

(2) If a user is changing location physically and a message that contains a chess move is undelivered, when will it be retried?

(3) For a fast game of chess, will the latency be manageable? This is like 8-10 times the speed of normal chatting.

While I read more on the topic, perhaps someone who has already experimented can comment.

like image 347
navalsaini Avatar asked Apr 22 '26 13:04

navalsaini


1 Answers

Firebase Cloud Messaging is not meant for kind of usage, and in addition to a non guaranteed delivery time (some researches from 2013 - 2014 shows more than 1 seconds per message on avarage), FCM will probably imply throttling in such a use case.

See also this SO post

like image 190
Yoni Gross Avatar answered Apr 26 '26 14:04

Yoni Gross



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!