All skills
thedivergentai avatar

/godot-genre-simulation

@9d6e91e

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.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-genre-simulation

This session only. Nothing lands on disk.

referenceselite-technical-patterns.md

≈841 tokens on demand. Your agent reads this file only when SKILL.md points to it.

🚀 Elite Technical Implementations (Batch 09)

1. Dependency-Graph Pattern (Production Chains)

Represent complex production chains (e.g., Raw Materials -> Intermediate -> Finished Goods) using nested Resource structures. This allows for deep, recursive data definitions that are fully editable in the Inspector.

# production_recipe.gd
class_name ProductionRecipe extends Resource

---

# Mapping of required ItemResources to their integer quantities

@export var required_inputs: Dictionary[ItemResource, int] = {}
@export var output_item: ItemResource
@export var output_yield: int = 1
@export var production_time: float = 5.0

---

# Evaluates if the current inventory meets the graph dependencies

func can_produce(available_inventory: Dictionary[ItemResource, int]) -> bool:
    for input_item in required_inputs:
        var required_amount: int = required_inputs[input_item]
        var available_amount: int = available_inventory.get(input_item, 0)
        if available_amount < required_amount:
            return false
    return true

2. AStarGrid2D for Logistics & NPC Jobs

AStarGrid2D is specialized for 2D grids, eliminating the need to manually connect points. It is ideal for factory floors, warehouse logistics, and NPC pathfinding in management sims.

class_name LogisticsGrid extends Node

var _astar_grid: AStarGrid2D

func _ready() -> void:
    _astar_grid = AStarGrid2D.new()
    _astar_grid.region = Rect2i(0, 0, 100, 100)
    _astar_grid.cell_size = Vector2(32, 32)
    _astar_grid.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_ONLY_IF_NO_OBSTACLES
    _astar_grid.update()

---

# Mark a cell as impassable (e.g., placing a new machine)

func place_obstacle(cell_coords: Vector2i) -> void:
    if _astar_grid.is_in_bounds(cell_coords.x, cell_coords.y):
        _astar_grid.set_point_solid(cell_coords, true)

---

# Retrieves the logistics path for an NPC worker

func get_npc_path(start_cell: Vector2i, target_cell: Vector2i) -> Array[Vector2i]:
    return _astar_grid.get_id_path(start_cell, target_cell)

3. CSV-to-Resource Workflow (Rapid Balancing)

Automate the conversion of spreadsheet data (CSV) into native .tres files. This allows game designers to balance thousands of entities in Excel/Google Sheets and "bake" them into performant Godot resources.

@tool
class_name CSVResourceBaker extends EditorScript

func _run() -> void:
    var csv_path := "res://data/balancing_sheet.csv"
    var output_dir := "res://data/generated_items/"
    
    var file := FileAccess.open(csv_path, FileAccess.READ)
    if not file: return
        
    var rows := file.get_as_text().split("\n", false)
    for i in range(1, rows.size()): # Skip header
        var columns := rows[i].split(",", false)
        if columns.size() < 2: continue
            
        var item_name: String = columns[0].strip_edges()
        var base_value: int = columns[1].to_int()
        
        var new_item := ItemResource.new()
        new_item.item_name = item_name
        new_item.base_value = base_value
        
        ResourceSaver.save(new_item, output_dir + item_name.to_lower() + ".tres")

Source: SKILL.md on GitHub

1 warning17d4 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides a comprehensive set of blueprints and GDScript components for developing simulation and tycoon games in Godot 4.x. It focuses on best practices for deterministic simulation, performance optimization, and robust economy systems without any detected malicious patterns.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    3/3 files flagged

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-genre-simulation