An expert-level, real-time discrete-event network simulation game. Manage a complex network, ensure SLA compliance, and survive cyber-attacks!
- Simulation Engine: Built on
SimPyfor accurate discrete-event simulation (packets, queues, latency). - Real-Time Gameplay: The simulation runs in real-time, controlled via a web interface.
- Dynamic Scenarios: Handle traffic bursts, link failures, and routing challenges.
- Interactive UI: Visualize network topology and packet flow using Vis.js.
- Restful API: Python Flask backend exposing state and control endpoints.
- Python 3.8+
pip
- Clone the repository.
- Install dependencies:
pip install -r requirements.txt
Run the Flask application:
python3 app.pyThe server will start on http://localhost:5000.
Open your web browser and navigate to http://localhost:5000.
- Dashboard:
- Top Bar: View Money, Time, and Game State.
- Sidebar:
- Controls: Pause/Resume/Reset the simulation.
- Add Node: Create new Routers, Endpoints, or Servers.
- Add Link: Connect nodes with links (default 10Mbps).
- Traffic: Manually trigger packet bursts between nodes.
- Metrics: Monitor delivered vs. dropped packets.
- Main Area: Interactive Network Graph.
- Blue Nodes: Routers
- Yellow Nodes: Endpoints
- Red Nodes: Servers
- Arrows: Links (hover for bandwidth)
By default, the game loads the basic scenario:
- ClientA sends traffic to Server1 via Router1.
- Watch the "Delivered" count increase.
Challenge:
- Add a new node
Router2. - Add links
ClientA -> Router2andRouter2 -> Server1. - If
Router1fails (simulated by high traffic or manual disruption), traffic needs to be rerouted!
GET /api/state: Get current simulation state (nodes, links, stats).POST /api/control:{"action": "pause" | "resume" | "reset"}POST /api/action: Perform game actions.- Add Node:
{"type": "add_node", "id": "ID", "node_type": "ROUTER"} - Add Link:
{"type": "add_link", "src": "A", "dst": "B"} - Generate Traffic:
{"type": "generate_traffic", "src": "A", "dst": "B", "count": 10}
- Add Node:
- simulation/: Core DES engine (
engine.py,models.py). - game/: Game logic and state management (
manager.py,scenarios.py). - app.py: Flask REST API.
- static/js/main.js: Frontend logic using Fetch API and Vis.js.
MIT