Christoph Lürig is presenting "AAA Multiplayer Patterns Meet Rust, Tokio and WebAssembly". #RustLang #RustInParis
The goal of this project was to make multiplayer, browser-based board games, as lightweight as possible, while taking idea from AAA game engine synchronization. #RustInParis
The model is to have a server that decides the whole game state. Sometimes a client can behave as a server. The models can even be combined, with a synchronization between a Dedicated and Client Hosted Server.
#RustInParis
The two approaches to synchronization between servers or between client and servers can be RPC (Remote Procedure Call), or Variable Replication (Full or Partial). Both were used.
#RustInParis
For this project, tokio and axum were used on the server. There is one synchronized object: the ViewState. Then mostly Server RPCs (Client calling the server), except for the Server kicking clients. Full and partial replication are possible in this project with serde. Partial updates trigger game animations for example.
#RustInParis
For websocket communication, the server has two tokio tasks per connected client. A task takes care of broadcast, and another of client to server communication. The overhead is 10 to 20 transferred bytes per player action, generating very little CPU load.
#RustInParis
The code for the backend and frontend are quite different. The backend is event-driven, while the frontend is a game client is updated at a fixed game-loop rate (e.g 50 fps). In the middle the transport layer handles communication between the two. And this can cause synchronization issues in some cases.
#RustInParis
For the implementation, Christoph used egui, and macroquad. For macroquad, there a few challenges, so quad_net and ewebsock had to be used. In his opinion, the WASM + Rust ecosystem is still growing and improving; his advice is to look at the most used crates first.
#RustInParis
You can find the board games built by Christoph at https://board-game-hub.de/, and there source as well: https://github.com/Carbonfreezer/multiplayer .
#RustInParis
Board-Game-Hub - Strategic Board Games

@Aissen is that an 18-inch laptop? 😯
@gustavoars it might be! (though I had not noticed before)