| Crates.io | massive_game_server_core |
| lib.rs | massive_game_server_core |
| version | 0.1.0 |
| created_at | 2025-06-01 16:58:06.248305+00 |
| updated_at | 2025-06-01 16:58:06.248305+00 |
| description | A high-performance Rust game server core for massive multiplayer interactions, part of Project Trebuchet. |
| homepage | https://github.com/TrebuchetNetwork/massive_game_server |
| repository | https://github.com/TrebuchetNetwork/massive_game_server |
| max_upload_size | |
| id | 1697317 |
| size | 590,528 |
Welcome to the Massive Game Server project! This is a high-performance game server written in Rust, designed from the ground up to handle a massive number of concurrent players and AI-controlled entities. It utilizes WebRTC for real-time client-server communication and FlatBuffers for efficient data serialization. This server is a core component of the Trebuchet Network initiative, aimed at pushing the boundaries of large-scale multiplayer interactions.
static_client/client.html) using Pixi.js for testing and visualization.Before you begin, ensure you have the following installed:
rustc 1.86.0 or newer. Install via rustup.rs.cargo 1.86.0 or newer (comes with Rust).flatc): flatc version 25.2.10 or newer.
brew install flatbufferssudo apt-get install flatbuffers-compilertsc): Version 5.8.3 or newer (npm install -g typescript). Needed for scripts/generate_flatbuffers.sh if you modify the schema and want to recompile the client-side TypeScript.Follow these steps to get the server up and running:
Clone the Repository:
git clone [https://github.com/TrebuchetNetwork/massive_game_server.git](https://github.com/TrebuchetNetwork/massive_game_server.git)
# Replace with the actual URL if different, e.g., trebuchet_network
cd massive_game_server
Build the Server:
The server is located in the server subdirectory.
cd server
cargo build --release
server/build.rs script automatically uses flatc to compile the FlatBuffers schema (server/schemas/game.fbs) into Rust code during the build process. You generally don't need to run flatc manually for the server.Run the Server: After a successful build:
cd server
# Ensure you are in the server directory if you navigated away
cargo run --release
The server will start and log its status, typically indicating it's listening on ws://0.0.0.0:8080/ws and serving static files from http://0.0.0.0:8080/.
Test with the Static Web Client:
static_client/client.html file (located in the root of the cloned repository, e.g., massive_game_server/static_client/client.html) in a modern web browser.ws://localhost:8080/ws).The static web client (static_client/) uses JavaScript code generated from the FlatBuffers schema.
static_client/generated_js/.server/schemas/game.fbs), you need to regenerate these client-side files. Run the script:
cd scripts
./generate_flatbuffers.sh
This script uses flatc to generate TypeScript files and then (optionally, if tsc is installed) compiles them to JavaScript.The primary server configuration can be found and modified in:
server/src/core/config.rsKey parameters include:
tick_rate: The server's simulation frequency (e.g., 30 or 60 Hz).num_player_shards: For distributing player processing load.max_players_per_match: Maximum concurrent players/bots.ThreadPoolConfig: Defines the number of threads for various tasks (physics, networking, AI, etc.).target_bot_count: Default number of bots to spawn.These are set to default values optimized for a 12-core development machine but should be tuned for your specific hardware and load requirements.
A brief overview of the main directories:
/server: Contains all the Rust server-side code.
/server/src/core: Fundamental types, constants, error handling, and configuration./server/src/entities: Logic for players, projectiles, and other game entities./server/src/systems: Core game systems like physics, AI, combat, and objectives./server/src/world: World partitioning, map generation, and spatial indexing./server/src/network: WebRTC signaling, data channel management, and network message handling./server/src/concurrent: Thread pools, concurrent data structures./server/src/operational: Monitoring, diagnostics, and tuning utilities./server/schemas/game.fbs: The FlatBuffers schema defining the network protocol./server/src/main.rs: The main entry point for the server application./server/src/lib.rs: The library crate root for massive_game_server_core./static_client: Contains the HTML, JavaScript, and CSS for the static web client.
/static_client/generated_js/: JavaScript files auto-generated from game.fbs by flatc./scripts: Utility shell scripts for tasks like generating FlatBuffers code./config: (Currently empty) Intended for YAML configuration files for different environments./docs: (Placeholder) For additional documentation.Contributions are welcome! We aim to make this a community-driven effort to explore the limits of massive-scale simulations. Please look out for a CONTRIBUTING.md file for guidelines on how to contribute, report issues, and propose features.
For now, if you're participating in the Project Trebuchet competition, please follow the specific guidelines provided for that event.
This project is licensed under the MIT License. See the LICENSE file in the repository for full details.