Network Subfiles

From SC4D Encyclopaedia
Jump to navigation Jump to search

This page pertains to the format of the Network Subfiles within the Savegame files. These files have Type IDs 6A0F82B2 (Network Index), C9C05C6E (Network Subfile 1) and CA16374F (Network Subfile 2). They can be viewed using the SC4 Savegame Explorer, but not edited. These subfiles were decoded by RippleJet.

Network Index Subfile (6A0F82B2)

Description

This index file contains a list of all network tiles, with links to the two network files where the records can be found.

Network Index Subfile Structure

Network Index Subfile Body

DWORD	Subfile Size in bytes
DWORD	CRC
DWORD	Memory address
WORD	Major Version  (0x0007 for built cities, but 0x0003 for Maxis' own, unbuilt cities)
DWORD	City Tile Count  (4096, 16384 or 65536 depending on city size)
DWORD	Count of Network Tiles  (0 for a new city)
   DWORD	Tile Number  (See Appendix 1.1 for more information)
   DWORD	Link: Memory address
   DWORD	Link: Subfile Type ID
   DWORD	Count of blocks  (either 0 or 10)
      DWORD	Block Number (first one is 0, last one is 9)
      DWORD	Count  (anything between 0-16. Number of byte blocks)
         BYTE×8   	Unknown block of bytes. Small numbers < 10
   BYTE	Unknown  (always 0x00)
   DWORD	Unknown  (always 0x00000000)
   DWORD	Unknown  (Seen 0 and 2)
   DWORD	Unknown  (Only seen 2)
   DWORD	Unknown  (Seen 0 and 4)
   FLOAT32	Unknown  (Small values, e.g. 0.0, 2.0, 5.0, 6.0, 8.0)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   FLOAT32	Unknown  (Small values, e.g. 0.0, 2.0, 5.0, 6.0, 8.0)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   FLOAT32	Unknown  (Small values, e.g. 0.0, 2.0, 5.0, 6.0, 8.0)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   FLOAT32	Unknown  (Small values, e.g. 0.0, 2.0, 5.0, 6.0, 8.0)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (0 or 1)
   WORD	Unknown  (always 0)
   DWORD	Count of blocks to follow
       DWORD    Block number
       BYTEx4   4 Unknown bytes (perhaps a float? Values don't make sense though).
       WORD     Unknown (only seen 0x00)
DWORD	Count of blocks  (0 for a new city)
   DWORD	Link: Memory address
   DWORD	Link: Subfile Type ID
   BYTE	Unknown  (only seen 0x00)
   DWORD	Unknown  (only seen 0x00000000)
   DWORD	Unknown  (Either 0, 1, 2 or 3)
   BOOLEAN	Unknown  (Either 0 or 1, false or true)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   DWORD	Unknown  (Either 0, 1, 2 or 3)
   BOOLEAN	Unknown  (Either 0 or 1, false or true)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   DWORD	Unknown  (Either 0, 1, 2 or 3)
   BOOLEAN	Unknown  (Either 0 or 1, false or true)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   DWORD	Unknown  (Either 0, 1, 2 or 3)
   BOOLEAN	Unknown  (Either 0 or 1, false or true)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
   FLOAT32	Unknown  (small value)
DWORD	Unknown  (only seen 0x00000000)
DWORD	Unknown  (only seen 0x00000000)
DWORD	Unknown  (only seen 0x00000000)
DWORD	Tile X  (63, 127 or 255 for a new city, smaller for built up cities)
DWORD	Tile Z  (63, 127 or 255 for a new city, smaller for built up cities)
FLOAT32	Unknown  (Small value. 0.00 for a new city)
BOOLEAN	Unknown  (always 1, true)
FLOAT32	Unknown  (Small value. 0.00 for a new city)
BOOLEAN	Unknown  (always 1, true)
DWORD	Unknown  (Does not appear if version = 0x0003. Always 0x00000000 if version = 0x0007)

Appendix 1.1

Tile numbering starts in the NW corner, which is tile number 0x00000000.

  • Tile number 0x00000001 is to the east of that tile.
  • In a small city, the first tile in the second row is 0x00000040.
  • In a medium city, the first tile in the second row is 0x00000080.
  • In a large city, the first tile in the second row is 0x00000100.
  • In a small city, the last tile in the last row is 0x00000FFF.
  • In a medium city, the last tile in the last row is 0x00003FFF.
  • In a large city, the last tile in the last row is 0x0000FFFF.


Network Subfile 1 (C9C05C6E)

Structure

Network Subfile 1 Body

DWORD	Record Size
DWORD	CRC
DWORD	Memory
WORD	Version Major  (0x0002)
WORD	Version Minor  (0x0003)
WORD	Zot Bytes  (Always 0x0000)
BYTE	0x00
BYTE	Appearance Flag  (Always 0x05)  (See Appendix 2.2 for more information)
DWORD	0xC772BF98  (always the same)
BYTE	Min Tract X Coordinate  (normally between 0x40 and 0x7F)
BYTE	Min Tract Z Coordinate  (normally between 0x40 and 0x7F)
BYTE	Max Tract X Coordinate  (normally between 0x40 and 0x7F)
BYTE	Max Tract Z Coordinate  (normally between 0x40 and 0x7F)
WORD	X Tract Size (power of 2)  (only seen 0x0002 ... 2² = 4 tiles)
WORD	Z Tract Size (power of 2)  (only seen 0x0002 ... 2² = 4 tiles)
DWORD	Count of Properties
    SGPROP    	SaveGame Properties, repeated Count times  (See Appendix 2.1 for more information)
DWORD	Group ID  (always 0x00000000)
DWORD	Type ID  (always 0x00000000)
DWORD	Instance ID  (always 0x00000000)
BYTE	Unknown Flag (0 or 1)
FLOAT32	X Coordinate
FLOAT32	Y Coordinate
FLOAT32	Z Coordinate

    # Next follows 4 times a data structure that contains information for
    # drawing a texture.
    3 x FLOAT32  (x, y, z) coordinates of the vertex
    2 x FLOAT32  (u, v) coordinates for texture mapping
    4 x BYTE     (r, g, b, a) values indicating a color (always #dedbddff).

DWORD	TextureID / PathID
BYTES×5	Unknown  (Small values)
BYTE	Orientation  (See Appendix 2.3 for more information)
BYTES×3	Unknown  (Small values)
BYTE	Network Type  (See Appendix 2.4 for more information)
BYTE	Connection, West  (See Appendix 2.5 for more information)
BYTE	Connection, North  (See Appendix 2.5 for more information)
BYTE	Connection, East  (See Appendix 2.5 for more information)
BYTE	Connection, South  (See Appendix 2.5 for more information)
BYTE    Flag for crossings (seen 0x01 for rail/road crossing, 0x06 as well)
    BYTE    Unknown
    BYTE    Unknown
    BYTE    Unknown
    BYTE    Unknown
    BYTE    Unknown (seen 0x02 and about 100 more bytes to follow for roads with retaining walls))
BYTES×3	Unknown  (Small values)
FLOAT32	Xmin
FLOAT32	Xmax
FLOAT32	Ymin
FLOAT32	Ymax
FLOAT32	Zmin
FLOAT32	Zmax
BYTE	Unknown  (1 or 2)
BYTE	Unknown  (Always 160)
BYTE	Unknown  (Always 0)
BYTE	Unknown  (Often 22)
DWORD×4	Unknown  (All 0)
DWORD	Unknown  (Always 2)
DWORD	Unknown  (0x00000000)

Appendix 2.1 - Structure of SGPROP (SaveGame Properties)

DWORD   Property Name Value
DWORD	Property Name Value  (doubled for some unknown reason)
DWORD	0x00000000
BYTE	Data Type, 01=UInt8, 02=UInt16, 03=UInt32, 07=SInt32, 08=SInt64, 09=Float32, 0B=Boolean
BYTE	KeyType, 0x00 = 0 reps, 0x80 = more than 0 reps
WORD	0x0000
DWORD	Rep Count  (this one appears only if KeyType = 0x80)
    DATA	Property Value (repeated Rep Count times, type according to Data Type)

Appendix 2.2 - Apperance Flag (offset 0x0013)

    0x01 (00000001b) - Network that appears in the game (if this is off, the network has been deleted)
    0x02 (00000010b) - ? (unused)
    0x04 (00000100b) - ? (always on)
    0x08 (00001000b) - ? (unused)
    0x40 (01000000b) - The network is burnt
    0x80 (10000000b) - ? (unused)

Appendix 2.3 - Orientation

    0x00 = North
    0x01 = East
    0x02 = South
    0x03 = West
    0x80 = North, mirrored
    0x81 = East, mirrored
    0x82 = South, mirrored
    0x83 = West, mirrored

Appendix 2.4 - Network Type

    0x00 = ?
    0x01 = ?
    0x02 = ?
    0x03 = ?
    0x04 = ?
    0x05 = ?
    0x06 = ?
    0x07 = ?

Appendix 2.5 - Connections

??

Network Subfile 2 (CA16374F)

Network Subfile 2 Structure

Network Subfile 2 Body

DWORD	Record Size
DWORD	CRC
DWORD	Memory
WORD	Version Major  (0x0002)
WORD	Version Minor  (0x0003)
WORD	Version ?  (0x0008)
WORD	Version ?  (0x0004)
WORD	Zot Bytes  (Always 0x0000)
BYTE	0x00
BYTE	Appearance Flag  (Always 0x05)  (See Appendix 3.2 for more information)
DWORD	0xC772BF98  (always the same)
BYTE	Min Tract X Coordinate  (normally between 0x40 and 0x7F)
BYTE	Min Tract Z Coordinate  (normally between 0x40 and 0x7F)
BYTE	Max Tract X Coordinate  (normally between 0x40 and 0x7F)
BYTE	Max Tract Z Coordinate  (normally between 0x40 and 0x7F)
WORD	X Tract Size (power of 2)  (only seen 0x0002 ... 2² = 4 tiles)
WORD	Z Tract Size (power of 2)  (only seen 0x0002 ... 2² = 4 tiles)
DWORD	Count of Properties  (I've only seen 0x00000000)
    SGPROP    	SaveGame Properties, repeated Count times  (See Appendix 3.1 for more information)
DWORD	Group ID  (always 0x00000000)
DWORD	Type ID  (always 0x00000000)
DWORD	Instance ID  (always 0x00000000)
BYTE	Unknown  (Always 0x05)
FLOAT32	Unknown  (Normally 0, -1 or 1)
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 0, -1 or 1)
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 1)
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 0, -1 or 1)
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 0, -1 or 1)
FLOAT32	Xmax
FLOAT32	Ymax
FLOAT32	Zmax
FLOAT32	Xmin
FLOAT32	Ymin
FLOAT32	Zmin
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 0)
DWORD	Unknown  (Always 0xFF000000)
FLOAT32	X Coordinate
FLOAT32	Y Coordinate
FLOAT32	Z Coordinate
FLOAT32	Unknown  (Normally 0)
FLOAT32	Unknown  (Normally 1)
DWORD	Unknown  (Always 0xFF000000)
FLOAT32	X Coordinate
FLOAT32	Y Coordinate
FLOAT32	Z Coordinate
FLOAT32	Unknown  (Normally 1)
FLOAT32	Unknown  (Normally 1)
DWORD	Unknown  (Always 0xFF000000)
FLOAT32	X Coordinate
FLOAT32	Y Coordinate
FLOAT32	Z Coordinate
FLOAT32	Unknown  (Normally 1)
FLOAT32	Unknown  (Normally 0)
DWORD	Unknown  (Always 0xFF000000)
DWORD	TextureID / PathID
BYTES×5	Unknown  (Small values)
BYTE	Orientation  (See Appendix 3.3 for more information)
BYTES×3	Unknown  (Small values)
BYTE	Network Type  (See Appendix 3.4 for more information)
BYTE	Connection, West  (See Appendix 3.5 for more information)
BYTE	Connection, North  (See Appendix 3.5 for more information)
BYTE	Connection, East  (See Appendix 3.5 for more information)
BYTE	Connection, South  (See Appendix 3.5 for more information)
BYTES×4	Unknown  (Small values)
FLOAT32	Xmin
FLOAT32	Xmax
FLOAT32	Ymin
FLOAT32	Ymax
FLOAT32	Zmin
FLOAT32	Zmax
BYTE	Unknown  (Always 128)
BYTE	Unknown  (Always 32)
BYTE	Unknown  (Always 0)
BYTE	Unknown  (Seen 16-21)
DWORD×4	Unknown  (All 0)
DWORD	Unknown  (Always 50)
DWORD	Unknown  (0x00000000)
WORD	Unknown  (0x0000)
FLOAT32	Unknown  (Normally 1)
DWORD	Number of extra blocks  (0, 1, 2 or 3)

