An open-source server emulator for the Command & Conquer series, implementing the GameSpy and EA backend protocols required for online multiplayer.
- Command & Conquer 3: Tiberium Wars (CNC3)
- Command & Conquer 3: Kane's Wrath (KW)
- Command & Conquer: Red Alert 3 (RA3)
- Command & Conquer: Generals
- Command & Conquer: Generals Zero Hour
This project aims to:
- Preserve multiplayer functionality for C&C games after official server shutdowns
- Document decades-old protocols that were previously undocumented or poorly understood
- Empower players with ownership and control over their gaming infrastructure, working both offline and in LAN
- Provide a reference implementation for researchers and developers interested in the game server architecture
- FESL Server - EA Frontend Service Layer for authentication and session management
- GP Server - GameSpy Presence server for buddy system, status, and messaging
- Peerchat Server - IRC-based lobby, chat, and game session coordination
- NAT Negotiation Server - UDP hole punching for peer-to-peer connections
- Master Server - Game server listing and room discovery (TCP)
- Heartbeat Server - Game session registration and keepalive (UDP)
- GameStats Server - Game statistics reporting and retrieval
- Multi-game support - CNC3, Kane's Wrath, and Red Alert 3 with per-game gamekeys, entitlements, and protocol handling
Current Status: The server is fully functional and supports all core gameplay features including user authentication (login), friends system, lobby browsing and creation, in-game chat, cooperative campaigns, and online multiplayer matches.
- (done)Sake Storage Server - Storage
- (done)Stats server - Stats
- (done)Competition server - Post-match stats
- (done)Web Portal - Account registration, leaderboards, and live match viewer
- (done)Clan System - Create, join, and manage clans with in-game integration
- (done)CNC3 & Kane's Wrath - Multi-game support for CNC3 and Kane's Wrath
- Auto matchmaking - Add support for automatic ELO based matchmaking bot
- (initial support)Generals - (low prio) Support generals games
- Python 3.11+
- pip
To redirect a game client to your emulator, you need to install a game proxy that intercepts DNS/network calls and routes them to your server.
For Red Alert 3, CNC3 and Kane's Wrath you can use the CnC Game Proxy:
- Download or build the proxy from CnC Game Proxy
- Install it to your game's
Data/folder (e.g.,C:\Program Files\EA Games\Red Alert 3\Data\) or other appropriate folder - Configure the proxy to point to your emulator server
- Clone the repository:
git clone https://github.com/yourusername/ra3_backend_server.git
cd ra3_backend_server- Create a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create configuration file:
cp config.example.json config.jsonThen edit config.json and set your per-game keys. Each supported game requires its own gamekey:
{
"game": {
"gamekeys": {
"cnc3pc": "YOUR_CNC3_GAME_KEY",
"cnc3ep1pc": "YOUR_KW_GAME_KEY",
"cncra3pc": "YOUR_RA3_GAME_KEY"
}
}
}See config.example.json for all available options.
Start all servers with uvicorn ( note port 80 needs sudo on some systems ):
uvicorn app.main:app --host 0.0.0.0 --port 80 --reloadThis starts:
| Service | Port | Protocol | Description |
|---|---|---|---|
| REST/SOAP API | 80 | HTTP | Web API and SOAP services |
| FESL | 18800 | TCP | Authentication and session |
| Peerchat IRC | 6667 | TCP | Lobby and chat |
| GP Server | 29900 | TCP | Buddy system and presence |
| NAT Negotiation | 27901 | UDP | P2P hole punching |
| NAT Relay | 50000-59999 | UDP | Relay fallback when direct P2P fails (relay.host must be your public IP) |
| Master Server | 28910 | TCP | Room/game list queries |
| Heartbeat Server | 27900 | UDP | Game session registration |
| GameStats | 29920 | TCP | Game statistics reporting |
The server includes a web portal for account management, leaderboards, and live match viewing. Access it at http://localhost/ after starting the server.
See Web Portal Documentation for detailed information and screenshots.
python -m pytest app/test/ -vDetailed protocol documentation is available in the docs/ directory:
| Document | Description |
|---|---|
| FESL.md | EA authentication protocol with packet structures and authentication flow |
| GP_SERVER.md | GameSpy Presence protocol for buddy system and messaging |
| PEERCHAT.md | IRC-based lobby system with GameSpy extensions for game coordination |
| NATNEG.md | NAT negotiation protocol for establishing peer-to-peer connections |
| RELAY.md | UDP relay fallback when direct P2P fails |
| MASTER_SERVER.md | Master server for game discovery and session registration |
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Game Client (CNC3 / Kane's Wrath / RA3) │
└────────────────────────────────────────────────────────────────────────────────────────┘
│ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ ┌───────────────┐ ┌───────────┐
│ FESL │ │ Peerchat │ │ GP │ │ NATNEG │ │ Master Server │ │ GameStats │
│ :18800 │ │ :6667 │ │ :29900 │ │ :27901 │ │ TCP :28910 │ │ :29920 │
│ (TCP) │ │ (TCP) │ │ (TCP) │ │ (UDP) │ │ UDP :27900 │ │ (TCP) │
└────┬────┘ └────┬─────┘ └────┬─────┘ └────┬────┘ └───────┬───────┘ └─────┬─────┘
│ │ │ │ │ │
└────────────┴────────────┴────────────┴──────────────┴───────────────┘
│
┌──────┴──────┐
│ Database │
│ (SQLite) │
└─────────────┘
Flow:
- Client connects to FESL - the
clientStringin the Hello packet identifies the game (CNC3, KW, or RA3) - FESL authenticates the user (NuLogin for RA3, Login for CNC3/KW) and issues a session
- FESL issues a ticket for GP Server authentication
- Client connects to Peerchat for lobby/chat (per-game gamekey used for encryption)
- Client connects to GP Server for buddy system
- Client queries Master Server (TCP :28910) for room/game lists
- Game hosts register via Heartbeat Server (UDP :27900)
- During game start, clients use NAT Negotiation for P2P setup
- GameStats server handles post-match statistics reporting
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is provided for educational and preservation purposes.
This project is not affiliated with or endorsed by Electronic Arts, Westwood Studios, or any related entities. Command & Conquer, Red Alert 3, Tiberium Wars, and Kane's Wrath are trademarks of Electronic Arts Inc.