Hacker News new | ask | show | jobs
by sebag1507 1232 days ago
[I work at Firebase :)]

Realtime Database (RTDB) client update latency (in ideal situations) is below 100ms (blazing fast). You could absolutely track the state of the game in RTDB (e.g. players' position, artifacts, etc). You do that using the RTDB SDK and all clients listening to the same document will get updated.

For time dependant events (like bombs) you can use scheduled functions : https://firebase.google.com/docs/functions/schedule-function...

The client setting the bomb calls the function, the function updates RTDB with the location of the bomb and schedules the explosion. 10s later it updates RTDB with the explosion happening.

My 2c

1 comments

Thanks for the reply :)

Could you also give some guidance on these scenarios?

- a player hits a soccer ball, I want all players to see the ball fly through the air. How can I have the ball update its position to all players as it flys through the air?

- a similar question, how can I have an NPC randomly walk around and update all players of its position?

I guess both these problems fall into the same issue of needing a “world” to run things, like managing NPCs or the trajectory of a ball. What do you think? Is that possible?

Thanks for the help :) I appreciate the help