Cogar is a high-performance, unified game server and client for Agar.io-style game, built from the ground up in Rust. It aims to provide a modern, efficient, and easily deployable alternative to legacy Ogar implementations.
- Unified Binary: A single executable (
cogar) that serves both the high-performance game logic and the embedded web-based client. - High Performance: Optimized game loop and spatial partitioning implemented in Rust for low latency and high player counts.
- Protocol Compatibility: Implements the standard Ogar protocol, allowing compatibility with various Cigar-based clients.
- Interoperability: The Cigar client can be used to connect to any standard Ogar server, and vice versa.
- Wasm-Powered Client: The client is built using Rust and compiled to WebAssembly, ensuring smooth rendering and shared logic between server and client.
- Modern Tech Stack: Utilizes
axumfor the web server,tokiofor asynchronous networking, andTailwind CSSfor a premium UI aesthetics. - Advanced AI: Integrated bot manager and players with customizable behaviors.
- Multiple Gamemodes: Supports various classic and experimental modes:
- FFA (Free For All)
- Teams
- Hunger Games
- Tournament
- Beatdown
- Experimental
- Rainbow
- Backend: Rust (axum, tokio, tungstenite, serde, glam)
- Frontend: Rust (Wasm), JavaScript, CSS (Tailwind CSS 4.0)
- Assets: Embedded directly into the binary using
rust-embed. - Communication: WebSockets with a custom binary protocol optimized for speed.
.
├── crates/
│ ├── bin/ # Entry points (cogar, cigar, ogar)
│ ├── client/ # Wasm client and web assets
│ ├── protocol/ # Shared binary protocol definitions
│ └── server/ # Core game logic, physics, and gamemodes
├── config.toml # Server configuration
└── Cargo.toml # Workspace management
- Rust (latest stable or nightly)
- Wasm-bindgen-cli (for client compilation)
- [Node.js / Bun](https://nodejs.org/ / https://bun.sh/) (for frontend asset processing)
You can choose between the unified experience or standalone components:
- Unified (Server + Client):
cargo run --release --bin cogar
- Pure Game Server (Ogar):
cargo run --release --bin ogar
- Standalone Frontend Server (Cigar):
cargo run --release --bin cigar
The unified server (cogar) will be available at http://localhost:3000 by default.
The server can be configured via config.toml in the root directory. You can adjust:
- Network settings (Host, Port)
- Game mechanics (Map size, cell speeds, decay rates)
- Bot settings
- Gamemode specific parameters
Contributions are welcome! Please feel free to submit a Pull Request or open an issue for bugs and feature requests.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.