CodingDoug / firebase-tic-tac-toe

Source code for tic-tac-toe game demoed at Google I/O 2017, built entirely with Firebase
Apache License 2.0
48 stars 20 forks source link

Laggy? #2

Open Jonovono opened 6 years ago

Jonovono commented 6 years ago

I have noticed that sometimes there is a fair amount of lag from the time you press the button and the time the circle/x show up on the screen - especially if I send a lot of events to firebase with move commands that may not be valid :p .

Is that expected? I am guessing sometimes the functions take a bit of time to run after the path has been written to? I am also on the free trial, would that be it?

msqaddura commented 6 years ago

Damn, I was just about to start using firebase. But typically the client should disable interaction when it is not your turn, like you cant click it in the first place. Assuming you behaved (only valid commands) :P is it still laggy?

Jonovono commented 6 years ago

@msqaddura we have been able to make optimizations to make it pretty smooth! We are using it in production in this app if you wanna see what's possible :p https://itunes.apple.com/us/app/bunch-group-video-chat-games/id1294869021?mt=8

msqaddura commented 6 years ago

Pretty Awesome! I dont use iphone but it hella looks pretty awesome!! I recommended it for my friends. So you went for same services as this tutorial? RealTimeDB & Cloud Functions?

Jonovono commented 6 years ago

hah thanks! It's written in react native so hopefully android coming soon :p

Ya, we followed that pretty closely. Built onto it a bit but works pretty much the same -> clients write commands to a path, which trigger a cloud function that does something. Client may update asap so it doesn't have to wait until function finishes.

Feel free to reach out for any questions! We built a friend system, presence system, and some real time games using this architecture with some modifications and have been pretty happy with it!