$npx -y skills add thedivergentai/GD-Agentic-Skills --skill godot-genre-simulationExpert 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
| 1 | ## Godot 4.7 Baseline |
| 2 | |
| 3 | - Expert patterns in this skill target **Godot 4.7+** (stable, 2026-06-18). |
| 4 | - Consult the [Godot 4.7 migration guide](https://docs.godotengine.org/en/4.7/tutorials/migrating/upgrading_to_godot_4.7.html) when upgrading projects from 4.6. |
| 5 | - **NEVER** assume 4.6 defaults (stretch mode, audio area_mask, RichTextLabel percent flags) without checking 4.7 migration notes. |
| 6 | |
| 7 | # Genre: Simulation / Tycoon |
| 8 | |
| 9 | Optimization, systems mastery, and satisfying feedback loops define management games. |
| 10 | |
| 11 | ## NEVER Do (Expert Anti-Patterns) |
| 12 | |
| 13 | ### Simulation & Economy |
| 14 | - NEVER use floating-point for primary currency; strictly use **Integer Cents** (or fixed-point math) to prevent accumulated precision errors in financial models. |
| 15 | - NEVER process 1000+ entities individually in `_process()`; strictly use a **Tick Manager** to batch updates or process entities in rotating pools. |
| 16 | - NEVER rely on linear cost scaling; strictly use **Exponential Growth** (`Base * pow(1.15, Level)`) to maintain challenge and strategic tension. |
| 17 | - NEVER hide critical metrics from the player; strictly provide **Detailed Breakdowns** (Income vs. Expense) so players can make optimization-based decisions. |
| 18 | - NEVER allow infinite resource stacking; strictly enforce **Logistical Caps** (warehouses/silos) to create meaningful space-management gameplay loops. |
| 19 | - NEVER let the early game become a "Waiting Simulator"; strictly **Front-Load Decisions** and quick early wins to build player momentum. |
| 20 | - NEVER modify a shared Resource directly; strictly use **`duplicate()`** to avoid unintentionally updating every building of that type. |
| 21 | - NEVER tie simulation logic to the visual framerate; strictly use **`_physics_process()`** or delta accumulators for deterministic simulation results. |
| 22 | |
| 23 | ### Performance & Threading |
| 24 | - NEVER update UI labels every frame; strictly use **Event-Driven Signals** to refresh UI ONLY when the underlying data changes. |
| 25 | - NEVER run heavy economic loops synchronously; strictly use **WorkerThreadPool** to offload complex calculations and prevent UI stutters. |
| 26 | - NEVER store massive resource data as Nodes; strictly use **`RefCounted`** or **Data Resources** to avoid the memory/CPU overhead of the SceneTree. |
| 27 | - NEVER ignore **`OS.low_processor_usage_mode`**; strictly enable it for stationary management screens to save massive CPU/Battery life. |
| 28 | - NEVER manipulate the SceneTree from background threads; strictly use **`call_deferred()`** for thread-safe UI updates. |
| 29 | - NEVER parse large JSON save files on the main thread; strictly use **Threaded Serialization** or optimized binary `.res` formats. |
| 30 | - NEVER use standard equality (==) for needs; strictly use **`is_equal_approx()`** to prevent floating-point jitter failures in logic gates. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## 🛠 Expert Components (scripts/) |
| 35 | |
| 36 | ### Original Expert Patterns |
| 37 | - [sim_tick_manager.gd](scripts/sim_tick_manager.gd) - Variable-speed tick system decoupling simulation from rendering. |
| 38 | - [tycoon_economy.gd](scripts/tycoon_economy.gd) - Multi-resource economic engine with integer-precision currency. |
| 39 | |
| 40 | ### Modular Components |
| 41 | - [simulation_patterns.gd](scripts/simulation_patterns.gd) - Reusable patterns: AStarGrid2D logistics and low-processor modes. |
| 42 | |
| 43 | --- |
| 44 | |
| 45 | ## Economy Design |
| 46 | |
| 47 | The heart of any tycoon game is its economy. Key principle: **multiple interconnected resources that force trade-offs**. |
| 48 | |
| 49 | ### Multi-Resource System |
| 50 | |
| 51 | ```gdscript |
| 52 | class_name TycoonEconomy |
| 53 | extends Node |
| 54 | |
| 55 | signal resource_changed(resource_type: String, amount: float) |
| 56 | signal went_bankrupt |
| 57 | |
| 58 | var resources: Dictionary = { |
| 59 | "money": 10000.0, |
| 60 | "reputation": 50.0, # 0-100 |
| 61 | "workers": 0, |
| 62 | "materials": 100.0, |
| 63 | "energy": 100.0 |
| 64 | } |
| 65 | |
| 66 | var resource_caps: Dictionary = { |
| 67 | "reputation": 100.0, |
| 68 | "workers": 50, |
| 69 | "energy": 1000.0 |
| 70 | } |
| 71 | |
| 72 | func modify_resource(type: String, amount: float) -> bool: |
| 73 | if amount < 0 and resources[type] + amount < 0: |
| 74 | if type == "money": |
| 75 | went_bankrupt.emit() |
| 76 | return false # Can't go negative |
| 77 | |
| 78 | resources[type] = clamp( |
| 79 | resources[type] + amount, |
| 80 | 0, |
| 81 | resource_caps.get(type, INF) |
| 82 | ) |
| 83 | resource_changed.emit(type, resources[type]) |
| 84 | return true |
| 85 | ``` |
| 86 | |
| 87 | ### Income/Expense Tracking |
| 88 | |
| 89 | ```gdscript |
| 90 | class_name FinancialTracker |
| 91 | extends Node |
| 92 | |
| 93 | var income_sources: Dictionary = {} # source_name: amount_per_tick |
| 94 | var expense_sources: Dictionary = {} |
| 95 | |
| 96 | signal financial_update(profit: float, income: float, expenses: float) |
| 97 | |
| 98 | func calculate_tick() -> float: |
| 99 | var total_income := 0.0 |
| 100 | var total_expenses := 0 |