Multiplayer Library for Browser Based Board Games

Hi,

I created a library, a base server, and an example for browser-based board games:
https://github.com/Carbonfreezer/multiplayer

The server part is a game-agnostic relay server, and the library loosely follows the client-hosted server philosophy, as in Unreal Engine or Network for Game Objects for Unity. It is in a reduced form, though, and primarily optimized for round-based games. It works with Macroquad and WebSockets, both in native and WASM builds. There are two specific solutions in there you might be interested in, even if you do not want the library as is:

  • If you want to integrate macroquad with web sockets, "quad-net" would be the natural choice. This does not work with binary WebSocket messages, though, and the non-WASM version also seems to be outdated. I implemented a local solution using ewebsock and a miniquad plugin for WASM to solve this.
  • If you integrate egui with macroquad, you get a problem on mobile, because the keyboard does not show up. This is also solved with a miniquad plugin and a hidden text field. I am told, though, that this solution does not work for Mac / Safari. If you have a fix for that, please let me know.
4 Likes

I have just added a sample of a three-person extension of the game Reversi, which I named Ternio.

This sample is more complex than the included tic-tac-toe and features:

  • Three active players.
  • Host privileges for color assignments and nickname setting.
  • Animation transitions triggered by incoming delta updates (stone placement and flipping).
  • More complex state machine for the game.

You can try a running version on this site.

Take care,
Christoph