Chunk format
How Guardian's Crusade stores its world as 524 fixed-size chunks of geometry, texture, walk heights and zones, what lives in the NPC packs instead, and how Living Tool rewrites chunks and adds new ones.
What a chunk is
Every field map in the game, from the overworld to towns, interiors and dungeons, is a world chunk: a fixed-size block in one raw sector run. The world archive starts at LBA 20011, and chunk n sits at 20011 + n·125. Each chunk is 0x3E800 bytes (125 sectors) with no header, index or name.
| Ids | What | How the game loads them |
|---|---|---|
0–323 | the overworld, a 36 × 18 brick-pattern grid that wraps at the edges | the chunk under the Knight and its neighbours |
324–523 | interiors and dungeons, often several rooms each | in aligned groups of four (id & ~3), no neighbours |
1328–2499 | new areas a project adds past the end of the disc | like interiors |
The game keeps four chunks resident, one per slot (id & 3), and the slot also decides where the chunk's texture page lands in VRAM. On the overworld, chunk n is at grid x = n % 36, y = (n / 36)·2 + (n & 1), and spans ±2048 units around (2048·x, −4096·y). Seventeen ids are duplicate ocean chunks.

Layout
| Offset | Size | Contents |
|---|---|---|
0x00000 | 4 | groupCount (1–77 in retail) |
0x00004 | 16 per group | mesh offset, vertex pool offset, culling centre (3 × s16), pad |
| after the header | 8 per vertex | the shared vertex pool {s16 x, y, z, pad}, chunk-local, Y down |
| each mesh offset | varies | 8 polygon lists: F3, FT3, F4, FT4, G3, GT3, G4, GT4 |
0x2A800 | 0x200 | layer A row offsets |
0x2AA00 | up to 0x2E00 | layer A data: walk heights |
0x2D800 | 0x200 | layer B row offsets, indexed 127 − z |
0x2DA00 | up to 0x600 | layer B data: zones |
0x2E000 | up to 0x10800 | the texture page, a 4bpp TIM |
The body, everything before 0x2E000, is copied to the slot's RAM. The mesh is baked, with colours in the vertices and no lighting; a group's centre is only used for culling. Each polygon list is a count and fixed-size records of 3 to 10 words: colours, UVs, palette, texture page and vertex indices.
The texture page is 64 × 256 or 64 × 512 halfwords in the slot's VRAM column (x = 640 + slot·64), with 16 or 32 palettes at (32 + slot·32, 480). Chunks also sample two shared pages the archive doesn't hold, the field atlas sys/7 and a region set fe/n, and interiors may sample a sibling's page.

Walk heights and zones
Collision is not the mesh. Both layers are 128 × 128 grids of 32-unit cells, cell = (coord + 0x800) >> 5, run-length encoded row by row.
| Layer A | Layer B | |
|---|---|---|
| Holds | a walk height per cell: s16, Y down, 0 or below | a zone id per cell: u8 |
| Encoding | token n > 0: n + 1 cells of the next token's height; token ≤ 0: one cell of that height | pairs {run − 1, zone}, rows last to first |
| Room | 0x2E00 bytes | 0x600 bytes |
| The game uses it for | walking: a step of 0x20 or less is allowed, more than 0x60 is a wall to slide along, −1 blocks | the encounter zone, battle arena and area music, through the map table in sys/9 |
A single cell of positive height can't be encoded, so the editor writes it as 0 and tells you. Heights don't interpolate, so ramps are staircases.

Budgets and the round trip
| Budget | Cap |
|---|---|
| Geometry: header, pool and polygon lists | 0x2A800 bytes (chunk 173 uses 99.9%) |
| Texture page | 0x10800 bytes |
| Vertices | 65,536 |
| Draw groups | 256 |
| Layer A / layer B data | 0x2E00 / 0x600 bytes |
Living Tool's chunk codec parses a chunk into its groups, pool, layers and page, and writes it back the way Tamsoft's level tool did: header, pool, then each group's lists with no gaps, and a layer row reusing the previous row's data only when the two are identical. All 524 retail chunks come back byte for byte, and so does an OBJ export imported unchanged.
An edit is laid over the retail bytes, so the stale tails the original tool left stay put. A save that breaks a budget is refused with the cap it breaks, such as CHUNK_MESH_BUDGET. The project stores the edited chunk as a whole file, and undoing back to retail drops it.
Doors, actors and table 2
A chunk holds no actors, doors or triggers. They live in the NPC pack that serves it, which a 243-entry table in ovr/2 picks, with story-flag overrides. Actors are the pack's records homed on the chunk, each with a placement program that chooses its spot by story flags.
Doors are Tier-1 trigger records, grouped by chunk id in two tables in the pack: table 1 right after the actor records, and table 2 at D + pass1. A group is a ladder of rungs, each with a flag, and only the first rung whose flag is set is active. Records of type 8, 9 and 10 are 8 bytes long: set a flag, clear a flag, or wake an actor's script, which is how scenes start. A door is 16 bytes:
| Offset | Type | Meaning |
|---|---|---|
+0 | s16 × 2 | x, z: fires when the Knight is within 0x20 |
+4 | s16 | facing on arrival, 0–7 |
+6 | u16 | destination chunk |
+8 | s16 × 2 | arrival x, z |
+12 | u16 | flags: door sound, return point, area music |
+14 | u8 | NPC pack to load when the destination has no pack-table entry |
Table 1 can't move, so Living Tool writes added doors to table 2, which it emits again in the pack's relocation area with pass1 pointing at it (within 0x7FFF). Added records go at the end of every rung of their chunk, so they hold in every story state. Added actors follow the retail records, and table 1 moves up into the room table 2 left, which limits how many fit.
New areas and ground maps
The chunk loader has no upper bound: it reads chunk n at 20011 + n·125 for any id below 0x8000. The retail image ends at sector 185,985, so the first free id is 1328 (LBA 186,011), which also starts an aligned group of four. Living Tool takes ids up to 2499, the last group that fits a 74-minute disc, and writes each new area at its own LBA as fresh sectors with no file-table entry. On a project built on a base, new areas start after the base's own.
New areas load like interiors: no neighbours stream in, the region set is fe/0, and they have no pack-table entry, so the door into an area names the pack it runs on (byte +14). A blank new area is 8 × 8 untextured quads at y = −128, walk height −129 with a wall on the outer ring, and a full 512-row page with 32 palettes.
The ground painter keeps a ground map in the chunk's scene, <project>/scenes/chunk-NNN.json. Materials 0–7 are Plain, Grass, Forest floor, Dirt, Sand, Water, Rubble and Mossy stones.
| Size | 32 × 32 tiles of 128 units (4 × 4 walk cells), row-major from the south-west |
| Tile | material 0–7, level −1 to 7 (64 units each), ramp 0, or 1–4 to rise north, east, south or west |
| Textures | shared page 0x08, which every new area loads, so no page room is used |
| Walk heights | follow the surface; water blocks, and the outer ring stays a wall |
Placed buildings live in the same scene. Every save rebuilds the chunk from chunk-NNN.base: the ground first, then the placements, then the painted cells.