MVP Version | Sprint 23 (December 2025)
A web-based energy market simulation platform for educational and training purposes. Players manage virtual power plants, forecast market conditions, and compete in realistic energy markets with dynamic pricing.
- Unified Solo & Shared Flow: Consistent phase-based experience for individual and cohort play
- Briefing Phase: Scenario introduction with objectives before time pressure begins
- Real-time Market Simulation: Double-auction market clearing with supply/demand dynamics
- Device Management: Solar, Wind, Gas, Battery, Hydro with realistic constraints
- Multi-round Scenarios: Progress through time-based energy market challenges with structured pacing
- Round Results & Advancement: Players control pacing with "Continue" buttons between rounds
- Weighted Scoring System: Configurable KPI weights (profit, imbalance, curtailment)
- Leaderboard & Comparisons: Track performance and learn from strategies
- Visual Editor: Drag-and-drop device configuration
- Market Parameters: Price floors/caps, volumes, variability
- Grid Simulation: Multi-zone grids with transmission constraints (ATC matrices)
- Enhanced Events System: 8 event types including grid link ATC reduction
- Preview & Validation: Real-time supply/demand curve visualization
- Import/Export: JSON-based scenario sharing
- Player Types: Define role-specific device assignments for shared sessions
- Campaign Management: Sequential scenario progressions
- Cohort Administration: Group management, CSV import, player type configuration
- Live Monitoring: Real-time participant tracking with per-type submit status
- Session Controls: Start/pause/freeze rounds, force round end
- Shared Market Sessions: All players trade in unified market with balanced roles
- Performance Analytics: Weighted scoring, final rankings, round history
- Player Dashboard: Balance tracking, device portfolios, forecast accuracy
- Round-by-Round Results: Individual KPIs with active event displays
- Cumulative Performance: Final scenario results with round history accordion
- Comparison View: Side-by-side player strategy analysis
- Activity Logs: Comprehensive audit trail
- Performance Metrics: Profit, imbalance penalties, curtailment costs
- Docker & Docker Compose
- Git
git clone https://github.com/MatthiasHertel21/energy-game.git
cd energy-game
cp .env.example .envdocker-compose up -d --build- Frontend: http://localhost
- API Docs: http://localhost/api/docs
- Health: http://localhost/api/health
- Register at
/register(first user getsplayerrole) - Admin can create invites via
/api/docsโ POST/api/admin/invites - Assign roles:
player,trainer,designer,admin
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ React โโโโโโโถโ Flask API โโโโโโโถโ PostgreSQL โ
โ (Vite) โ โ (REST+WS) โ โ (State) โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ
โโโโโโโถ Redis (Sessions)
โโโโโโโถ Traefik (Routing)
- Frontend: React 18, Material-UI, D3.js, Socket.io-client
- Backend: Flask, SQLAlchemy, Flask-SocketIO, Gunicorn
- Database: PostgreSQL 15 (state), Redis 7 (sessions/cache)
- Proxy: Traefik v2 with Let's Encrypt
- Testing: Pytest (backend), Cypress (E2E)
- Engine (
backend/app/engine.py): Market clearing algorithm (double-auction) - Device Types (
backend/app/device_types.py): Power plant models - Sessions (
backend/app/sessions.py): Game state management - KSE (
frontend/src/pages/KSE.jsx): Scenario editor - Player (
frontend/src/pages/Player.jsx): Forecast interface
Baseline Metrics (Sprint 20, 100 concurrent users, Locust load test):
- Response Time: p50=4ms, p95=8ms, p99=15ms (excellent)
- Throughput: ~50 req/s sustained
- Known Issue: 93% error rate due to rate limiting (429) and missing auth in test setup
- Action: Sprint 21 will fix Locust auth and adjust rate limits for testing
See docs/PERFORMANCE_RESULTS.md for detailed metrics.
# In Docker
docker-compose exec backend python -m pytest tests/ -v
# Specific tests
docker-compose exec backend python -m pytest tests/test_engine.py -vCoverage:
- Market clearing algorithm
- Device models and validation
- Curtailment priority logic
- Use case scenarios
cd frontend
npm run cy:open # Interactive
npm run cy:run # HeadlessTest Coverage (Sprint 20): 20 E2E specs including:
smoke.cy.js- Core user flowstrainer.cy.js- Session managementplayer.cy.js- Forecast submissionkse-devices.cy.js- Device editora11y.cy.js- Accessibility auditscampaign-timeline.cy.js- Campaign navigationcohorts-import.cy.js- CSV importcomparison.cy.js- Leaderboard comparison
All 20 specs passing as of Sprint 20.
See docs/DEPLOYMENT.md for details on:
- Database migrations (
flask db upgrade) - Backup procedures (
backend/scripts/backup.sh) - Production deployment
- Docker Compose stability
Sprint 21 Focus (14 KSE UI/UX Issues):
- KSE-1 (P0): Market/Preview tabs broken in KSE editor
- KSE-2 (P0): Device constraint validation missing
- KSE-3 through KSE-14: UI/UX refinements for MVP quality
See docs/backlog.md (Sprint 21 section) and docs/open-issues.md for full details.
DevOps:
- Docker Compose stability: Use
deploy.shwith retry logic (seedocs/DEPLOYMENT.md)
docs/concept.md- Architecture & MVP scopedocs/usecases.md- Functional requirementsdocs/SPRINT_*_PLAN.md- Development roadmap (23 sprints: 1-20 complete, 21 active, 22-23 planned)docs/SPRINT_*_SUMMARY.md- Sprint retrospectivesdocs/QA_CHECKS.md- Pre-launch checklistdocs/PERFORMANCE_RESULTS.md- Load test baselinedocs/PLANUNGSSTAND_ANALYSE.md- Planning analysis (Sprint 20)
Role Handbooks
docs/guide/player-handbook.md- Player Guidedocs/guide/trainer-handbook.md- Trainer Guidedocs/guide/designer-handbook.md- Designer/KSE Guidedocs/guide/admin-handbook.md- Admin Guide
Last Updated: Sprint 21 (2025-11-20) - flask db migrate -m "init" - flask db upgrade
- Weitere รnderungen:
- flask db migrate -m "change"
- flask db upgrade
Hinweis: create_all() wurde entfernt. Bitte Migrationen nutzen.
Docker/CI Tipp:
- Inside backend container:
docker compose exec backend flask db upgrade - Helper Script:
backend/scripts/migrate.shfรผhrt init (falls nรถtig), migrate und upgrade aus.
- Script:
backend/scripts/backup.sh(schreibt/backup/emsg_YYYYmmdd_HHMMSS.dump) - BeispielโCron (Host):
0 2 * * * docker compose exec -T backend bash -lc "/app/scripts/backup.sh"
- LogโRotation: Backend lรคuft unter Gunicorn; ergรคnze systemweite logrotate oder DockerโLoggingโDriver nach Bedarf.
# In Docker
docker compose exec backend python -m pytest tests/ -v
# Spezifische Tests
docker compose exec backend python -m pytest tests/test_engine.py -v
docker compose exec backend python -m pytest tests/test_device_types.py -vcd frontend
# Interaktive UI
npm run cy:open
# Headless
npm run cy:run
# Spezifische Tests
npm run cy:run -- --spec "cypress/e2e/kse-devices.cy.js"Tests verfรผgbar:
smoke.cy.js- Login, KSE Preview, Trainer Start, Player Forecasttrainer.cy.js- Session Management, Shared Marketplayer.cy.js- Full Forecast, Submitcomparison.cy.js- Leaderboard, Comparison Dashboardkse-import.cy.js- KSE JSON Import/Exportcohorts-import.cy.js- Cohort CSV Importkse-devices.cy.js- Device Model (Coal, Nuclear, Solar, Battery, Loads)replay.cy.js- Replay Mode (derzeit instabil/geskippt)
cd backend/tests/perf
locust -f locustfile.py --host=http://localhost