# PRODUCTION - The Idle Game > **"Build the Ultimate Global Supply Chain Empire."** **Production - The Idle Game** is an expansive, strategic incremental/idle tycoon simulator inspired by *Factorio*, *Capitalism*, and modern industrial engineering games. Take command of a burgeoning enterprise, starting from primary extraction (wheat, timber, iron ore) and scaling into complex, multi-tiered industrial supply chains producing microchips, commercial trucks, consumer smartphones, electric hypercars, quantum computers, and space launch vehicles. The game is packaged as a lightweight, turnkey **Docker Compose stack** powered by a fast Python FastAPI backend with SQLite persistence and a high-performance Nginx reverse-proxy frontend. --- ## 🌟 Key Features * **True Supply Chain Dependencies (Directed Acyclic Graph - DAG Pipeline):** * Higher-tier industrial goods require and physically consume stockpiles of lower-tier commodities. * Real-time bottleneck detection and alerts when upstream inputs run short. * **Fine-Tuned Operational Controls:** * **Production Target Throttling:** Dial down any facility to 100%, 75%, 50%, 25%, or 0% (Paused) to conserve upstream stockpiles or manage intermediate bottlenecks. * **Distribution Fleet Toggle:** Toggle wholesale logistics off per facility to preserve finished goods for internal downstream lines or B2B tenders. * **Downstream Supply Policy:** Block or permit delivery to downstream consumers on a per-facility basis. * **12 Interconnected Industry Sectors (96 Facilities & Commodities across 8 Tiers):** 1. **Agriculture & Food:** Wheat, Milled Flour, Sugar Beet, Refined Sugar, Artisan Bread, Packaged Meals, Fermented Yeast, Craft Beer. 2. **Forestry & Materials:** Raw Timber, Milled Planks, Industrial Paper, Wood Pulp, Packaging Cartons, Plywood Sheets, Designer Furniture, Luxury Paperboard. 3. **Mining & Metallurgy:** Iron Ore, Coking Coal, Crude Bauxite, Structural Steel, Refined Aluminium, Heavy Frameworks, Copper Ore, Refined Copper Wire. 4. **Chemicals & Polymers:** Crude Oil, Silica Quartz Sand, Industrial Polymers, Purified Silicon, Industrial Fertilizer, Synthetic Resin, Industrial Solvent, Advanced Composites. 5. **Energy & Power:** Raw Coal, Enriched Uranium, Solar Silicon Wafers, High-Capacity Batteries, Power Grid Transformers, Fuel Cells, Supercapacitors, Fusion Fuel Cells. 6. **Electronics & Microtechnology:** Silicon Microchips, PCB Motherboards, Optical Glass, Micro Sensors, Display Panels, Consumer Smartphones, Fiber Optic Transceivers, Quantum Logic Gates. 7. **Automotive & Heavy Industry:** Industrial Engines, Commercial Logistics Trucks, Industrial Gearboxes, Electric Drive Motors, Lithium Battery Packs, Electric Hypercars, Construction Cranes, Heavy Excavators. 8. **Construction & Civil Engineering:** Limestone Rock, Portland Cement, Concrete Slag, Reinforced Rebar, Precast Concrete Beams, Architectural Glass, Steel Modular Trusses, High-Rise Prefab Pods. 9. **Biotechnology & Pharmaceuticals:** Organic Culture Broth, Herbal Biomass, Synthetic Enzymes, Active Pharma Ingredients, Sterile Syringes, Antibiotic Medicine, Bio-Polymer Hydrogels, Gene Therapy Vials. 10. **Consumer Goods & Appliances:** Cotton Fiber, Spun Yarn, Industrial Fabrics, Tempered Glass, Workwear Apparel, Smart Washing Machines, Smart Refrigerators, Robotic Vacuum Cleaners. 11. **Robotics & Industrial Automation:** Hydraulic Pistons, Precision Servos, CNC Controllers, Industrial Robotic Arms, Automated Conveyors, Factory Cobots, Autonomous Mobile Robots, Automated High-Bay Warehouses. 12. **Aerospace & Defense:** High-Strength Titanium Alloy, Jet Turbine Bladings, Turbofan Jet Engines, Carbon-Carbon Heat Shields, Commercial Avionics Suites, Satellite Bus Platforms, Commercial Airliners, Orbital Launch Vehicles. * **Corporate Reputation (Rep) & Strategic Standing Hub:** * Fulfilling B2B procurement tenders awards **Corporate Reputation (Rep)** into your company's strategic reserve pool. * Re-allocate Rep points dynamically at any time across 3 strategic pillars: * **Model 1: B2B Procurement Standing:** Earn **+0.5% bonus cash payout** per allocated Rep point on every fulfilled corporate tender. * **Model 2: Client Strategic Relations (MegaCorp Synergies):** Deepen alliances with the 4 MegaCorps: * *Apex Resources:* **+0.2% raw material extraction yield** per point. * *Titan Heavy Industries:* **0.2% discount on line expansion costs** per point (up to 50% discount). * *Omni Dynamics:* **+0.15% cycle speed** per point. * *Vanguard Shipping:* **+0.25% logistics fleet sales throughput** per point. * **Model 3: Wholesale Brand Premium:** Command market pricing power with **+0.25% higher wholesale sales price** on all passive fleet sales per point. * Points can be recalled and redistributed via the **Reset Allocations** button at any time. * **Modular "Plug & Play" Product Architecture (Scale to 100+ Products):** * Sector manifests are stored as self-contained ES-module catalog files under `frontend/js/data/sectors/*.js`. * **Single Source of Truth:** The Python FastAPI backend dynamically parses and registers sector files on startup (`backend/catalog_loader.py`), keeping frontend and backend simulation logic 100% in sync without duplicated configurations. * Adding new sectors or units is as simple as dropping a new sector file or object into `frontend/js/data/sectors/` and adding matching photos. * See [`PRODUCT_GENERATOR_GUIDE.md`](./PRODUCT_GENERATOR_GUIDE.md) for complete manifest schemas, AI generator prompts, and instructions for bulk-adding products and sectors. * **Flexible Floor Displays (Standard & Compact Views):** * **Standard View:** Comprehensive cards featuring high-resolution cropped photographic banners of finished commodities, input chips with live depletion rates, policy switches, and batch action bars. * **Compact View:** Dense, high-information table grid featuring square commodity thumbnails, real-time cycle progress indicators, quick-buy expansion buttons, and direct technical dossier links. Toggle easily via the header button. * **Dedicated Facility Intelligence Dossier (Unit Detail View):** * Clicking any facility card or inspector link opens a full-page deep-dive analytics dossier. * **Financial Telemetry:** Wholesale unit price, live revenue/s, projected revenue/hour, asset valuation, and stock inventory value. * **Cycle Dynamics:** Operating lines, base cycle duration, milestone throughput multipliers, batches/second, units/second, and hourly output projections. * **Net Flow Balance Breakdown:** Transparent arithmetic showing `Production Rate - Downstream Pull - Logistics Sales = Net Inventory Change (Ξ”/s)`. * **Visual Presentation:** Dual photography for facility architecture blueprints and product specimens. * **Spot-Market Liquidation:** Instantly liquidate 50% or 100% of stockpiles for immediate emergency cash injection. * **Interactive Upstream/Downstream DAG Navigation:** Jump between connected facilities with one click. * **Savegame Import & Export:** * Complete data portability: Export your entire corporate empire as an encrypted/formatted JSON save file directly from your user profile modal. * Seamlessly backup, inspect, restore, or transfer savegames across devices and browsers. * **Streamlined Executive Navigation & Layout:** * **Full-Width Sticky Executive Header:** * **Capital & Valuation:** Consolidated live cash balance, net cashflow/s, Enterprise Valuation, and Venture Shares ($V-Shares). * **Full-Width Sector Control Bar:** Seamless edge-to-edge sector switcher with live sector income rates and alert badges. * **Department Quick-Actions:** Instant access to B2B Contracts, Boardroom, Milestones, and Buy Multipliers (1x, 10x, 100x, Next). * **Theme & Number Settings:** Built-in Dark / Light theme toggle with persistent preferences and Standard/Scientific notation toggle. * **Zero Annoying Browser Popups:** All interactions, confirmations, and alerts use native, stylized modals and toasts. * **Dual Revenue Channels:** * **Continuous Logistics Distribution:** Deploy dedicated logistics fleets to automatically wholesale products to regional distributors for continuous passive cashflow. * **B2B Procurement Contracts Board:** Bid on time-sensitive procurement tenders from MegaCorps for massive capital injections and corporate prestige. * **Corporate IPO & Boardroom Prestige:** * File for an **Initial Public Offering (IPO)** on Wall Street when your enterprise valuation reaches critical mass. * Cash in for **Venture Shares ($V-Shares)** to unlock permanent perks on the Boardroom R&D Tech Tree: * *Automated Supply Chain Routing:* +15% raw yield per level. * *Industrial Robotics & AI:* +20% cycle speed per level. * *Fleet Logistics Optimization:* +25% wholesale sales price per level. * *State Subsidies & Procurement:* +35% cash payout on completed B2B tenders per level. * *Venture Capital Syndicate:* Seed corporate re-expansions with up to $5,000,000 starting cash. * *Brand Legacy & Heritage:* Retain 10%, 20%, 30%, 40%, up to 50% of your accumulated Corporate Reputation across IPOs. * **Cloud & Offline Sync:** * Instant Guest play with local persistence. * Optional lightweight account system (username + password with anti-bot honeypot protection). * Authoritative offline tick engine: when you return, automated lines calculate production and logistics sales up to 8 hours. --- ## πŸ› οΈ Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Browser Client UI β”‚ β”‚ (ES Modules, CSS3) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ HTTP / :HOST_PORT β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Nginx Proxy β”‚ β”‚ (Reverse Proxy) β”‚ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ / (Static Assets) β”‚ /api/* β”‚ β–Ό β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Python FastAPIβ”‚ β”‚ β”‚ (JWT & Engine)β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό [frontend/] [SQLite DB] (/app/data/production.db) ``` --- ## πŸš€ Quick Start with Docker Compose ### 1. Prerequisites * [Docker](https://docs.docker.com/get-docker/) & [Docker Compose](https://docs.docker.com/compose/) * (Optional for standalone testing) Python 3.10+ ### 2. Configuration (.env) Create a `.env` file from the example: ```bash cp .env.example .env ``` ### 3. Launch the Stack ```bash docker compose up -d --build ``` The game is live in your browser at: πŸ‘‰ **`http://localhost:8081`** (or the port defined in `.env`). ### 4. Running Verification & DAG Validation To run the automated backend engine simulation tests: ```bash python backend/test_engine.py ``` To run the automated supply chain integrity and DAG validator: ```bash python backend/validate_dag.py ``` *(Verifies cycle-free graphs, valid input/output dependencies, positive tier-margin economics, and file reference consistency across all modular sectors.)* --- ## πŸ“ Project Directory Structure ``` . β”œβ”€β”€ .env.example β”œβ”€β”€ docker-compose.yml β”œβ”€β”€ FACILITY_PHOTO_PROMPT_GUIDE.md # Photographic generation guide for units & goods β”œβ”€β”€ PRODUCT_GENERATOR_GUIDE.md # AI prompt & schema guide for scaling to 100+ products β”œβ”€β”€ README.md # Master project overview & architecture documentation β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ Dockerfile β”‚ β”œβ”€β”€ requirements.txt β”‚ β”œβ”€β”€ auth.py # JWT authentication & password hashing β”‚ β”œβ”€β”€ catalog_loader.py # Dynamic loader for modular frontend sector files β”‚ β”œβ”€β”€ database.py # SQLite connection and migration setup β”‚ β”œβ”€β”€ engine.py # Authoritative DAG simulation, Rep bonuses & offline calculations β”‚ β”œβ”€β”€ main.py # FastAPI endpoints β”‚ β”œβ”€β”€ models.py # Pydantic schemas β”‚ β”œβ”€β”€ test_engine.py # Comprehensive backend regression test suite β”‚ └── validate_dag.py # Automated DAG integrity, cycle & margin validator β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ index.html # Full-width executive workspace layout β”‚ β”œβ”€β”€ assets/ β”‚ β”‚ └── images/ β”‚ β”‚ β”œβ”€β”€ facilities/ # Facility architectural blueprints/photos β”‚ β”‚ └── products/ # Commodity and material specimen photos β”‚ β”œβ”€β”€ css/ β”‚ β”‚ β”œβ”€β”€ style.css # Central stylesheet orchestrator β”‚ β”‚ β”œβ”€β”€ base/ β”‚ β”‚ β”‚ β”œβ”€β”€ reset.css # Typography, normalize and box model β”‚ β”‚ β”‚ └── theme.css # Light & Dark theme tokens, form elements & scrollbars β”‚ β”‚ β”œβ”€β”€ layout/ β”‚ β”‚ β”‚ β”œβ”€β”€ header.css # Full-width sticky executive header & HUD β”‚ β”‚ β”‚ β”œβ”€β”€ workspace.css# Responsive content canvas β”‚ β”‚ β”‚ └── responsive.css# Breakpoints & mobile navigation β”‚ β”‚ └── views/ β”‚ β”‚ β”œβ”€β”€ production.css # Facility cards, compact grid & sector summaries β”‚ β”‚ β”œβ”€β”€ unitDetail.css # Full facility intelligence dossier β”‚ β”‚ β”œβ”€β”€ contracts.css # B2B contracts board & Reputation Allocation Hub β”‚ β”‚ β”œβ”€β”€ boardroom.css # Executive suite & IPO perks β”‚ β”‚ └── achievements.css# Milestones & badges β”‚ └── js/ β”‚ β”œβ”€β”€ app.js # Application orchestrator, theme manager & event loop β”‚ β”œβ”€β”€ core/ β”‚ β”‚ β”œβ”€β”€ engine.js # Client-side DAG tick simulation & Rep multipliers β”‚ β”‚ β”œβ”€β”€ formatters.js# Number notations (Standard K/M/B/T, Scientific, Currency) β”‚ β”‚ β”œβ”€β”€ state.js # State manager, savegame export/import & IPO reset β”‚ β”‚ └── sync.js # Backend synchronization & auth handling β”‚ β”œβ”€β”€ data/ β”‚ β”‚ β”œβ”€β”€ products.js # Central re-exporter of modular sectors β”‚ β”‚ β”œβ”€β”€ sectors/ # 12 Modular sector files (Agriculture, Aerospace, Biotech, etc.) β”‚ β”‚ β”œβ”€β”€ contracts.js # B2B procurement tenders & clients β”‚ β”‚ β”œβ”€β”€ boardroom.js # IPO perks, Brand Legacy & Venture Share logic β”‚ β”‚ └── achievements.js β”‚ └── ui/ β”‚ β”œβ”€β”€ productionView.js β”‚ β”œβ”€β”€ unitDetailView.js β”‚ β”œβ”€β”€ contractsView.js β”‚ β”œβ”€β”€ boardroomView.js β”‚ β”œβ”€β”€ achievementsView.js β”‚ └── production/ β”‚ β”œβ”€β”€ compactFacilityCard.js β”‚ β”œβ”€β”€ facilityCard.js β”‚ β”œβ”€β”€ ratesCalculator.js β”‚ └── sectorBar.js └── nginx/ └── default.conf.template ``` --- ## 🎨 Asset Generation & Custom Visuals * Refer to [`FACILITY_PHOTO_PROMPT_GUIDE.md`](./FACILITY_PHOTO_PROMPT_GUIDE.md) for master prompts and camera recipes to generate photorealistic assets for production facilities and commodities using modern image models (Midjourney, Stable Diffusion, Imagen). Dropping generated images into `frontend/assets/images/facilities/` and `frontend/assets/images/products/` seamlessly populates the cards and dossiers. * Refer to [`PRODUCT_GENERATOR_GUIDE.md`](./PRODUCT_GENERATOR_GUIDE.md) when generating new products, supply chain DAG tiers, or entire industry sectors.