All skills
thedivergentai avatar

/godot-game-loop-collection

@9d6e91e

Expert collection-loop systems for collectible IDs, scavenger hunts, completion archives, nearest-item compass UI, hidden spawners, and persistent find-all-X progress. Use when implementing collectibles, scavenger hunts, completion% archives, or compass-guided item hunts. Keywords: collectible_id, scavenger_hunt, collection_manager, collection_compass, completion_archive, hidden_item_spawner, find_all, collectible_item.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-game-loop-collection

This session only. Nothing lands on disk.

referencescollection-loop-advanced.md

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

Collection Loop Advanced (load on demand)

MANDATORY for threaded level loads, MainLoop extensions, and archive UI depth beyond collection_manager.gd.

Persistent progress (binary)

func save_progress(data: Dictionary) -> void:
	var file := FileAccess.open("user://save.dat", FileAccess.WRITE)
	file.store_var(data)

func load_progress() -> Dictionary:
	if not FileAccess.file_exists("user://save.dat"):
		return {}
	var file := FileAccess.open("user://save.dat", FileAccess.READ)
	return file.get_var()

Prefer ID sets via manager get_collected_ids() / restore_collected_ids() — not node paths.

Archive silhouettes

  • Uncollected: modulate = Color(0, 0, 0, 0.5)
  • Collected: modulate = Color.WHITE
  • UI mirrors manager signals — never authoritative

Threaded loading (WHY)

CAUTION: Synchronous load() on huge scenes stalls the main thread. Use ResourceLoader.load_threaded_request() + poll status; SceneTree changes only on main thread via call_deferred.

See collection_loop_patterns.gd.

General loop NEVER (collection-adjacent)

These apply when collection hunts span level transitions:

  • NEVER use free() on active state nodes — queue_free() only
  • NEVER load massive levels synchronously on collection complete
  • NEVER manipulate SceneTree from worker threads — call_deferred
  • NEVER use exact float == for time gates — is_equal_approx
  • NEVER poll discrete menu input in _process — _unhandled_input

Compass edge case

CAUTION: Compass logic must handle one remaining item — soft-locking the last pickup is a common regression. Test get_remaining_ids().size() == 1.

Hidden spawns

hidden_item_spawner.gd — Marker3D anchors + chance; fixed hunts skip this script.

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    No security risks or malicious patterns were identified in this skill. The repository contains safe, standard Godot engine source code and documentation for implementing game loops, collectible systems, and scavenger hunts.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    4/4 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-game-loop-collection