Difference between revisions of "Paths (GTA4)"

From GTAMods Wiki
Jump to navigation Jump to search
m (External Links)
(Section 2 - Links)
Line 88: Line 88:
  
 
* ''Structure unconfirmed and partially incomplete''
 
* ''Structure unconfirmed and partially incomplete''
* ''This section is incomplete''
+
 
 +
{{Incomplete}}
  
 
==Tools and Scripts==
 
==Tools and Scripts==

Revision as of 12:28, 31 January 2009

Paths in GTA IV are similar to the 64 node-files introduced with San Andreas. Like the first version of the format there are 64 node files where each file corresponds to a 750x750 square unit starting with nodes0.nod in the south-west corner (-3000.0, -3000.0) and ending in the north-east corner (3000.0, 3000.0) of the game's world in row-major order.

Preamble

Before you start understanding GTA IV's path format you should start reading San Andreas paths article. Since GTA IV paths are based on the old path version the article is good to understand path basics.

Unlike San Andreas paths are not stored in the major image file (gta3.img). Also nodefiles do not have the ending .dat anymore. In GTA IV paths are stored in the ~\pc\data\cdimages\paths.img file as 64 .nod files. Also the file format has been changed in general. If San Andreas had 7 sections per node file GTA IV just got 2. Linking works in a different way and there are no navi-nodes any longer.

This section is incomplete

File Format

The following data types and structures are used within this article:

  • INT8/UINT8 - signed/unsigned 8 bit integer (1 byte)
  • INT16/UINT16 - signed/unsigned 16 bit integer (2 byte)
  • INT32/UINT32 - signed/unsigned 32 bit integer (4 byte)
  • FLOAT - single precision floating point number (4 byte)

Header

The header is a structure of 4 values with a size of 16 bytes.

4b - UINT32  - Number of nodes (section 1)
4b - UINT32  - Number of car-nodes
4b - UINT32  - Number of intersection nodes
4b - UINT32  - Number of links (section 2)
  • This section is incomplete

Section 1 - Nodes

4b - UINT32 - MemAddress
4b - UINT32 - Zero (Allways)
2b - UINT16 - Area ID
2b - UINT16 - Node ID
4b - UINT32 - Unknown lane settings
2b - UINT16 - Allways 0x7FFE
2b - UINT16 - LinkID
6b - INT16[3] - Position (XYZ)
1b - BYTE  - Path Width
1b - BYTE  - Path Type
4b - UINT32 - Flags
Area ID
defines the area where the node lays in. Usually this is the same number as the one of the node file.
Node ID
defines the id of the node. This is important for linking the node to others. Using the node and area id nodes can be identified as unique. There cannot be 2 nodes with the same area and node id.
Link ID
points to an link in section 2. The link ID cannot point into another node file. It points to a link in the same node file. However this link is able to point to an node in another or the same area.
Position (X,Y,Z)
The world-coordinates of the node. To get the floating point X and Y coordinates divide the 16 bit integer by 8. For Z coords you have to divide by 128 (Unlike San Andreas).
Path Width
used to set the width of the paths. For cars this is related in how much space there is between 2 lanes. Divide the 8 bit unsigned integer by 8 to get the floating point value.
Path Type
descripes the type of an node. This is used to isolate certain nodes from others. For boats this is allways 0x01.
Flags
the flags are used to influence the behaviour of non-person-characters (NPC's), which are spawned along the paths on the nodes (See below).

Nodeflags

0-4: unknown

Flag 05: Emergency only
Flag 06: Boats
Flag 07: Unknown
Flag 08: Exactly the same as 05
Flag 09: Intersection central node
Flag 10: Is highway
Flag 11: Is not highway

12-15: Link count

Flag 16: Disable linking

17-23: unknown

Flag 24: Is ped node?
Flag 25: Rarely used, police controls or roadblocks?
Flag 26: unknown ped flag
Flag 27: Unknown ped flag

28-31: unknown
  • Structure unconfirmed and partially incomplete
  • This section is incomplete

Section 2 - Links

2b - UINT16  - Area ID
2b - UINT16  - Node ID
1b - UINT8   - Unknown
1b - UINT8   - Link length
2b - UINT16  - Flags
  • Structure unconfirmed and partially incomplete

This section is incomplete. You can help by fixing and expanding it.

Tools and Scripts

  • GTA Net GTAForums: PathViewer – a tool by Aschratt which allows to view paths and highlight nodes with special flags in 3D.

External Links