Ask HN: Advice for Multiplayer Back End

Lately I've been yearning to make simple multiplayer Javascript games with as much ease as simple single player games, for the sake of prototyping with friends. I have a sneaking suspicion that for discrete (turns or timers) match-based games, you could have a Firebasey store synchronized between clients and an authoritative server built on top of web sockets, such that the programmer doesn't have to design a new protocol for every game. The reason I don't reach for Firebase immediately is partly due to lock-in/pricing concerns, and because I imagine there would be a simpler tool with the above constraints in mind.

I've stumbled across https://colyseus.io/, but it doesn't look like it quite fits my needs.

Does anyone know of a library out there with the mission of Colyseus, the behavior of Firebase, and simpler than both? Alternatively, has anyone had a pleasant experience building a discrete game with Firebase?

15 points | by houseinthewoods 1287 days ago

9 comments

  • ArtWomb 1287 days ago
    >>> doesn't have to design a new protocol for every game

    There may not exist any level of abstraction sufficient to encapsulate ALL turn based strategy mutliplayer internet games ;)

    I kind of think you want to design a new engine specific to each game. First I don't think you will save much effort via code re-use. Second you need that flexibility when changing game parameters, rules, board size, player mechanics etc

    The other possibility is to design bottom up. Observe what's possible at current public cloud latency and cost. And then design the game around those constraints.

    For private hosted game rooms with limited numbers of players, any in-memory cache will do on the host vm. Use any realtime API gateway to sync. Or host static HTML5 assets on S3 and Cloudflare KV for "live" game state, dumping finished game data to plain disk files.

    Best of Luck!

  • m0dE 1287 days ago
    I just open sourced my multiplayer game engine. Give it a look: https://github.com/moddio/taro
  • marshmellman 1287 days ago
    I went with Colyseus for my multiplayer bananagrams prototype. It’s not quite the use case, but it did make life easier after figuring out how to model the game with Colyseus’s state mechanics.

    Basically you apply game logic on the server to mutate game state, which is automatically synchronized to each client. It’s been a few months and I don’t have the code in front of me, but can give more details later if you’d like.

  • advaita 1287 days ago
    I dont have answers to your questions but you might want to prefix the post with "Ask HN: ". It will drive better reach.
  • konaraddi 1287 days ago
    You might find https://boardgame.io/ helpful
    • kopos 1287 days ago
      Boardgame.io is good but it doesn’t have timers, iirc
  • bird_monster 1287 days ago
    Playfab offers multiplayer servers as a selling point, but does not solve your vendorlock concern.

    The combination of Playfab's player data + multiplayer server functionality sound like what you're looking for though.

  • sali0 1287 days ago
    Check out Nakama by Heroic Labs.

    https://heroiclabs.com/nakama-opensource/

  • lecarore 1287 days ago
    I'd build it with meteor, mostly because I'm used to it. It's excellent for prototypes and real time by default
    • lecarore 1287 days ago
      There's some lock in in terms of framework specific code but no lock in of your data,it's just a mongo dB. The reliance on mongo means it's always a bit tricky to make join-like calculations, but otherwise I'd really recommend the meteor stack. For hosting as a side project I'd recommend a shared digital Ocean droplet, you'll get much better performance than heroku. Use "meteor up" to deploy. It will be 5usd per month but you can host many small apps on one droplet