Wld file:

 

The WLD file goes in this order:

1) Header

2) Navigation Nodes

3) SceneNode

  3.1) Terrain

  3.2) Buildings

4) 194 structures of unknown

 

More detailed information on each part:

(note: when I say something’s at the 4th byte I mean go to the 4th byte then its what ever is after it. For example reading a long at the 4th byte would mean reading the bytes 5 to 8)

1)      Header

-         Header is 168 bytes long.

-         First long is the file size

-         Wxp filename starts at 45d

-         12th byte contains the number of footer structures (?)

-         4d,24d,28d,32d are important (cannot find block shape error if zeroed)

-         44th byte is important (crash with it zeroed.. although any other value seems ok)

-          

2)      Navagation node structure:

-     there’s probably some data that tells what type of node it is (if it’s a monorail node or not) and also probably some more data that will link to the next node in the track if it is a mono-rail node.

-         start off at the offset 168d and end at about 45584d

-         are 56 bytes long

-         always start with 0710 (4103d)

-         starting from the 4th byte they have their x,y,z coordinates with each component being a long (4 bytes)

-         the last 4 bytes (from the 52nd byte) contain the Name of the node

-         at the 16th byte there’s 3 shorts containing the node number, the next node number, and the previous node number

-         rest is junk (?)

 

3)      SceneNode structures:

-         the scene node contains all the buildings and terrain for a square section of the hardwar map. Each square section seems to be 4194304*4194304 units big

-         Start off at about offset 45584 to about 201872

-         Are 120 bytes long

-         Always start with 0310 (4099d)

-         4d seems to indicate what “row” the scenenode is on (x is the same for all nodes that have the same value here)

-         I’m guessing the 8d represents which row/column its on for y values (but is always set to 0.. as all the y vals are the same)

-         12d is the “column” the scene node is on (z is the same)

-         18d is linked in with the row and has a value of row*64, 22d with the yrow (always 0), and 26d with the z column given using column*64

-         28d = x,y,z cords

-         between 40d and 72d there’s 8 longs that contain small numbers that seem to count things although I have no idea what they are used for (they appear to be junk).

-         At the 72nd byte there’s 2 longs that contain the number of terrains and then the number of buildings meshes.

-         80-120 is junk (?)

 

3.1&3.2) Terrain & Buildings

- these contain offsets to meshes in the wxp file and then position and   rotation information

            - find the offset from the end of the parent SceneNodes offset

            - are 64 bytes long

            - Always start with 0610 (4102d)

            - at the 7th byte there’s 1 byte representing the x rotation

            - then there’s the name of the hanger backwards (4 bytes long)

            - then the x,y,z coordinates of the hanger (each 4 bytes long)

            - then 4 bytes containing the offset to the mesh in the wxp file

            -60th byte is always FFFF

            - at the 63rd byte there’s the y rotation

            - I suspect the bytes before the two rotations are just padding and don’t

            contain any useful information

4)      Footer Nodes

-         Start at 201872 and go to the end of the file

-         10 bytes long

-         Always start with 0410

-         2nd byte there’s a short that seems to be its id (starts at 0 and increases by 1 for each node up to 193)

-         no clue what they are for… if removed entirely from the file they don’t seem to affect it

 

Nav points (read as long small endian):

Name:

TUxx    Tunnel entry / exit nodes. xx is a decimal number. There are 24 of these. xx is from 00-23.

CRAx  Crater. x is the crater number. There are 10 craters (including Haven and Midway) thus x is 0-9.

TCxx    There are 13 of these. xx is either 00, 02, 04, 06, 08, 10, 12, 14, 15, 16, 17, 18, 30. TC may stand for Tunnel Code because there are 13 tunnels (excluding the one in Mines near Lazarus Mine – not sure how that is dealt with. Also not sure how the tunnel Highrise ßà Dowtown works, as beta5 and beta4 have the same WLD file. That tunnel must be hardcoded somehow).

TGTx   There are 6 of these, all grouped in a block of (56x6) bytes.x is a number from 1-6.