A comprehensive space colonization and evolution simulation game built with React and Next.js. Manage your colony, create laws, evolve humans, and survive the harsh realities of space while dealing with increasingly angry colonists!
Bioforge Simulator is a complex space colony management game where you:
- Manage Resources: Food, Water, Energy, Oxygen, Materials, and Money
- Create Laws: Use AI to generate laws and see how citizens react
- Handle Crises: Deal with space events, equipment failures, and angry emails
- Evolve Humans: Use advanced evolution engines to create new human variants
- Build Colonies: Construct buildings and manage infrastructure
- Survive: Keep your colonists alive and (relatively) happy
App.js- Main application component and routingGameHUD.js- Heads-up display showing resources and colony statsNotificationSystem.js- Toast notifications for events and alertsSimulationControls.js- Game speed and simulation controls
ColonyDashboard.js- Main colony overview and statisticsColonyManagement.js- Detailed colony management interfaceColonyReports.js- Colony status reports and analyticsResourceManager.js- Resource allocation and managementResourcePanel.jsx- Real-time resource display panelBuildingSystem.js- Construction and building managementBuildingInterface.js- Building placement and upgrades
EmailSystem.js- CRITICAL COMPONENT - Handles angry colonist emails- Monitors resource levels, colony health, morale, and laws
- Generates increasingly hostile emails based on colony conditions
- 6 severity levels from "Mild" to "EXECUTION THREAT"
- Checks every 2 seconds, sends emails every 8 seconds minimum
- 85% chance to send email when conditions are met
- Tracks ignored issues and escalates anger accordingly
LawsSystem.js- Law creation, management, and enforcementLawsGovernance.jsx- Advanced governance and policy toolsAIAdvisor.js- AI assistant for colony management advice
HumanEvolution.js- Human evolution simulation and trackingHumanGenerator.js- Generate new human variants with traitsHumanCreator.jsx- Advanced human creation interfaceEvolutionLab.js- Laboratory for evolution experimentsEvolutionChart.js- Visual evolution progress trackingEvolutionTracker.js- Evolution statistics and historyEvolutionBattleArena.js- Combat simulation between evolved humansCreatureBreeding.js- Breeding system for evolved creaturesEvolutionSkillTree.js- Skill progression for evolved humans
PlanetSelector.js- Choose and explore different planetsPlanetExplorer.js- Planetary exploration interfaceMissionControl.js- Space missions and exploration managementSpaceEventSystem.js- CRITICAL COMPONENT - Random space events- Triggers events like solar flares, meteor showers, equipment failures
- 12 different event types with varying probabilities
- 80% chance to trigger event every 10 seconds
- Events affect resources and colony stats significantly
- Includes both harmful and beneficial events
FriendsSystem.js- Multiplayer friends and social featuresLoginPage.js- User authentication and loginSignupPage.js- User registrationStatsPage.js- Player statistics and achievements
MonteCarloSimulator.js- Advanced statistical simulationsSimulationResults.js- Display simulation outcomesDiseaseGenerator.js- Disease outbreak simulationRealTimeDataDisplay.js- Live data visualization
-
generate-law/route.js- CORE API - Generates laws using AI- Uses OpenAI/AI SDK to create realistic laws
- Takes category and context as input
- Returns formatted law text with implementation details
-
generate-law-effects/route.js- CRITICAL API - Analyzes law impact- Analyzes law text for citizen reactions
- Detects water bans, food restrictions, authoritarian measures
- Returns citizen reaction level, resource effects, colony effects
- Water bans trigger "ABSOLUTELY FURIOUS - DEATH THREATS IMMINENT"
- Provides detailed effect predictions for the AI advisor
-
generate-email/route.js- Generates AI-powered complaint emails- Creates contextual emails based on colony issues
- Escalates tone based on severity and ignored complaints
- Used as fallback when EmailSystem.js templates aren't sufficient
-
generate-complaint/route.js- Generates specific complaints- Creates targeted complaints about specific issues
- Used for more nuanced complaint generation
nasa-mars/route.js- SPACE DATA API - Real Mars data integration- Fetches real Mars weather data from NASA APIs
- Provides atmospheric conditions, temperature, pressure
- Integrates real space data into game simulation
- Affects colony conditions based on actual Mars weathe
evolution_engine_v5.py- Advanced evolution simulationadvanced_evolution.py- Complex evolutionary algorithmssimulate.py- Core simulation engine
create-tables.sql- Database schema for user data, colonies, laws
- Food: Keeps colonists alive, depletes over time
- Water: Essential for survival, triggers extreme anger when restricted
- Energy: Powers all systems, affects life support
- Oxygen: Critical for breathing, immediate death threat when low
- Materials: Used for construction and repairs
- Money: Economic resource for trading and upgrades
The EmailSystem.js is the heart of the game's feedback mechanism:
- Monitoring: Checks colony conditions every 2 seconds
- Thresholds: Triggers at resource levels below 500 (very sensitive)
- Escalation: 6 severity levels with increasingly hostile language
- Frequency: Minimum 8 seconds between emails, 85% send probability
- Law Reactions: Special handling for water bans (severity 6), food restrictions (severity 5)
- Persistence: Tracks ignored issues and escalates anger over time
SpaceEventSystem.js creates dynamic challenges:
- Event Types: 12 different events from solar flares to supply drops
- Frequency: 80% chance every 10 seconds after initial 10-second grace period
- Impact: Significant resource and colony stat changes
- Realism: Based on actual space colonization challenges
Laws created through the AI system have real consequences:
- AI Generation:
generate-law/route.jscreates realistic laws - Impact Analysis:
generate-law-effects/route.jspredicts citizen reactions - Real Effects: Laws actually change resource consumption and colony stats
- Citizen Feedback: EmailSystem.js generates complaints about unpopular laws
- Node.js 18+
- Python 3.8+ (for evolution engines)
- Database (PostgreSQL recommended)
-
Clone the repository ```bash git clone [repository-url] cd bioforge-simulator ```
-
Install dependencies ```bash npm install ```
-
Set up environment variables Create
.env.local: ```env
OPENAI_API_KEY=your_openai_key
DATABASE_URL=your_database_url
NASA_API_KEY=your_nasa_key ```
- Initialize database ```bash
psql -d your_database -f scripts/create-tables.sql ```
- Start development server ```bash npm run dev ```
- Keep resources above 500 to avoid constant complaints
- Water bans are DEADLY - citizens will threaten execution
- Read the emails - they provide hints about what's wrong
- Build infrastructure before resources get too low
- Test law effects using the AI prediction system
- Avoid banning essential resources (water, food, oxygen)
- Positive laws (free healthcare, education) boost morale
- Authoritarian laws decrease morale but may be necessary
- Maintain resource buffers for when disasters strike
- Build redundant systems to survive equipment failures
- Monitor notifications for early warning of events
- Emergency supplies can save your colony
- Experiment with traits to create specialized humans
- Use the battle arena to test evolved variants
- Breed successful combinations for better survival
- Skill trees provide long-term progression
- React 18 with hooks and functional components
- Next.js 14 with App Router
- CSS Modules for component styling
- Real-time updates via useEffect intervals
- Next.js API Routes for serverless functions
- AI SDK for AI integrations (OpenAI, xAI, Groq)
- Python scripts for complex simulations
- PostgreSQL for persistent data
- Component composition for modular UI
- State management via React hooks and context
- Event-driven architecture for game events
- API-first design for AI integrations
Emails not appearing:
- Check if resources are below thresholds (500 for each resource)
- Verify EmailSystem.js is receiving gameState updates
- Check browser console for errors
Law effects showing "neutral":
- Ensure
generate-law-effects/route.jsis running - Check API key configuration
- Verify law text contains trigger words
Space events not triggering:
- Wait 10 seconds after game start
- Check SpaceEventSystem.js is mounted
- Verify updateGameState function is working
NASA data not loading:
- NASA API can be unreliable - this is normal
- Game will work without NASA data
- Check NASA_API_KEY if you want real Mars data
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly (especially email and event systems)
- Submit a pull request
- Test email system with various resource levels
- Verify law reactions work correctly
- Check space event impacts on colony stats
- Maintain backwards compatibility with save data
This project is licensed under the MIT License - see the LICENSE file for details.
- NASA for Mars weather data APIs
- OpenAI for AI-powered law generation
- React/Next.js communities for excellent documentation
- Space colonization research for realistic game mechanics
Warning: This game features intense colonist complaints and death threats when you mismanage the colony. This is intentional game design to create pressure and consequences for poor leadership decisions. The language escalates dramatically to emphasize the life-or-death nature of space colonization.
Have fun managing your space colony, and try not to let your colonists execute you! 🚀👨🚀💀