# Below follow 5 arrays defining the sides of the hole. If an array is empty, there is
# no texture to be rendered at that side (typically for straight sections). Order is
# west, north, east, south, bottom.
DWORD	Count  (Either 0 or 4)
   3 x FLOAT32  (x, y, z) coordinates of the vertex
   2 x FLOAT32  (u, v) coordinates for texture mapping (normally 0, 0.75 or 1)
   4 x BYTE     (r, g, b, a) values indicating a color (either #ffffffff or #ffffff80).
DWORD	Count  (Either 0 or 4)
   3 x FLOAT32  (x, y, z) coordinates of the vertex
   2 x FLOAT32  (u, v) coordinates for texture mapping (normally 0, 0.75 or 1)
   4 x BYTE     (r, g, b, a) values indicating a color (either #ffffffff or #ffffff80).
DWORD	Count  (Either 0 or 4)
   3 x FLOAT32  (x, y, z) coordinates of the vertex
   2 x FLOAT32  (u, v) coordinates for texture mapping (normally 0, 0.75 or 1)
   4 x BYTE     (r, g, b, a) values indicating a color (either #ffffffff or #ffffff80).
DWORD	Count  (Either 0 or 4)
   3 x FLOAT32  (x, y, z) coordinates of the vertex
   2 x FLOAT32  (u, v) coordinates for texture mapping (normally 0, 0.75 or 1)
   4 x BYTE     (r, g, b, a) values indicating a color (either #ffffffff or #ffffff80).
DWORD	Count  (Either 0 or 4)
   3 x FLOAT32  (x, y, z) coordinates of the vertex
   2 x FLOAT32  (u, v) coordinates for texture mapping (normally 0, 0.75 or 1)
   4 x BYTE     (r, g, b, a) values indicating a color (either #ffffffff or #ffffff80).

DWORD	Unknown  (Always 0x00000000)

# Next follow 16 floats, representing the values of the transformation matrix for the model
#  | a b c d |
#  | d e f g |
#  | h i j k |
#  | l m n o |
# d, g and k are the translation components and are set to the position *in the city*.
16 x FLOAT32

DWORD	X Tile
DWORD	Z Tile
BOOLEAN	Unknown  (Always 0)
BOOLEAN	Unknown  (Either 0 or 1, false or true)
BOOLEAN	Unknown  (Either 0 or 1, false or true)
FLOAT32	Y Coordinate
FLOAT32	Y Coordinate
FLOAT32	Y Coordinate
FLOAT32	Y Coordinate
FLOAT32	Y Coordinate
DWORD	0xCA16374F  (Subfile ID)
DWORD	0x00000000  (always the same)

Appendix 3.1 - Structure of SGPROP (SaveGame Properties)

DWORD   Property Name Value
DWORD	Property Name Value  (doubled for some unknown reason)
DWORD	0x00000000
BYTE	Data Type, 01=UInt8, 02=UInt16, 03=UInt32, 07=SInt32, 08=SInt64, 09=Float32, 0B=Boolean
BYTE	KeyType, 0x00 = 0 reps, 0x80 = more than 0 reps
WORD	0x0000
DWORD	Rep Count  (this one appears only if KeyType = 0x80)
    DATA	Property Value (repeated Rep Count times, type according to Data Type)

Appendix 3.2 - Apperance Flag (offset 0x0017)

    0x01 (00000001b) - Network that appears in the game (if this is off, the network has been deleted)
    0x02 (00000010b) - ? (unused)
    0x04 (00000100b) - ? (always on)
    0x08 (00001000b) - ? (unused)
    0x40 (01000000b) - The network is burnt
    0x80 (10000000b) - ? (unused)

Appendix 3.3 - Orientation

    0x00 = North
    0x01 = East
    0x02 = South
    0x03 = West
    0x80 = North, mirrored
    0x81 = East, mirrored
    0x82 = south, mirrored
    0x83 = West, mirrored

Appendix 3.4 - Network Type

    0x00 = ?
    0x01 = ?
    0x02 = ?
    0x03 = ?
    0x04 = ?
    0x05 = ?
    0x06 = ?
    0x07 = ?

Appendix 3.5 - Connections

??