A multiplayer spaceship game built with Rust and Bevy Game Engine.
This project serves as a practical implementation of an authoritative server architecture in a real-time game environment.
Inspiration This project is heavily inspired by Gabriel Gambetta's excellent series on Fast-Paced Multiplayer.
- Authoritative Server: The server controls the state of the game.
- Client-Side Prediction: The client predicts its own state locally, making the game feel responsive immediately without waiting for the server.
- Server Reconciliation: The client seamlessly corrects its local state if it diverges from the server's authoritative state.
- Entity Interpolation: Smooths out the movement of other entities (ships and bullets).
The project is divided into three main crates.
server/: The dedicated game server that handles physics, collisions, and state authority.client/: The player's game client, handling rendering, input, and prediction.shared/: Common logic, protocol definitions, and game components shared between client and server.
- Rust: Install Rust.
- Make: Used for running convenience scripts.
- Bacon (Optional): A background code checker for Rust. Useful for auto-restarting during development. Install Bacon.
You can start the server and client using the provided Makefile commands.
1. Start the Server
make run-server2. Start the Client
make run-clientTo test multiplayer on a single machine, you can open multiple terminal windows and run make run-client in each one.
- Rotate player using mouse position.
- W and S to move ship forward/backward.
- Left-click to shoot a bullet.