Hey HN, I’m making a realtime multiplayer game and it’s time for me to write the backend. I really like the idea of using a BaaS - I ideally just want to write my game’s backend logic and have everything else (spinning up servers, load balancing, containers, etc) handled for me.
I’ve been looking around at solutions online and Firebase seems really appealing to me. It’s got tons of documentation, lots of features (auth (with anonymous auth), analytics, blob storage, etc), and doesn’t seem to be one of Google’s graveyard bound projects (hopefully).
There’s some things I’m not sure firebase can handle that I would like in my game:
- complex interactions in my game. Firebase seems good for easy I/O (with their cloud functions feature). You make an api request, Firebase handles the request, maybe manipulates some data in the real-time DB, and then returns you some result. Maybe it also tells a bunch of other clients that result. If a player in my game walks forward, I would make an api request to have that player move forward, the request would update the player’s location in the real-time db, and all other players would be notified and updated of the movement. Cool. But what about more complex interactions? What if a player places a bomb that explodes in 10s? Could Firebase somehow get triggered after 10s to perform an action? We can’t trust the frontend to handle the 10s timer. Or what if I want the world to be alive, with NPCs walking around. Can Firebase run a game loop like thing in the backend to have NPCs walk around?
- price: if I’m constantly sending / receiving requests from clients (ex: a client moves their mouse around the screen and I want to update each other client with the position of the mouse, that would be a lot of api requests per second) and handling each of those requests in a cloud function, I feel like that could add up pretty quickly
As easy as Firebase sounds, I’m afraid I may rely on it only to realize months later that it can’t do certain things.
Any alternatives you would suggest?
Thanks for the help!
I've liked Dapper Dino's videos for learning about these things. Looks like he's started an updated version: https://www.youtube.com/watch?v=eymqAMmnqPg