A real-time multiplayer game built with a C++ server and TypeScript client, including custom binary serialization, physics simulation, and entity interpolation.
This project is an educational multiplayer game implementation that showcases:
- Custom C++ Game Server: High-performance server architecture with entity component system (ECS)
- TypeScript Client: Game can be played in a web browser
- Real-time Networking: Custom binary packet serialization for efficient client-server communication
- Physics Simulation: Server-authoritative physics using Box2D
- Entity Management: Component-based architecture for scalability and managing entities
- Real-time multiplayer gameplay with low-latency networking
- Client-side interpolation for smooth movement
- Server-authoritative physics and collision detection
- Custom binary packet serialization
- WebSocket (TCP) networking
- Entity Component System (ECS) architecture
- Language: C++17
- Build System: CMake 3.10+
- Package Manager: vcpkg
Core Dependencies:
- Box2D - Industry-standard 2D physics engine for collision detection and rigid body dynamics
- uWebSockets - High-performance WebSocket library for real-time client-server communication (This is what Bun.js uses natively for its http server)
- EnTT - Fast and reliable Entity Component System (ECS) library for game entity management
- Language: TypeScript 5.6+
- Build Tools: Webpack 5 with development server
Core Dependencies:
- PixiJS 8.9 - Hardware-accelerated 2D rendering engine using WebGL, providing sprite rendering, animation, and more
Development Tools:
- Webpack - Module bundler with hot reload support
- TypeScript Loader - Transpiles TypeScript to JavaScript
- CSS Loaders - Processes and bundles stylesheets
- HTML Plugin - Generates and injects bundles into HTML
- Copy Plugin - Manages static assets
- Clean Plugin - Cleans build directories
├── server/ # C++ game server
│ ├── src/ # Server source files
│ ├── include/ # Header files
│ └── CMakeLists.txt # Build configuration
└── client/ # TypeScript client
├── src/ # Client source files
├── package.json # Dependencies
└── webpack.config.js
Server:
- CMake 3.10 or higher
- C++17 compatible compiler (GCC, Clang, or MSVC)
- vcpkg package manager
- Environment variable
VCPKG_ROOTset to your vcpkg installation path
Client:
- Node.js and npm
docker compose up -d dbThis command will build the db image using docker and run it in the background.
Use docker compose down to stop the database when you're done.
Please consult the web/README.md for instructions on setting up and running the TypeScript web server.
cd server
./build.sh [--release or --debug] [--run]cd client
npm install
npm run devThis project is licensed under the terms found in the LICENSE file.
While this is primarily a learning project, suggestions and feedback are welcome! Feel free to open an issue or submit a pull request.
