A multiplayer Slither.io-style game built with Rust, Bevy game engine, and WebSocket networking.
This project uses a shared client-server architecture:
- shared/: Common types and structures used by both client and server
- server/: Game server with Bevy ECS for game logic and WebSocket networking
- client/: Game client with Bevy rendering and WebSocket networking
- Multiplayer snake gameplay
- Real-time WebSocket networking
- Food consumption and snake growth
- Collision detection (snake-to-snake and self-collision)
- Smooth movement and rendering
- World boundaries with wrapping
cd server
cargo runThe server will start listening on ws://127.0.0.1:8080
cd client
cargo runThe client will automatically connect to the server and you can start playing!
- Arrow Keys or WASD: Control snake direction
- ESC: Disconnect from server
- Snakes move continuously in the current direction
- Eating food makes the snake grow longer
- Colliding with other snakes causes death
- Self-collision after 5 segments causes death
- World wraps around at boundaries
- bevy: Game engine and ECS
- tokio: Async runtime
- tokio-tungstenite: WebSocket implementation
- serde: Serialization for network messages
- shared: Common game types
slitherio/
├── Cargo.toml # Workspace configuration
├── shared/ # Shared library
│ ├── Cargo.toml
│ └── src/lib.rs # Common types and messages
├── server/ # Game server
│ ├── Cargo.toml
│ └── src/
│ ├── main.rs # Server entry point
│ ├── game.rs # Game logic and ECS
│ └── network.rs # WebSocket networking
└── client/ # Game client
├── Cargo.toml
└── src/
├── main.rs # Client entry point
├── render.rs # Rendering and input
└── network.rs # WebSocket networking
Make sure you have Rust installed, then:
# Build all workspace members
cargo build
# Build with optimizations
cargo build --release# Run tests for all workspace members
cargo test
# Run tests for specific crate
cargo test -p shared
cargo test -p server
cargo test -p client