Living Tool
Browse the docs
Docs/Reference

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.

v0.1.27 · updated 16 Oct 2026 · 7 min read

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.

IdsWhatHow the game loads them
0–323the overworld, a 36 × 18 brick-pattern grid that wraps at the edgesthe chunk under the Knight and its neighbours
324–523interiors and dungeons, often several rooms eachin aligned groups of four (id & ~3), no neighbours
1328–2499new areas a project adds past the end of the disclike 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.

The overworld in 3D: the 324 grid chunks in their brick pattern, with Borders on.
The overworld in 3D: the 324 grid chunks in their brick pattern, with Borders on.

Layout

OffsetSizeContents
0x000004groupCount (1–77 in retail)
0x0000416 per groupmesh offset, vertex pool offset, culling centre (3 × s16), pad
after the header8 per vertexthe shared vertex pool {s16 x, y, z, pad}, chunk-local, Y down
each mesh offsetvaries8 polygon lists: F3, FT3, F4, FT4, G3, GT3, G4, GT4
0x2A8000x200layer A row offsets
0x2AA00up to 0x2E00layer A data: walk heights
0x2D8000x200layer B row offsets, indexed 127 − z
0x2DA00up to 0x600layer B data: zones
0x2E000up to 0x10800the 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.

The interiors view: the 200 interior chunks in the groups of four the game loads together, with chunk 342's page and budgets.
The interiors view: the 200 interior chunks in the groups of four the game loads together, with chunk 342's page and budgets.

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 ALayer B
Holdsa walk height per cell: s16, Y down, 0 or belowa zone id per cell: u8
Encodingtoken n > 0: n + 1 cells of the next token's height; token ≤ 0: one cell of that heightpairs {run − 1, zone}, rows last to first
Room0x2E00 bytes0x600 bytes
The game uses it forwalking: a step of 0x20 or less is allowed, more than 0x60 is a wall to slide along, −1 blocksthe 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.

The world editor's top view of chunk 39, with the walk-height overlay over the mesh.
The world editor's top view of chunk 39, with the walk-height overlay over the mesh.

Budgets and the round trip

BudgetCap
Geometry: header, pool and polygon lists0x2A800 bytes (chunk 173 uses 99.9%)
Texture page0x10800 bytes
Vertices65,536
Draw groups256
Layer A / layer B data0x2E00 / 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:

OffsetTypeMeaning
+0s16 × 2x, z: fires when the Knight is within 0x20
+4s16facing on arrival, 0–7
+6u16destination chunk
+8s16 × 2arrival x, z
+12u16flags: door sound, return point, area music
+14u8NPC 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.

Size32 × 32 tiles of 128 units (4 × 4 walk cells), row-major from the south-west
Tilematerial 0–7, level −1 to 7 (64 units each), ramp 0, or 1–4 to rise north, east, south or west
Texturesshared page 0x08, which every new area loads, so no page room is used
Walk heightsfollow 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.