Skip to content
Xsear edited this page Jun 2, 2024 · 8 revisions

A Zone in Firefall represents an area that you play in, eg New Eden, Devils Tusk.

The world data is defined in chunk files and the Zone file primarily contains additional data that apply for the whole area. It also references the chunks that should be loaded. Multiple zones can use the same chunks.

Zones files contain a timestamp that must match the server, or an error will be thrown and the client will not connect.

Getting the chunks

The chunks used for a zone can be retrieved either from the Zone file or from the SDB using the dbzonemetadata::ZoneChunkLinker table.

To get the list of chunks for a zone from the Zone file, 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 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.

Coordinates within a zone

The size of a chunk is 512x512. Each zone has an origin of [0, 0, 0]. In a zone with just 1 chunk, this means that chunk will span -256 to +255 on both axis.

However, when the zone has more than 1 chunk (e.g. most zones), exactly which chunk to place at the center point is a little uncertain.

For all maps except Coral Forest and Sertao, 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.

Format

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;

Layer Node Format

ulong   NodeMarker;
int     NodeType;
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 of course the types of nodes that appear differ between the files.

When determining how to parse the layer based on the node type, the parent node type should be taken into account, because within the gtchunks there appears to be cases of the node type ids overlapping.

Layer (node) Types

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_RANGE 0x10000 (65536) References the cubeface needed to find the chunks names
CHUNK_INFO_REF 0x10100 (65792) A reference to a gtchunk. Includes an SDB ChunkRecord Id.
CHUNK_INFO_REF2 0x10101 (65793) A reference to a gtchunk

010 Editor Template

Implementations

  • Reader has been implemented in FauFau: Zone.cs
Clone this wiki locally