zone - themeldingwars/Documentation GitHub Wiki
The zone files contain all the necessary zone/region/map information
A Zone in Firefall is the map you play in, eg New Eden, Devils Tusk. The Zone file contains layers for the whole area and links to the gtchunks for the terrain and finer more localized data.
To get the list of chunks for a zone, look under the ChunkRefParent
for the ChunkZoneRange
and get the CubeFaceId
from it.
Then get all the ChunkRef
or ChunkRef2
nodes and get the X
and Y
values from them.
The name can be made from this data like this. {CubeFaceId}_{X}_{Y}.gtchunk
, the X
and Y
are per ChunkRef
or ChunkRef2
.
The chunk files are found in a sub folder called chunks
in the same folder as the zone files.
The list of chunks can also be retrieved from the SDB in the dbzonemetadata::ZoneChunkLinker
table.
The game client appears to use both the data from the zone file and the data from the SDB to setup the game world. There must be at least 1 zone chunk linker record present for the given zone id and the game will use that chunk as a base. This means that the linked chunk has to be present in the zone file and that other chunks must be adjacent to it. E.g., if the SDB references 5_0444_1746, the zone file must reference 5_0444_1746 and could also reference 5_0445_1746, 5_0446_1746 and so on.
The size of a chunk is 512x512.
Each zone has an origin of [0, 0, 0].
However, exactly which chunk to place at this point is somewhat uncertain - for all maps except Coral Forest and Sertao, simply finding the center point of the chunk range x and y coordinates independently seem to do the job.
To calculate the coordinates of a specific chunk, determine the chunks index within the chunk zone range using its chunk coordinates, and then determine the relative offset to the index of the chunk placed in the center.
The console command Loc
gives you the in-game position in World-Position. In QA-Position, the two first numbers are the chunk X and Y coordinates, followed by the X,Y,Z position within the chunk, giving X and Y in the range 0.0 to 1.0.
The format of the Zone file is made up of a header and then a series of layers(or called nodes) that can have sub layers.
uint Magic;
int Version;
ulong Timestamp;
string Name;
RootLayer Root;
ulong NodeMarker;
int NodeId;
int Length;
byte[] NodeData;
Layer[] SubLayers;
A layer starts with a marker of 0x12ED5A12ED5B12ED
following that is an int
for the node type id and another int
for the length of the layer.
Inside the layer can be layer data and sub layers.
The layer data comes before the sub layers, and can be found if you scan from the offset of the Length
item in the current layer to the next layer marker, or the end of the layer data.
The GtChunks use the same layer format but with different ids.
Whilst there are no known node id overlaps in the zones, there are such cases in gtchunks. Hence the type of layer represented by a node id may need to take the parent layer node id into account.
Name | ID | Description |
---|---|---|
ZONE |
0x30000 (196608) |
Root layer |
ZONE_SKYBOX |
0x20000 (196608) |
Skybox Record |
ZONE_DEFAULT_ENVIRONMENT |
0x20100 (131328) |
Default Environment |
ZONE_CHUNK_INFO |
0x20400 (132096) |
Parent layer for the chunk references |
CHUNK_INFO_REF |
0x10100 (65792) |
A reference to a gtchunk |
CHUNK_INFO_REF2 |
0x10101 (65793) |
A reference to a gtchunk |
CHUNK_INFO_RANGE |
0x10000 (65536) |
References the zones cube face record used in the chunks names |
- Reader has been implemented in FauFau: Zone.cs