Skip to content

Build a reckless space colony, unlock deadly planets, survive solar flares, and steal food from your friends. If you ban water, your colonists will email you death threats. Good luck.

Notifications You must be signed in to change notification settings

simransummermalik/BioForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Bioforge Simulator - Space Colony Management Game

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!

🎮 Game Overview

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

🏗️ Project Structure

Frontend Components (src/components/)

Core Game Components

  • App.js - Main application component and routing
  • GameHUD.js - Heads-up display showing resources and colony stats
  • NotificationSystem.js - Toast notifications for events and alerts
  • SimulationControls.js - Game speed and simulation controls

Colony Management

  • ColonyDashboard.js - Main colony overview and statistics
  • ColonyManagement.js - Detailed colony management interface
  • ColonyReports.js - Colony status reports and analytics
  • ResourceManager.js - Resource allocation and management
  • ResourcePanel.jsx - Real-time resource display panel
  • BuildingSystem.js - Construction and building management
  • BuildingInterface.js - Building placement and upgrades

Communication Systems

  • 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

Laws and Governance

  • LawsSystem.js - Law creation, management, and enforcement
  • LawsGovernance.jsx - Advanced governance and policy tools
  • AIAdvisor.js - AI assistant for colony management advice

Evolution and Science

  • HumanEvolution.js - Human evolution simulation and tracking
  • HumanGenerator.js - Generate new human variants with traits
  • HumanCreator.jsx - Advanced human creation interface
  • EvolutionLab.js - Laboratory for evolution experiments
  • EvolutionChart.js - Visual evolution progress tracking
  • EvolutionTracker.js - Evolution statistics and history
  • EvolutionBattleArena.js - Combat simulation between evolved humans
  • CreatureBreeding.js - Breeding system for evolved creatures
  • EvolutionSkillTree.js - Skill progression for evolved humans

Space and Exploration

  • PlanetSelector.js - Choose and explore different planets
  • PlanetExplorer.js - Planetary exploration interface
  • MissionControl.js - Space missions and exploration management
  • SpaceEventSystem.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

Social Features

  • FriendsSystem.js - Multiplayer friends and social features
  • LoginPage.js - User authentication and login
  • SignupPage.js - User registration
  • StatsPage.js - Player statistics and achievements

Simulation and Analysis

  • MonteCarloSimulator.js - Advanced statistical simulations
  • SimulationResults.js - Display simulation outcomes
  • DiseaseGenerator.js - Disease outbreak simulation
  • RealTimeDataDisplay.js - Live data visualization

Backend APIs (app/api/)

AI-Powered APIs

  • 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

Data APIs

  • 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

Backend Python Scripts (backend/)

Evolution Engines

  • evolution_engine_v5.py - Advanced evolution simulation
  • advanced_evolution.py - Complex evolutionary algorithms
  • simulate.py - Core simulation engine

Database (scripts/)

  • create-tables.sql - Database schema for user data, colonies, laws

🔧 Key Game Mechanics

Resource Management

  • 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

Email Complaint System

The EmailSystem.js is the heart of the game's feedback mechanism:

  1. Monitoring: Checks colony conditions every 2 seconds
  2. Thresholds: Triggers at resource levels below 500 (very sensitive)
  3. Escalation: 6 severity levels with increasingly hostile language
  4. Frequency: Minimum 8 seconds between emails, 85% send probability
  5. Law Reactions: Special handling for water bans (severity 6), food restrictions (severity 5)
  6. Persistence: Tracks ignored issues and escalates anger over time

Space Event System

SpaceEventSystem.js creates dynamic challenges:

  1. Event Types: 12 different events from solar flares to supply drops
  2. Frequency: 80% chance every 10 seconds after initial 10-second grace period
  3. Impact: Significant resource and colony stat changes
  4. Realism: Based on actual space colonization challenges

Law System Integration

Laws created through the AI system have real consequences:

  1. AI Generation: generate-law/route.js creates realistic laws
  2. Impact Analysis: generate-law-effects/route.js predicts citizen reactions
  3. Real Effects: Laws actually change resource consumption and colony stats
  4. Citizen Feedback: EmailSystem.js generates complaints about unpopular laws

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.8+ (for evolution engines)
  • Database (PostgreSQL recommended)

Installation

  1. Clone the repository ```bash git clone [repository-url] cd bioforge-simulator ```

  2. Install dependencies ```bash npm install ```

  3. Set up environment variables Create .env.local: ```env

AI APIs

OPENAI_API_KEY=your_openai_key

Database

DATABASE_URL=your_database_url

NASA API (optional)

NASA_API_KEY=your_nasa_key ```

  1. Initialize database ```bash

Run the SQL scripts in scripts/

psql -d your_database -f scripts/create-tables.sql ```

  1. Start development server ```bash npm run dev ```

🎯 Gameplay Tips

Surviving the Email Spam

  • 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

Managing Laws

  • 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

Space Event Survival

  • 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

Evolution Strategy

  • 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

🔧 Technical Architecture

Frontend Stack

  • React 18 with hooks and functional components
  • Next.js 14 with App Router
  • CSS Modules for component styling
  • Real-time updates via useEffect intervals

Backend Stack

  • Next.js API Routes for serverless functions
  • AI SDK for AI integrations (OpenAI, xAI, Groq)
  • Python scripts for complex simulations
  • PostgreSQL for persistent data

Key Design Patterns

  • Component composition for modular UI
  • State management via React hooks and context
  • Event-driven architecture for game events
  • API-first design for AI integrations

🐛 Troubleshooting

Common Issues

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.js is 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

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly (especially email and event systems)
  5. Submit a pull request

Development Guidelines

  • 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

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • 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! 🚀👨‍🚀💀

About

Build a reckless space colony, unlock deadly planets, survive solar flares, and steal food from your friends. If you ban water, your colonists will email you death threats. Good luck.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published