ProductionGame/README.md

126 lines
6.4 KiB
Markdown

# PRODUCTION - The Idle Game
> **"Build the Ultimate Global Supply Chain Empire."**
**Production - The Idle Game** is an expansive, strategic incremental/idle web game inspired by *Capitalism*, *Factorio-lite*, and modern idle tycoon simulators. 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 an Nginx reverse-proxy frontend.
---
## 🌟 Key Features
* **Real Supply Chain Dependencies (DAG Pipeline):**
* Higher-tier industrial goods require and consume physical stockpiles of lower-tier commodities.
* Real-time bottleneck warnings when upstream inputs run short.
* 6 Interconnected Industry Sectors:
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.
5. **High-Tech & Electronics:** Silicon Microchips, PCB Motherboards, Consumer Smartphones.
6. **Heavy Industry & Vehicles:** Industrial Engines, Commercial Logistics Trucks.
* **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 reputation.
* **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).
* **Responsive Executive UI:**
* **Desktop Command Station:** 3-column workstation layout (Departments & Sectors sidebar, main Production Floor, and live Supply Chain Inspector with instant spot-market liquidation).
* **Mobile Optimization:** Ergonomic single-column interface with bottom navigation tabs and thumb-friendly controls.
* **Cloud & Offline Sync:**
* Plays instantly as a Guest with local persistence.
* Optional lightweight account system (username + password with anti-bot honeypot protection).
* Authoritative offline tick engine: when you return, your 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) │
└─────┬────────────┬─────┘
│ │
/ (Statiske aktiver) │ /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/)
### 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:8080`** (or the port defined in `.env`).
---
## 📁 Project Directory Structure
```
.
├── .env.example
├── docker-compose.yml
├── backend/
│ ├── Dockerfile
│ ├── requirements.txt
│ ├── auth.py # JWT authentication & password hashing
│ ├── database.py # SQLite connection and migration setup
│ ├── engine.py # Authoritative DAG simulation and offline calculations
│ ├── main.py # FastAPI endpoints
│ └── models.py # Pydantic schemas
├── frontend/
│ ├── index.html # Responsive executive layout
│ ├── css/
│ │ └── style.css # Modern corporate design system
│ └── js/
│ ├── app.js # Application orchestrator & game loop
│ ├── core/
│ │ ├── engine.js # Client-side DAG tick simulation
│ │ ├── formatters.js# Number notations (Standard K/M/B/T, Scientific)
│ │ ├── state.js # State manager, schema handling & IPO reset
│ │ └── sync.js # Backend synchronization & auth handling
│ ├── data/
│ │ ├── products.js # 24+ commodities across 6 sectors
│ │ ├── contracts.js # B2B procurement tenders
│ │ ├── boardroom.js # IPO perks and Venture Share logic
│ │ └── achievements.js
│ └── ui/
│ ├── productionView.js
│ ├── contractsView.js
│ ├── boardroomView.js
│ ├── inspectorView.js
│ └── achievementsView.js
└── nginx/
└── default.conf.template
```