Files
ai-game-2/.opencode/skills/kq4-room-creator/SKILL.md
2026-02-21 07:55:11 -08:00

5.1 KiB

name, description
name description
kq4-room-creator Create new King's Quest IV room scenes from the decompiled room specs. Handles template copying, visual image setup, transition wiring, and connecting to existing rooms.

KQ4 Room Creator

Overview

This skill automates the creation of new King's Quest IV rooms from the decompiled room specs.

When to Use

Use this skill when you need to create a new game room scene. The skill will:

  1. Copy the placeholder template
  2. Set up cardinal exits based on room spec
  3. Wire up connections to existing rooms
  4. Copy the visual image from decompile

How to Use

Step 1: Get Room Spec

First, read the room specification from:

kq4-sierra-decompile/rooms/kq4-XXX-room-name/kq4-XXX-room-name.md

Look for the "Exits" section to determine which directions connect to which room numbers.

Example from room 010:

- **Exits**: North→4, South→16, East→11, West→9

Step 2: Copy Template

cp -r scenes/kq4_placeholder_template scenes/kq4_XXX_room_name
mv scenes/kq4_XXX_room_name/kq4_placeholder_template.gd scenes/kq4_XXX_room_name/kq4_XXX_room_name.gd
mv scenes/kq4_XXX_room_name/kq4_placeholder_template.tscn scenes/kq4_XXX_room_name/kq4_XXX_room_name.tscn

Step 3: Copy Visual Image

cp kq4-sierra-decompile/rooms/kq4-XXX-room-name/pic_XXX_visual.png scenes/kq4_XXX_room_name/

Step 4: Create Import File

Reference the template import file, remember to use create_uid.py to create a uid

Step 5: Update .tscn File - Transition Pieces

When adding a transition piece to the CURRENT room that leads to a DESTINATION room:

  • Node name: The node name should match the destination room name (e.g., kq4_016_graveyard)
  • target: The SCENE UID of the destination room (from the destination's .tscn file)
  • appear_at_node: The NAME of the transition node in the DESTINATION room that leads BACK to the current room. This is almost always the name of the current room, as it it is saying which exit in the destination room to transition move the player to.
  • label: Human-readable name for the destination (e.g., "Graveyard")

Example - Adding a south exit from room 010 to room 016:

[node name="kq4_016_graveyard" parent="." instance=ExtResource("4_abc")]
position = Vector2(910, 542)
polygon = PackedVector2Array(-108, 454, -87, 649, 376, 658, 348, 381)
appear_at_node = "kq4_010_forest_path"  # Name of transition in ROOM 016 that goes back to 010
target = "uid://621uqunr9pm"               # Scene UID of room 016
label = "Graveyard"

[node name="entrance" parent="kq4_016_graveyard" index="0"]
position = Vector2(118, 514)

[node name="exit" parent="kq4_016_graveyard" index="1"]
position = Vector2(151, 615)

Then add the signal connection in the current room:

[connection signal="interacted" from="kq4_016_graveyard" to="." method="_on_graveyard_interacted"]

And add the handler in the current room's .gd file:

func _on_graveyard_interacted() -> void:
	$kq4_016_graveyard.default_script(self)

Step 6: Update .gd File

Remove template functions and add only handlers for connected rooms:

extends Scene


func _on_forest_path_interacted() -> void:
	$kq4_010_forest_path.default_script(self)

Step 7: Update the Destination Room

For each exit you add, you need to add a corresponding transition in the DESTINATION room that leads back to the current room.

Example - In room 016 (Graveyard), add north exit back to room 010:

[node name="kq4_010_forest_path" parent="." instance=ExtResource("4_abc")]
position = Vector2(910, -213)
polygon = PackedVector2Array(-108, 454, -87, 649, 376, 658, 348, 381)
appear_at_node = "kq4_010_forest_path"  # Name of THIS transition (room 016's exit to 010)
target = "uid://bxsxv6esxljit"             # Scene UID of room 010 (the room we're going TO)
label = "Forest Path"

[node name="entrance" parent="kq4_010_forest_path" index="0"]
position = Vector2(133, 643)

[node name="exit" parent="kq4_010_forest_path" index="1"]
position = Vector2(174, 519)

[connection signal="interacted" from="kq4_010_forest_path" to="." method="_on_forest_path_interacted"]

Then add the handler in room 016's .gd file:

func _on_forest_path_interacted() -> void:
	$kq4_010_forest_path.default_script(self)

Summary: target vs appear_at_node

Field Value Meaning
target Scene UID of destination room Which scene to load
appear_at_node Node name of exit in destination room Which transition in that scene should appear at

Room Number Mapping

Reference the spec for cardinal direction matches

Existing Rooms

Currently created rooms:

  • kq4_003_fountain_pool (room 003)
  • kq4_004_ogres_cottage (room 004)
  • kq4_010_forest_path (room 010)
  • kq4_011_enchanted_grove (room 011)
  • kq4_019_coastal_cliffs (room 019)
  • kq4_020_meadow (room 020)
  • kq4_025_beach_at_river_delta (room 025)

Key Files

  • Template: scenes/kq4_placeholder_template/
  • Room specs: kq4-sierra-decompile/rooms/kq4-XXX-room-name/
  • TransitionPiece: TransitionPiece.tscn
  • Base Scene class: Scene.gd