godot-procedural

Installation
SKILL.md

Procedural Generation (4.7)

Rules that save you later

  1. Seed everything. Use one RandomNumberGenerator per generator with an explicit seed (rng.seed = hash("my seed") for text seeds). Pass it down; never call global randf() inside generation. Show the seed in a debug overlay and save it with the game.
  2. Data first, nodes last. Generate into arrays (PackedInt32Array, Dictionary[Vector2i, int], PackedFloat32Array), validate, then write to TileMapLayer, GridMap or meshes in one pass.
  3. Validate and retry. Flood-fill or path-check (AStarGrid2D) that the start reaches the exit, enforce min/max room counts, then retry with seed + 1 on failure. Cap the retries.
  4. Threads build data; the main thread touches nodes. Use WorkerThreadPool.add_task() for noise and mesh arrays, then call_deferred to add nodes or set meshes. See godot-performance.
  5. Rebake navigation after the level exists (godot-navigation-ai).

Randomness API

  • RandomNumberGenerator: seed, state (save it to resume a sequence exactly), randi_range, randf_range, randfn(mean, deviation) (gaussian), rand_weighted(PackedFloat32Array) → index (weighted tables).
  • Shuffle reproducibly: Fisher–Yates with your rng. Array.shuffle() and pick_random() use the global generator.
  • Per-cell randomness without stored state: hash the coordinates, e.g. hash(Vector3i(x, y, world_seed)), which is stable across runs and machines.
Installs
10
GitHub Stars
54
First Seen
8 days ago