scZone - themeldingwars/Documentation GitHub Wiki

.scZone files are self-contained zones. They hold the props and the environment of a 3D scene in the UI, the client calls that system Sinvironment. Unlike a zone they don't reference any gtChunk files, everything the scene needs is in the file.

They live in the asset database, system/assetdb/<bucket>/<assetId>.scZone. 1962 ships three of them: 00198546, 00244380 and 00322763.

The client reads them in FUN_01589460 (build 1962). Its errors start with Failed to load self-contained zone file '%s', e.g. Unknown layer id=%i, size=%u. or Unsupported version (expected %u, actual %u).

Implementations

  • FauFau reads it, all three 1962 files included. It reads all three 1962 files.

Format

Little endian.

Field Type Notes
magic char[4] SCZN
version uint32 1, the client rejects anything else
layers Layer[] Marked layers up to the end of the file

The layers are the ones described on the zone page, with the 0x12ED5A12ED5B12ED marker. The client fails the whole file on a layer id it doesn't know.

Layers

Id Contents
0x100 Header, the client skips it
0x200 Scene settings, followed by the environment layers in the same layer
0x201 Scene settings on their own, optionally followed by a reference id
0x202 Environment, its children are the environment layers
0x300 Props, compressed
0x400 Contexts

All three 1962 files use 0x201 and 0x202, 0x200 isn't used by any of them. Only 00322763 has contexts.

Scene settings

The data of 0x200 and 0x201 starts with:

Field Type Notes
unknown1 uint8 2 in all three files
unknown2 uint32 Read as a bool, 1 in all three files
unknown3 uint32 0 in all three files
orientation float[4] Always a unit quaternion in the files we have
direction float[3] Always a unit vector in the files we have

Note that the names of orientation and direction come from their values, not from the client.

In 0x200, marked environment layers follow up to the end of the layer. In 0x201, a uint32 reference id may follow, when the layer is long enough for it. The 1962 files end after the direction, so none of them has one.

Props

Field Type Notes
decodedSize int32 Size of the props once decompressed
data byte[] zlib stream, the rest of the layer

The decompressed data is a list of marked prop layers like the ones in the chunks and the ZONE_PROP layer of a zone, e.g. 0x50000 doodads, 0x50011 lights and 0x50017 monsters (names from the 010 template). The 1962 files have 76 to 90 of them.

Contexts

Field Type Notes
count int32
contexts String[count] int32 length including the null terminator, then the characters and that terminator

The contexts are groups of props the UI can show and hide, 00322763 has Character01 to Character05.

Open questions

  • What the header layer 0x100 holds. The client doesn't read it.
  • The three unknown fields of the scene settings and what the reference id points to.
⚠️ **GitHub.com Fallback** ⚠️