An implementation of the multiplayer Hathora topdown shooter client using Rust and Bevy. This consumes the Rust Hathora client
Assets from Kenney
demo.mov
Install cargo via rustup
cargo run # create a new room with default APP_ID
cargo run -- $ROOM_ID # connect to an existing room with default APP_ID
cargo run -- $ROOM_ID --app-id $APP_ID # connect to an existing room with a custom APP_ID
This client reads and writes data from a Hathora server. The server data is treated as authoratitive, so this client just renders server updates and passes inputs to the server for processing.
Server updates and user inputs are sent and received over a websocket. The server is configured to send updates every 50ms. The client update loop is decoupled from server updates by configuring the underlying TCP stream to be non-blocking. When updates are received, they are added to an interpolation buffer. This allows the client to smoothly display updates with a high frame-rate, regardless of the server's tick rate.
cargo
will generate an executable file. This file assumes that assets like sprites are in specific directories relative to the executable. To build an executable bundled with assets, a release script is available:
./release.sh