Skip to Content
The Alchemy Project

World, Scenes & Maps

One shared field engine runs everything outside battle and menus in Golden Sun: The Broken Seal.

Towns, houses, dungeons, the World Map, the Title Screen, the File Screen, and the Battle Arena all run on the same engine in field/. When Isaac walks through Vale or solves a puzzle in Mercury Lighthouse, the field engine handles movement, collision, camera, and input while querying the active scene overlay in scene/ for local people, dialogue cues, doorways, and cutscenes.

This page traces how the field engine boots a scene and answers requests between ticks, how scenes pair overlays with maps and areas, how actors run their own non-blocking scripts, and how height-based collision and the tilted World Map work.

Field engine and the request loop

In Vault, Isaac walks up to a villager and talks to him; the two turn to face each other, the villager speaks, and both resume walking
In Vault, Isaac walks up to a villager and talks to him; the two turn to face each other, the villager…

The field engine is a single function, fdEngineRun in field/field_engine_run.c. It boots a scene in a fixed dependency order: load the map and tilesets, choose encounter zones, clear the 64-actor table, query the scene overlay, spawn the party, NPCs, and chests, run scInit, and fade in. Once the scene is live, it enters a tight poll-and-dispatch loop:

Nothing interrupts a tick in progress. Pressing A during a tick only records a prioritised field request in FieldStateWork. Stepping onto a doorstep or crossing an encounter threshold sets a request immediately after sySynch(1) returns. Every interaction starts between ticks and can block for as long as it needs, whether it is one villager line or a multi-minute cutscene.

Starting a battle is one more exit from the field engine. fdEngineRun snapshots all actors into ActorSnapshotWork, requests ENGINE_BATTLE, and returns to gmMainRoutineRun.

Scenes, areas, overlays, and maps

The world divides into 201 scenes listed in ScenesWork (field/scenes.s). Each row binds four things independently: its overlay, its map, its area (71 areas total), and its flags (such as town versus dungeon). Because those pieces stay decoupled:

  • Two story phases of Vault can pair different overlays with the same map.
  • Five towns' Sanctums share one scene by branching on entrance ID.
  • Building interiors pack side by side onto a shared 128×128 rooms map, separated strictly by entrance camera bounds.

Areas govern the arrival banner, default music rules, and the 256-bit area temp flags (RPG Data & Rules).

Top-down cues, scripts, exits, and entrances

In Vault's mayor's house after Kalay, talking to the mayor once plays his welcome; talking again falls through to his warning about the thieves
In Vault's mayor's house after Kalay, talking to the mayor once plays his welcome; talking again falls…

Whenever Isaac talks, examines something, steps on a trigger tile, or casts field Psynergy, fdEngineRun scans the overlay's cue table from top to bottom and runs the first matching row. Each row binds a trigger (CUE_TALK, CUE_STEP, CUE_EXAMINE, PSYNERGY_ON_ACTOR, and so on), a target actor or metatile behaviour ID, a flag condition, and an action (a blocking C sc* cutscene script, a single message ID, or an exit).

Story progression needs no NPC state machines. Once a script sets its completion flag, earlier rows stop matching and later rows take over. Conditional exits work the same way, mapping a doorway to a (scene, entrance) destination based on story flags (for example, Sol Sanctum's exit leading to either pre-eruption or post-eruption Vale). Each entrance specifies arrival coordinates, facing, and camera bounds.

Actors, movement, and actor scripts

Isaac walks through Imil's snow, leaving footprints that are each short-lived actors fading out on their own timers
Isaac walks through Imil's snow, leaving footprints that are each short-lived actors fading out on their own…

Every independent moving or animated entity on the field is an actor in ActorsWork, up to 64 per scene. That includes Isaac, villagers, chests, snow footprints, Move's floating hand, Psynergy sparks, and the invisible camera target.

Each actor runs a non-blocking SC_* bytecode actor script stepped once per tick by fdActorUpdateAllOnField. This is separate from a blocking C scene script (sc*). Player control is itself an actor script. While the player has control, Isaac runs SC_PLAYER, which eases acceleration and braking, probes 8 pixels ahead and at angled offsets to slide past corners, and looks for talk targets within 32 px (beyond 11 px, the target must lie roughly in front). Taking control away for a cutscene swaps Isaac's actor script and restores SC_PLAYER when the cutscene ends.

Maps and height-based collision

Isaac walks behind the roof of a house in Vale using metatile actor-priority overrides
Isaac walks behind the roof of a house in Vale using metatile actor-priority overrides

A map is a 128×128 grid of 16×16-pixel metatiles drawn across three GBA background layers: ground, walls, and roofs. Hardware priority overrides interleave actors between those layers so Isaac walks behind house roofs purely from map data.

Each metatile combines three values: 2×2 tiles, a ground height shape, and a metatile behaviour ID (240+ for universal walls, ledges, ladders, and searchable jars; lower numbers for scene-specific cue triggers). Collision is primarily height-based. Isaac can step up at most 8 pixels and down at most 12 pixels, so cliffs and most walls work automatically without needing explicit wall flags.

Field Psynergy, random encounters, and the World Map

Isaac walks and runs on the World Map near Vale as the terrain tilts toward the horizon
Isaac walks and runs on the World Map near Vale as the terrain tilts toward the horizon
  • Field Psynergy: Casting Move, Frost, Reveal, or another field spell closes the menu, plays the cast animation, and checks the active scene's cue table in priority order. It tests the faced metatile first, then the nearest in-reach actor target, and finally any scene-wide row, playing harmlessly if nothing matches.
  • Random battles: Each walking tick adds distance travelled, weighted by the terrain's encounter rate, to a running counter that triggers a battle on overflow. Running reaches battles sooner in real time, after covering the same distance.
  • The World Map: The World Map is an ordinary scene on a 4× larger map streamed in compressed 512×512 chunks, keeping 4 chunks resident at a time. On every scanline, HBlank DMA (world_map_lines.c in IWRAM) stretches the GBA's affine background layer differently: lines near the bottom show a short strip of ground drawn large, while lines near the top show a long strip squeezed small. With all 160 scanlines stacked together, the flat map leans away toward the horizon. Because that perspective mode leaves no free background layer for UI boxes, opening dialogue or menus freezes the view onto a static still image layer first. Pressing R opens the flat map screen, which places each visited area's marker directly from its World Map coordinates with no separate dot table.

Code references