Production 🛠️ The Idle Game
Find a file
2026-10-16 17:16:32 +02:00
backend feat(arch): implement single-source-of-truth modular sector registry and DAG validator for scaling to 100+ products 2026-10-16 16:45:42 +02:00
frontend feat(arch): implement single-source-of-truth modular sector registry and DAG validator for scaling to 100+ products 2026-10-16 16:45:42 +02:00
nginx
.env.example
.gitignore
docker-compose.yml feat(arch): implement single-source-of-truth modular sector registry and DAG validator for scaling to 100+ products 2026-10-16 16:45:42 +02:00
FACILITY_PHOTO_PROMPT_GUIDE.md feat(ui): complete desktop executive header, facility detail view, dark theme and AI photo guide 2026-10-16 13:37:17 +02:00
PRODUCT_GENERATOR_GUIDE.md feat(arch): implement single-source-of-truth modular sector registry and DAG validator for scaling to 100+ products 2026-10-16 16:45:42 +02:00
README.md docs: update README.md with DAG validator, catalog loader, and 100+ product scaling guide 2026-10-16 17:16:32 +02:00

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 idle 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, and corporate office furniture.

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.
    • 6 Interconnected Industry Sectors (24 Facilities & Commodities):
      1. Agriculture & Food: Wheat, Milled Flour, Sugar Beet, Refined Sugar, Artisan Bread, Packaged Meals.
      2. Forestry & Materials: Raw Timber, Milled Planks, Industrial Paper, Office Furniture.
      3. Mining & Metallurgy: Iron Ore, Coking Coal, Structural Steel, Heavy Frameworks.
      4. Chemicals & Polymers: Crude Oil, Silica Quartz Sand, Industrial Polymers, Purified Silicon, Industrial Fertilizer.
      5. High-Tech & Electronics: Silicon Microchips, PCB Motherboards, Consumer Smartphones.
      6. Heavy Industry & Vehicles: Industrial Engines, Commercial Logistics Trucks.
  • 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.
    • Creating a new sector or adding 10, 50, or 100+ new units requires simply dropping a new sector file or object into frontend/js/data/sectors/ and adding matching photos.
    • See PRODUCT_GENERATOR_GUIDE.md for complete manifest schemas, AI generator prompts, and instructions for bulk-adding products and sectors.
  • Dedicated Facility Intelligence Dossier (Unit Detail View):

    • Clicking any facility card opens a comprehensive, full-page analytics dossier tailored for data and numbers enthusiasts.
    • 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 placeholders for facility architecture and product specimens (with pre-built hooks for custom photographic assets).
    • 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.
  • 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.
      • 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.
    • Responsive Grid Layout:
      • "All Sectors" view displays a clean 3x2 grid on desktop and 2 columns on tablet/mobile.
      • Mobile optimization with thumb-friendly bottom navigation and condensed pill icons.
  • 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 and industrial clients 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 ERP Routing, Industrial Robotics, Logistics Subsidies, Venture Capital Syndicate).
  • 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

2. Configuration (.env)

Create a .env file from the example:

cp .env.example .env

3. Launch the Stack

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:

python backend/test_engine.py

To run the automated supply chain integrity and DAG validator:

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
├── 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 and 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 & sector summaries
│   │       ├── unitDetail.css  # Full facility intelligence dossier
│   │       ├── contracts.css   # B2B contracts board
│   │       ├── 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
│       │   ├── formatters.js# Number notations (Standard K/M/B/T, Scientific, Currency)
│       │   ├── state.js     # State manager, schema handling & IPO reset
│       │   └── sync.js      # Backend synchronization & auth handling
│       ├── data/
│       │   ├── products.js  # Central re-exporter of modular sectors
│       │   ├── sectors/     # Modular sector & product definitions (Agriculture, etc.)
│       │   ├── contracts.js # B2B procurement tenders
│       │   ├── boardroom.js # IPO perks and Venture Share logic
│       │   └── achievements.js
│       └── ui/
│           ├── productionView.js
│           ├── unitDetailView.js
│           ├── contractsView.js
│           ├── boardroomView.js
│           ├── achievementsView.js
│           └── production/
│               ├── facilityCard.js
│               ├── ratesCalculator.js
│               └── sectorBar.js
└── nginx/
    └── default.conf.template

🎨 Asset Generation & Custom Visuals

  • Refer to 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 facility dossiers without modifying any code.
  • Refer to PRODUCT_GENERATOR_GUIDE.md when generating new products, supply chain DAG tiers, or entire industry sectors.