Inspiration
What if you could practice making difficult decisions without facing the real-world consequences of getting them wrong?
That question inspired ScenarioLab, a strategic decision simulation platform designed to let people explore complex situations, evaluate tradeoffs, and discover how their choices shape outcomes.
Whether you're managing a struggling startup, responding to a cybersecurity attack, or keeping a colony alive on Mars, every decision comes with consequences.
My goal was to build something that combines the accessibility of a game with the critical thinking involved in real-world problem-solving.
What it does
ScenarioLab offers three fully playable strategic simulations:
1. Startup Survival
Lead an early-stage company through 12 simulated months. Balance cash flow, revenue, customer satisfaction, employees, and team morale while navigating changing business conditions.
2. Cybersecurity Crisis
Take charge of an incident-response team during an escalating cyberattack. Manage system integrity, attacker momentum, operational continuity, stakeholder trust, and limited response resources. Every defensive action requires balancing containment against operational disruption.
3. Space Colony
Command a Mars settlement of 50 astronauts through 12 mission cycles. Manage oxygen, food, energy, crew morale, and infrastructure while responding to equipment failures, resource shortages, and unexpected discoveries.
Each simulation includes:
- Meaningful decisions with measurable consequences
- Scenario-specific events and strategic challenges
- Interactive dashboards and metric tracking
- Decision history and outcome reports
- Save, resume, and restart functionality
- Multiple victory and failure conditions
- Responsive interfaces with Classic and Dark themes
The objective isn't simply to find the correct answer. It's to understand the consequences of decisions under pressure.
How I built it
ScenarioLab uses a full-stack architecture:
- Frontend: React, TypeScript, Vite, and Tailwind CSS
- Backend: Python, FastAPI, and Pydantic
- Simulation: A deterministic, scenario-agnostic Python engine
- AI integration: OpenAI-compatible language-model APIs with structured validation and deterministic fallbacks
- Testing: Pytest, Vitest, and Playwright
- Deployment: Cloudflare Pages and Render
The most important architectural decision was separating simulation logic from AI-generated content.
The Python engine is responsible for authoritative game state, resource calculations, decision consequences, and victory or failure conditions.
AI is designed to enhance the experience through contextual strategic briefings and an optional Scenario Director capable of proposing situations and choices within validated constraints. It cannot directly override the simulation's authoritative rules.
The AI briefing integration was successfully tested locally using a real language-model request. The Scenario Director also has a guarded generation implementation, although an accepted live-generated proposal has not yet been verified.
The publicly deployed version currently uses authored fallback content with live AI generation disabled. This allows visitors to explore all three simulations without depending on paid model requests.
Challenges I ran into
One of the biggest challenges was designing a simulation engine flexible enough to support three completely different environments without duplicating the underlying logic.
Startup Survival focuses on business economics, Cybersecurity Crisis emphasizes adversarial pressure and operational continuity, and Space Colony relies on sustainable resource management.
Another major challenge was integrating generative AI responsibly.
Language models can produce useful narratives, but their outputs cannot be treated as authoritative game rules. I developed validation boundaries, deterministic consequence calculations, signed Director proposals, and replay verification to maintain consistency.
Deployment introduced its own challenges, including production environment configuration, signing-key validation, frontend/backend API compatibility, and handling service interruptions on free hosting infrastructure.
Accomplishments I'm proud of
- Built three distinct playable scenarios on one reusable simulation engine.
- Implemented deterministic state transitions and reproducible seeded events.
- Created an optional, security-conscious AI Scenario Director architecture.
- Added save/resume functionality with replay validation.
- Developed a responsive interface with interactive metrics, decision history, and final reports.
- Deployed the application publicly using Cloudflare Pages and Render.
- Successfully completed 154 backend tests, 83 frontend tests, and 27 Playwright browser tests during the release process.
- Passed 22 hosted production smoke checks across all three scenarios.
One especially rewarding result was seeing each scenario produce meaningful victories and failures using the same underlying engine.
What I learned
This project reinforced the importance of separating reliable application logic from probabilistic AI-generated content.
I also gained experience designing extensible software architecture, testing deterministic systems, validating external inputs, securing stateless replay, and deploying a full-stack application.
I used AI-assisted development tools, including Codex, to support implementation, debugging, and testing. The project involved iterative design decisions, integration, review, and verification rather than relying solely on generated code.
What's next
ScenarioLab is designed to grow beyond its first three simulations.
Future improvements include:
- Additional strategic scenarios
- More advanced AI-generated situations and briefings
- Broader AI Director support across scenarios
- Improved simulation balancing and difficulty options
- Multiple independent save slots
- More detailed analytics and post-simulation insights
- Expanded learning and training applications
My long-term vision is to make ScenarioLab a platform where people can safely explore difficult decisions, test strategies, and learn through simulated consequences.
Make decisions. Explore consequences.
Try ScenarioLab
Live application: https://scenariolab-38a.pages.dev
Built With
- cloudflare
- openai
- pytest
- python
- react
- render
- restapi
- tailwindcss
- typescript
- vite
- vitest