This file documents the layout of the repository, the architecture of the code, and the networking strategy used.
The mod
folder contains all of the CSharp code:
CoalescenceClient
is a mod for the official Remix mod loader for Rain World 1.9, which is based on BepInEx. The mod uses ClangSharp to generate bindings to the native Rust code, which is where the majority of the simulation and networking is performed.
The crates
folder contains all of the Rust code:
- The
coalescence_client
crate defines the C api that the CSharp code actually calls into. It is compiled as acdylib
and usescbindgen
to generate the C headers that are what ClangSharp actually uses as input to generate the CSharp bindings. coalescence_server
is the dedicated server binary. It exclusively performs simulation and networking, and is functionally useless without a client to connect to it.coalescence_proto
is a "sans-IO" implementation of all of the networking logic.coalescence_quinn
integrates Quinn with the protocol implementation to do actual I/O.
The server is written in pure Rust, with no CSharp code, and uses Bevy ECS for the simulation logic. The client/mod is also written mostly in Rust for parity with the server, but has some CSharp code by necessity, in order to hook into and interface with the base game.
The mod uses authoritative replication with rollback and client-server (i.e. star) network. It is built on Quinn, an implementation of the QUIC transport protocol.
- This summary of the above networking terminology
- Why use QUIC?