Data-Driven Content

JSON guests, Resources, roster, SpriteFrames paths, tradeoffs for jam size.

stablegodotarchitecturegdscript
On this page
Bar room where schedule stations BAR and RESTAURANT live
Stations are scene markers; which guest goes there and what they say comes from JSON.

What we implemented

Each NPC is one JSON file under resources/guests/. A roster lists who can spawn:

{
  "spawn_cooldown_seconds": 8,
  "default_spawn_position": [378, 605],
  "guests": ["beth", "kane", "..."]
}

GuestLoader parses JSON into GuestData / GuestSchedule / GuestDialog resources at runtime (FileAccess + JSON.parse_string).

Why JSON (for this project)

  • Writers can edit dialog without the Godot inspector.
  • Adding an NPC is “new file + roster entry + art paths”.
  • Diff-friendly in git.

Tradeoffs

ApproachProsCons
JSON → ResourcesEasy edits, no .tres sprawlParser code; path typos fail at runtime
Pure .tres in inspectorNative, typedPainful for long dialog
@export arrays on scenesFast prototypeDoes not scale to 10 NPCs

Recommendation at jam size: JSON (or a spreadsheet export) for dialog/schedules; keep engine wiring in a single guest scene. We already deleted the per-guest .tres dialog chain.

Resources still useful

SpriteFrames stays a .tres (animation editor). JSON only stores the path string.

Typed data after parse

Loader turns station name strings into Station.Id via Station.Id.has(name). Invalid names should error loudly — silent wrong stations waste playtest time.

What not to data-drive yet

Navmesh polygons, camera Room rects, and wall generation stayed in hotel_layout.gd as measured rectangles — content that is inherently spatial/code-owned.