1---2name: godot-genre-simulation3description: Expert blueprint for simulation and tycoon games (SimCity, RollerCoaster Tycoon, Factorio, Two Point Hospital) covering economy management, time progression, interconnected systems, NPC simulation, and feedback loops. Use when building management sims, tycoon games, city builders, or resource optimization games. Keywords tycoon, economy system, resource management, time scale, feedback loop, progression unlock, simulation tick.4---5
6## NEVER Do (Expert Anti-Patterns)
7
8### Simulation & Economy
9- NEVER use floating-point for primary currency; strictly use **Integer Cents** (or fixed-point math) to prevent accumulated precision errors in financial models.
10- NEVER process 1000+ entities individually in `_process()`; strictly use a **Tick Manager** to batch updates or process entities in rotating pools.
11- NEVER rely on linear cost scaling; strictly use **Exponential Growth** (`Base * pow(1.15, Level)`) to maintain challenge and strategic tension.
12- NEVER hide critical metrics from the player; strictly provide **Detailed Breakdowns** (Income vs. Expense) so players can make optimization-based decisions.
13- NEVER allow infinite resource stacking; strictly enforce **Logistical Caps** (warehouses/silos) to create meaningful space-management gameplay loops.
14- NEVER let the early game become a "Waiting Simulator"; strictly **Front-Load Decisions** and quick early wins to build player momentum.
15- NEVER modify a shared Resource directly; strictly use **`duplicate()`** to avoid unintentionally updating every building of that type.
16- NEVER tie simulation logic to the visual framerate; strictly use **`_physics_process()`** or delta accumulators for deterministic simulation results.
17
18### Performance & Threading
19- NEVER update UI labels every frame; strictly use **Event-Driven Signals** to refresh UI ONLY when the underlying data changes.
20- NEVER run heavy economic loops synchronously; strictly use **WorkerThreadPool** to offload complex calculations and prevent UI stutters.
21- NEVER store massive resource data as Nodes; strictly use **`RefCounted`** or **Data Resources** to avoid the memory/CPU overhead of the SceneTree.
22- NEVER ignore **`OS.low_processor_usage_mode`**; strictly enable it for stationary management screens to save massive CPU/Battery life.
23- NEVER manipulate the SceneTree from background threads; strictly use **`call_deferred()`** for thread-safe UI updates.
24- NEVER parse large JSON save files on the main thread; strictly use **Threaded Serialization** or optimized binary `.res` formats.
25- NEVER use standard equality (==) for needs; strictly use **`is_equal_approx()`** to prevent floating-point jitter failures in logic gates.
26
27---
28
29## 🛠 Expert Components (scripts/)
30
31> **MANDATORY reads** before implementing the matching system:
32> 1. [tycoon_economy.gd](scripts/tycoon_economy.gd) — integer cents / discrete stocks
33> 2. [sim_tick_manager.gd](scripts/sim_tick_manager.gd) — `_physics_process` tick accumulator
34> 3. [simulation_tick_controller.gd](scripts/simulation_tick_controller.gd) — speed / pause control surface
35
36### Original Expert Patterns
37- [tycoon_economy.gd](scripts/tycoon_economy.gd) - Multi-resource economy with **integer** currency (cents).
38- [sim_tick_manager.gd](scripts/sim_tick_manager.gd) - Framerate-decoupled game-hour ticks on physics.
39
40### Modular Components
41- [simulation_tick_controller.gd](scripts/simulation_tick_controller.gd) - UI/speed wiring for the tick manager.
42- [economy_graph_manager.gd](scripts/economy_graph_manager.gd) - Producer/consumer graph edges.
43- [npc_schedule_agent.gd](scripts/npc_schedule_agent.gd) - Schedule-driven NPC agents on ticks.
44- [simulation_patterns.gd](scripts/simulation_patterns.gd) - CSV→Resource bake, AStarGrid2D logistics, low_processor helpers.
45
46---
47
48## Core Loop
491. **Place/build** → 2. **Tick economy** → 3. **Read income vs expense** → 4. **Unlock / expand** → 5. **Optimize logistics**
50
51## Decision Trees
52
53### Currency & time (must match NEVER)
54| Need | Action |
55|------|--------|
56| Money / wallets | **MANDATORY** [tycoon_economy.gd](scripts/tycoon_economy.gd) — integer cents, never float primary |
57| Sim clock | **MANDATORY** [sim_tick_manager.gd](scripts/sim_tick_manager.gd) — accumulator on `_physics_process` |
58| Speed UI | [simulation_tick_controller.gd](scripts/simulation_tick_controller.gd) |
59
60### Tick rate vs UI vs threads
61| Entity / load | Strategy |
62|---------------|----------|
63| < ~200 entities | Tick signal → direct update; UI via `resource_changed` only |
64| Hundreds of agents | Rotate pools per tick; [npc_schedule_agent.gd](scripts/npc_schedule_agent.gd) |
65| Heavy graph / path logistics | Offload with WorkerThreadPool; `call_deferred` UI — see [simulation_patterns.gd](scripts/simulation_patterns.gd) / [economy_graph_manager.gd](scripts/economy_graph_manager.gd) |
66| Stationary management screens | Enable `OS.low_processor_usage_mode` |
67
68Do **not** re-inline TycoonEconomy / SimulationTime / Worker tutorials — load the scripts.
69
70## Skill Chain
71
72| Phase | Skills | Purpose |
73|-------|--------|---------|
74| 1. Data | `resources`, `godot-economy-system` | Stocks / sinks |
75| 2. Time | tick manager | Deterministic hours |
76| 3. Agents | schedules / nav | NPCs & logistics |
77| 4. Perf | WorkerThreadPool | Heavy ticks |
78| 5. Balance | `godot-monte-carlo-balancer` | Bankruptcy / growth bands |
79
80## Common Pitfalls
81
82| Pitfall | Solution |
83|---------|----------|
84| Float money | Integer cents in tycoon_economy |
85| `_process` sim step | Physics accumulator tick manager |
86| UI every frame | Signal on resource_changed only |
87
88## Deep recipes (on demand)
89
90| Topic | Reference / script |
91|-------|-------------------|
92| Economy & wallets | [economy-design.md](references/economy-design.md) + [tycoon_economy.gd](scripts/tycoon_economy.gd) |
93| Sim clock / speed | [time-system.md](references/time-system.md) + [sim_tick_manager.gd](scripts/sim_tick_manager.gd) |
94| Workers & facilities | [entity-management.md](references/entity-management.md) + [npc_schedule_agent.gd](scripts/npc_schedule_agent.gd) |
95| Demand & customers | [customer-demand.md](references/customer-demand.md) |
96| Feedback & dashboards | [feedback-systems.md](references/feedback-systems.md) |
97| Unlock progression | [progression-unlocks.md](references/progression-unlocks.md) |
98| Production graphs / CSV bake | [elite-technical-patterns.md](references/elite-technical-patterns.md) + [simulation_patterns.gd](scripts/simulation_patterns.gd) |
99
100## Reference
101
102> Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.
103
104### Official Documentation
105- [Idle and physics processing](https://docs.godotengine.org/en/stable/tutorials/scripting/idle_and_physics_processing.html) — Simulation clocks and economy ticks must accumulate with `delta` (or a dedicated tick), never frame-count assumptions.
106- [Using signals](https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html) — Emit resource/tick changes so dashboards refresh only when wallets or hours actually change.
107- [Resources](https://docs.godotengine.org/en/stable/tutorials/scripting/resources.html) — Recipes, facilities, and unlock tables belong as `.tres` Resources so designers retune chains without code edits.
108- [GDScript exports](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html) — `@export` build costs, wages, and growth bases so balance sheets stay Inspector-driven.
109- [Saving games](https://docs.godotengine.org/en/stable/tutorials/io/saving_games.html) — Persist stocks, day/hour, unlocks, and facility graphs so long management sessions survive restarts.
110- [Data paths](https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html) — Keep large binary/JSON sim saves under `user://` across platforms.
111- [Using multiple threads](https://docs.godotengine.org/en/stable/tutorials/performance/using_multiple_threads.html) — Heavy production-graph and upkeep passes belong on `WorkerThreadPool`, not the main-thread UI loop.
112- [Thread-safe APIs](https://docs.godotengine.org/en/stable/tutorials/performance/thread_safe_apis.html) — Marshaling sim results to Labels/`Tree` requires `call_deferred` / main-thread SceneTree rules.
113- [WorkerThreadPool](https://docs.godotengine.org/en/stable/classes/class_workerthreadpool.html) — API for batching economy ticks without blocking manager screens.
114- [OS](https://docs.godotengine.org/en/stable/classes/class_os.html) — Enable `OS.low_processor_usage_mode` on stationary management UIs to cut CPU/battery burn.
115- [AStarGrid2D](https://docs.godotengine.org/en/stable/classes/class_astargrid2d.html) — Grid logistics and worker paths on factory floors without manually wiring AStar points.
116- [Using NavigationServers](https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_using_navigationservers.html) — Direct `NavigationServer3D.map_get_path` queries for schedule-driven NPCs without per-agent node overhead.
117
118### Related Skills
119
120#### Prerequisites
121- [godot-project-foundations](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-project-foundations/SKILL.md) — Autoloads, Resources, and scene structure before building tick managers and economy graphs.
122- [godot-gdscript-mastery](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-gdscript-mastery/SKILL.md) — Typed Dictionaries, signals, `is_equal_approx`, and fixed-point-safe math for currency and needs.
123- [godot-resource-data-patterns](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-resource-data-patterns/SKILL.md) — Production recipes and unlock tables should be Resource-first `.tres` assets, not hard-coded Node trees.
124- [godot-signal-architecture](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-signal-architecture/SKILL.md) — Tick and `resource_changed` buses must drive UI without Labels mutating the simulation wallet.
125
126#### Complements
127- [godot-economy-system](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-economy-system/SKILL.md) — Soft-currency wallets, sinks, and transaction ledgers that compose with tycoon multi-resource stocks.
128- [godot-save-load-systems](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-save-load-systems/SKILL.md) — Versioned serialization for large world states, binary `store_var`, and threaded save/load.
129- [godot-navigation-pathfinding](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-navigation-pathfinding/SKILL.md) — NavigationServer / grid pathing for worker jobs and schedule agents after the tick clock exists.
130- [godot-performance-optimization](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-performance-optimization/SKILL.md) — Entity batching, low-processor mode, and thread offload budgets for 1000+ sim entities.
131- [godot-autoload-architecture](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-autoload-architecture/SKILL.md) — TimeManager / Economy autoloads that survive scene reloads need clear ownership rules.
132- [godot-ui-containers](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-ui-containers/SKILL.md) — Income/expense dashboards and facility lists are `Tree`/`VBoxContainer` layouts bound to throttled signals.
133
134#### Downstream / consumers
135- [godot-monte-carlo-balancer](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-monte-carlo-balancer/SKILL.md) — After cost curves, production yields, and CSV→`.tres` balance sheets exist, Monte Carlo career sims prove minutes-to-milestone and bankruptcy bands before shipping growth factors.
136- [godot-genre-idle-clicker](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-genre-idle-clicker/SKILL.md) — Offline catch-up and prestige loops reuse tick + integer-currency patterns from management sims.
137- [godot-genre-rts](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-genre-rts/SKILL.md) — Build-order economies and worker logistics consume the same tick/graph and pathfinding primitives at combat scale.
138
139#### Master
140- [godot-master](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-master/SKILL.md) — Library router and mirrored module entry; use when discovering peer skills or syncing shared script mirrors after Domain Skill edits.