Difference between revisions of "Paths (GTA4)"

From GTAMods Wiki
Jump to navigation Jump to search
m (Header)
 
(22 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{file-stub}}
+
{{File-stub}}
 
 
 
Paths in [[GTA_4|GTA IV]] are similar to the 64 node-files introduced with [[GTA_SA|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 <code>nodes0.nod</code> 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 [[Wikipedia:row-major order|row-major order]].
 
Paths in [[GTA_4|GTA IV]] are similar to the 64 node-files introduced with [[GTA_SA|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 <code>nodes0.nod</code> 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 [[Wikipedia:row-major order|row-major order]].
  
 
==Preamble==
 
==Preamble==
  
Before you start understanding GTA IV's path format you should start reading [[GTA_SA_Paths|San Andreas paths]] article. Since GTA IV paths are based on the old path version the article is good to understand path basics.
+
Before trying to understand the format of GTA IV's path files, it is recommended to read the [[Paths (GTA SA)|San Andreas paths]] article, since GTA IV paths are an update of the old format.
  
Unlike San Andreas paths are not stored in the major image file ([[gta3.img]]). Also nodefiles do not longer have the ending <code>.dat</code>. In GTA IV paths are stored in the <code>~\pc\data\cdimages\paths.[[img]]</code> file as 64 <code>.nod</code> files. Also the file format has changed in general. Where San Andreas had 7 sections per node file GTA IV just got 2. Linking works different and there are no navi-nodes any longer.
+
Unlike San Andreas, paths are not stored in the major [[archive file]] ([[gta3.img]]) and the node files also do not have the extension <code>.dat</code> anymore. In GTA IV, paths are stored in the <code>~\pc\data\cdimages\paths.[[img]]</code> file as 64 <code>.nod</code> files. Furthermore the file structure has generally changed: If San Andreas had 7 sections per node file, GTA IV only got 2. Linking works in a different way and there are no navi nodes any longer.
  
''This section is incomplete''
+
{{Incomplete}}
  
 
==File Format==
 
==File Format==
Line 28: Line 27:
 
  4b - UINT32  - Number of links ([[Paths_(GTA4)#Section_2_-_Links|section 2]])
 
  4b - UINT32  - Number of links ([[Paths_(GTA4)#Section_2_-_Links|section 2]])
  
* ''This section is incomplete''
+
{{Incomplete}}
  
 
===Section 1 - Nodes===
 
===Section 1 - Nodes===
Line 36: Line 35:
 
  2b - UINT16 - Area ID
 
  2b - UINT16 - Area ID
 
  2b - UINT16 - Node ID
 
  2b - UINT16 - Node ID
  4b - UINT32 - Unknown
+
  4b - UINT32 - Unknown - may be related into [[GTA_SA_Paths#Section_2_-_Navi_Nodes|interpolation]]
  2b - UINT16 - Allways 0x7FFE
+
  2b - UINT16 - Heuristic Cost - Used for calculating shortest route internally
 
  2b - UINT16 - LinkID
 
  2b - UINT16 - LinkID
 
  6b - INT16[3] - Position (XYZ)
 
  6b - INT16[3] - Position (XYZ)
  1b - BYTE  - Path Width (divide it by 8 to get the floating point value)
+
  1b - BYTE  - Path Width
  1b - BYTE  - Path Type (0x100 for Boats)
+
  1b - BYTE  - FloodFill - seperates nodes distinctly (need confirmation)
 
  4b - UINT32 - Flags
 
  4b - UINT32 - Flags
  
* ''Structure unconfirmed and partly incomplete''
+
;Area ID: defines the area where the node lays in. Usually this is the same number as the one of the node file.
* ''This section is incomplete''
+
;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).
 +
 
 +
'''Note:''' Please note that this is in little-endian format.
 +
====Path Node Flags====
 +
 
 +
Flag 0: Unknown but used
 +
Flag 1-2: Unknown
 +
Flag 3: Dont Wander
 +
Flag 4: Ignored?
 +
Flag 5: Emergency Only?
 +
Flag 6: isWaterNode
 +
Flag 7: Unknown
 +
 
 +
Flag 8: Ignored Node?
 +
Flag 9-11: SpeedLimit?
 +
Flag 12-15: Link Count
 +
 
 +
Flag 16: Disable Linking?
 +
Flag 17: Slow Trafiic
 +
Flag 18: Highway
 +
Flag 19: Dirt Road
 +
 
 +
'''Note:''' Flag 'Slow Traffic' make the average car speed = 30 KM/H; 'Highway' = 70 KM/H; Dirt Road = 50(?) KM/H.
 +
Speed Value may be wrong, but these three flags are fully known.
 +
 +
Flag 20: Unknown Ped Flag
 +
Flag 21: Boat Movement
 +
Flag 22: Unknown
 +
Flag 23: Using only in Manhat?
 +
 
 +
Flag 24-27: Behaviour
 +
Flag 28-31: Spawn Rate?
  
 
===Section 2 - Links===
 
===Section 2 - Links===
Line 51: Line 87:
 
  2b - UINT16  - Area ID
 
  2b - UINT16  - Area ID
 
  2b - UINT16  - Node ID
 
  2b - UINT16  - Node ID
  4b - UINT32 - Flags
+
  1b - UINT8  - Unknown
 +
1b - UINT8  - Link length
 +
2b - UINT16 - Flags
 +
 
 +
* ''Structure unconfirmed and partially incomplete''
 +
 
 +
{{Incomplete}}
  
* ''Structure unconfirmed and partly incomplete''
+
==Tools and Scripts==
* ''This section is incomplete''
+
* {{GTAF|392955|PathViewer}} &ndash; a tool by {{U|Aschratt}} which allows to view paths and highlight nodes with special flags in 3D.
  
==External Link==
+
==External Links==
* [http://www.gtaforums.com/index.php?showtopic=388886 IV Paths Format] - GTAForums topic
+
* {{GTAF|388886|IV Paths Format}}
  
[[Category:File-stubs]][[Category:Map Formats]][[Category:GTA 4]]
+
{{GTA4-navi}}
 +
[[Category:Map Formats]][[Category:GTA 4]]

Latest revision as of 15:22, 4 September 2015

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 trying to understand the format of GTA IV's path files, it is recommended to read the San Andreas paths article, since GTA IV paths are an update of the old format.

Unlike San Andreas, paths are not stored in the major archive file (gta3.img) and the node files also do not have the extension .dat anymore. In GTA IV, paths are stored in the ~\pc\data\cdimages\paths.img file as 64 .nod files. Furthermore the file structure has generally changed: If San Andreas had 7 sections per node file, GTA IV only got 2. Linking works in a different way and there are no navi nodes any longer.

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

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. You can help by fixing and expanding it.

Section 1 - Nodes

4b - UINT32 - MemAddress
4b - UINT32 - Zero (Allways)
2b - UINT16 - Area ID
2b - UINT16 - Node ID
4b - UINT32 - Unknown - may be related into interpolation
2b - UINT16 - Heuristic Cost - Used for calculating shortest route internally
2b - UINT16 - LinkID
6b - INT16[3] - Position (XYZ)
1b - BYTE  - Path Width
1b - BYTE  - FloodFill - seperates nodes distinctly (need confirmation)
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).

Note: Please note that this is in little-endian format.

Path Node Flags

Flag 0: Unknown but used
Flag 1-2: Unknown
Flag 3: Dont Wander
Flag 4: Ignored?
Flag 5: Emergency Only? 
Flag 6: isWaterNode
Flag 7: Unknown
Flag 8: Ignored Node?
Flag 9-11: SpeedLimit?
Flag 12-15: Link Count
Flag 16: Disable Linking? 
Flag 17: Slow Trafiic
Flag 18: Highway 
Flag 19: Dirt Road

Note: Flag 'Slow Traffic' make the average car speed = 30 KM/H; 'Highway' = 70 KM/H; Dirt Road = 50(?) KM/H. Speed Value may be wrong, but these three flags are fully known.

Flag 20: Unknown Ped Flag
Flag 21: Boat Movement
Flag 22: Unknown
Flag 23: Using only in Manhat?
Flag 24-27: Behaviour
Flag 28-31: Spawn Rate?

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