How bytadaniel/open-datsmagic works
StadMagic is a multi-service arena game: teams register and receive tokens through a web Hub, then bots submit commands to a Rust simulation API. The Hub also selects worlds, controls arena lifecycle, and presents standings; browser and native visualizers expose spectator and manual-play experiences. The graph separates platform, simulation stages, and clients. Hub capabilities and service links are based on the README; server internals use the supplied source excerpts and SOURCE INDEX, so unsampled implementation details are not expanded.
Main entry points: hub.py Web Hub · loop_runner.rs Game loop · manager.rs Spatial resolution · handlers.rs Arena API
Components 22
Arena platform
- Web Hub
modules/arena-hub/hub.py - Hub browser UI
modules/arena-hub/static/arena-visualizer.js - Arena lifecycle
modules/arena-runtime/runtime.py
Simulation server
- Arena API
lib/arena-server/src/api/handlers.rs - API contracts
lib/arena-server/src/api/dto.rs - Game loop
lib/arena-server/src/engine/loop_runner.rs - Command buffer
lib/arena-server/src/engine/command_buffer.rs - World state
lib/arena-server/src/engine/state.rs - World configuration
lib/arena-server/src/config.rs - Session leaderboard
lib/arena-server/src/leaderboard.rs
World mechanics
- Physics integration
lib/arena-server/src/physics/integrator.rs - Forces and vectors
lib/arena-server/src/physics/forces.rs - 2D vectors
lib/arena-server/src/physics/vector2d.rs - Spatial resolution
lib/arena-server/src/spatial/manager.rs - World entities
lib/arena-server/src/spatial/entities.rs - Collision detection
lib/arena-server/src/spatial/collision_detector.rs - Coin spawning
lib/arena-server/src/spatial/coin_spawner.rs - Anomaly spawning
lib/arena-server/src/spatial/spawner.rs
Players and viewers
- Bot clients
lib/arena-bots
Visualization
- Browser arena view
modules/arena-hub/static/arena-visualizer.js - Native visualizer
lib/arena-visualizer/src/main.rs
Other components
- Teams
Connections 27
- Teams → Web Hub: registers
README.md - Web Hub → Teams: issues tokens
README.md - Bot clients → Arena API: submits commands
README.md - Web Hub → Arena lifecycle: controls lifecycle
README.md - Arena lifecycle → Arena API: starts process
README.md - Web Hub → Hub browser UI: serves web app
README.md - Hub browser UI → Arena API: plays arena
README.md - Hub browser UI → Web Hub: views standings
README.md - Arena API → Game loop: registers commands
lib/arena-server/src/api/handlers.rs - Arena API → API contracts: formats responses
lib/arena-server/src/api/handlers.rs - Game loop → Command buffer: drains commands
lib/arena-server/src/engine/loop_runner.rs - Game loop → World state: advances state
lib/arena-server/src/engine/loop_runner.rs - Game loop → Physics integration: steps physics
lib/arena-server/src/engine/loop_runner.rs - Game loop → Spatial resolution: resolves world
lib/arena-server/src/engine/loop_runner.rs - Game loop → World configuration: loads settings
lib/arena-server/src/engine/loop_runner.rs - Physics integration → Forces and vectors: uses forces
lib/arena-server/src/physics/integrator.rs - Physics integration → 2D vectors: uses vectors
lib/arena-server/src/physics/integrator.rs - Forces and vectors → 2D vectors: uses vectors
lib/arena-server/src/physics/forces.rs - Physics integration → Spatial resolution: reads anomaly forces
- Spatial resolution → World entities: resolves entities
lib/arena-server/src/spatial/manager.rs - Spatial resolution → Collision detection: checks collisions
lib/arena-server/src/spatial/manager.rs - Spatial resolution → Coin spawning: spawns coins
lib/arena-server/src/spatial/manager.rs - Spatial resolution → Anomaly spawning: spawns anomalies
lib/arena-server/src/spatial/manager.rs - Native visualizer → Arena API: reads game state
README.md - Native visualizer → Web Hub: reads standings
README.md - Teams → Native visualizer: manually controls
README.md - Web Hub → Session leaderboard: presents standings
README.md