Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Aschratt

IV Paths Format

Recommended Posts

Aschratt

Hi,

 

yesterday I took a quick look over the paths format of IV. It looks like it is nearly the same like SA. A bit less complex and easy, but all in all the same.

 

Paths are located in "%Grand Theft Auto IV%\pc\data\cdimages\nodes.img". They are stored in 64 .nod files (like in SA with the difference that SA nodes hat the ending .dat). Here is the format I got 'till now:

Header:4b - UINT32	- Number of Nodes4b - UINT32  - Number of Car-Nodes4b - UINT32  - Number of PED-Nodes4b - UINT32	- LinksNodes (0x20/32b):4b - UINT32	- MemAddress?4b - UINT32	- Zero?2b - UINT16	- Area ID2b - UINT16	- Node ID4b - UINT32	- Zero (Not allways...)2b - UINT32	- Allways 0x7FFE6b - INT16[3]	- Position (XYZ) /84b - UINT32	- Flags?4b - UINT16  - UnknownLinks (0x08/08b):2b - UINT16	- Area ID2b - UINT16	- Node ID4b - UINT32	- Flags

Structures (C-Syntax):

struct pathsNodesFileHeader{   unsigned int numNodes;   unsigned int numCarNodes;   unsigned int numPedNodes;   unsigned int numLinks;};struct pathsNode{   unsigned int memAddress;   unsigned short areaId;   unsigned short nodeId;   float posX;    // divide by 8 to get floating point value   float posY;    // divide by 8 to get floating point value   float posZ;    // divide by 8 to get floating point value   unsigned int flags;   unsigned short unknown;};struct pathsLinks{   unsigned short areaId;   unsigned short nodeId;   unsigned int linkFlags;};

Some SA information is outdated, like NaviNodes and LinkLength. Lanes, TrafficLight behaviour and so on appear to be stored in the link flag value. I have no idea yet, wheather the nodes are interpolated or where/how interpolation information like normalized vectors or so are stored. Also I don't know if the flags are stored where I think they are, or what meaning the bits have.

 

I wrote some kind of viewer, which is keept very simple. Here is an screen:

user posted image

(You have to turn this image by 180 dagrees... haven't recognized this yet tounge.gif)

Perhaps those information may help anyone.

 

Greetings,

- Aschratt!

Edited by Aschratt

Share this post


Link to post
Share on other sites
Intosia

Good job smile.gif Although what are Paths?

Share this post


Link to post
Share on other sites
Aschratt

tounge.gif

 

NPC cars and pedestriants driving/walking around are spawned along paths and influenced in their behaviour by them. Click

 

Share this post


Link to post
Share on other sites
REspawn

Excellent work Aschratt

Share this post


Link to post
Share on other sites
JKM

good news cookie.gifcookie.gif ... nice to see you working on 4 aschratt xD

Share this post


Link to post
Share on other sites
xmen

wow, once again mate...nice work on path. Keep it up icon14.gif

Share this post


Link to post
Share on other sites
Aschratt

Hi,

 

I've took a deeper look into paths again and got some new rudiments. First of all the structures are nearly as I guessed. I am pretty sure that it looks like that:

Nodes (0x20/32b):4b - UINT32 - MemAddress4b - UINT32 - Zero (Allways)2b - UINT16 - Area ID2b - UINT16 - Node ID4b - UINT32 - Unknown2b - UINT16 - Allways 0x7FFE2b - UINT16 - LinkID6b - INT16[3] - Position (XYZ)2b - UINT16  - Path Type (0x100 for Boats)4b - UINT32 - Flags

I have not yet tested linking, but I will, after I got an IDE back running here.

Position values appear to be calculated by dividing them with 8 (like in SA). Just Y-position must be divided with -8 (unlike SA). But I am not sure about this yet.

 

But there is one more thing I found out about this theme. The values I supposed to be ped noes aren't ped nodes. Which means, somehow they are, but not all ped nodes are indexed by the number in the header. In general there are 2522 of those nodes. The special thing about them is that they are located around intersections (But allways on the pavement). I guess they are special nodes which are used to let npc's wait at pedestrian crossings (Pic 1). This means that ped nodes are identified by some kind of flag. My researches about that showed that the flag seems to be a part of the flag-number of the nodes structure, because all other unknown values appear to be some kind of randomly. However I think I will find out more about that when I managed some linking tests.

 

Flags are nearly the same as in SA. I will create an table like in the wiki for that. The first part (A - M) seems to be identical or very similar to SA, but I only had a short look to that.

 

Pictures:

user posted image user posted image

 

I'll keep you up-to-date, greetings so far,

- Aschratt.

 

//EDIT (07.01.2009):

 

I managed it to seperate vehicle from pedestriant and boat nodes (Pic 3). However it is pretty simple and I don't know why I haven't seen this detail a bit earlier, because it is kept from San Andreas. blush.gif

 

The unknown value come's before the flags are paths width (which seems to take affect in IV... unlike SA where it did not have any affect) and path type. Path type defines wheather the node is an ped/vehicle/boat/different node. Yes there are different nodes (You can't see them in the picture, because I painted them white, too). Their paths type is always 0x0C. They are located at the Hove Beach harbor, where the player starts in the original game. I have no idea what they are exactly, but I guess I will find out, when I managed some linking.

However you can filter out the path type pretty easy:

if(pathType == 0x01){   // Boats}else (((pathType >> 4) & 0x0E) == 0){   // Cars}else{   // Ped's}

 

 

Intersection nodes appear to be checked with 0x0D, but there also seem to be some nodes with 0x0B or 0x0F. I haven't yet found out what's their difference, but it seems to be some number of the current city circuit (Or village what they were in SA.) I think that they are used for some kind of borders or filters. Pedestriants are only walking along paths with the same number. I got to check this later on. Also the rest of the byte is a bit mysterious. It seems to increment by each node (0-F) in saturate arithmetics.

 

However here is the structure I am using at the moment:

Nodes (0x20/32b):4b - UINT32 - MemAddress4b - UINT32 - Zero (Allways)2b - UINT16 - Area ID2b - UINT16 - Node ID4b - UINT32 - Unknown2b - UINT16 - Allways 0x7FFE2b - UINT16 - LinkID6b - INT16[3] - Position (XYZ)1b - BYTE  - Path Width (divide it by 8 to get the floating point value)1b - BYTE  - Path Type (0x100 for Boats)4b - UINT32 - Flags

 

 

user posted image

 

//EDIT (08.01.2009):

 

I found out that my seperation for car and ped nodes does not allways work, but I also found out for what the first unknown value seems to stand. However it is only used for highways and/or big roads/tunnels. All nodes which are not zero there are vehicle node, unless this does not mean that all vehicle nodes are not zero there.

 

//EDIT (10.01.2009 #1):

 

Here is the flag table. I know it is not very nice, but it shows that the flags are averanged nearly like in San Andreas, which let's me come to the conclusion that they are used pretty identical:

04: 268105: 255906: 2707: 779008: 1760609: 1147310: 1163411: 1157112: 1171413: 1162214: 1168115: 529016: 309817: 2365418: 30219: 020: 2794321: 160122: 109023: 491824: 791525: 120226: 491827: 028: 029: 940230: 031: 7419

I will create colored flag maps which show the averange of the flags on the nodes map. Perhaps I found out wheather real PED-Node seperation works with flags.

 

//EDIT (10.01.2009 #2):

 

All right... it's nice to have his own online-log tounge.gif

Whatever... Nodetypes realy seem to be influenced by flags. Flag 25 is 100% for boats, flag 29 is an special flag type just for Alderney. I guess it influences appeareance of cars and pedestriants for the "city core": more traffic jams, slower traffic, and so on... But I haven't found an flag type that 100 % matches for all ped or car nodes. I guess R* itself did some bugs there (I already recognized some path bugs ingame, but I could not say if they are on the same locations).

 

//EDIT: (10.01.2009 #3):

 

Damn, I made a mistake. I calculated flags into the wrong direction. Here are my results (Now they are exact):

0-4: Unknown... Not link count, as I guessed... somehow related to traffic level. 3 is only set for Alderney, 0 is only set for some nodes, the other values are allways 0.Flag 05: Emergency onlyFlag 06: BoatsFlag 07: UnknownFlag 08: Exactly the same as 05Flag 09: Intersection central nodeFlag 10: Is highway (See SA's node flags)Flag 11: Is not highway (See SA's node flags)Flag 12: zero/unusedFlag 13: Identical to 09, but not set for all nodes which have 09. Somehow else related into intersections.Flag 14: Set for almost any vehicle nodeFlag 15: Set for those vehicle nodes without 14, and some PED nodesFlag 16: Set for those PED nodes without 15 and some vehicle nodes17-23: apparently randomly set, perhaps some counterFlag 24: Set for most PED nodesFlag 25: Rarely used, police controls or roadblocks?Flag 26: Used for intersection nodes (those which are defined in the header), but also some moreFlag 27: The same as 26, even used a bit more28-31: Apparently 1 for most nodes, but not for all. Almost never 0, and if so the other 3 flags aren't set, too.

Perhaps some of the flag stuff is used for navi-nodes (I guess some of the flags 17 - 23), we know from SA. Rockstar uses them for interpolation. I did not have a look to the link flags yet, but I think Rockstar simply put things from the sections 3, 5 and 6 together into one.

 

//EDIT (11.01.2009):

 

I checked those flags which do not make any sense again. Still they do not make any sense, lol.

Flags 28-31 are almost everytime 1111 or 0000, except for 3488 nodes. Flags 17-23 do not appear to be any counter. I don't know, what they are. Also I took a look at the link flags. I don't know what the first byte is, but the second appears to be the link length. 3rd and 4th byte are interesting, too. They are sometimes completely zero, but sometimes not. So first I guessed that they are related into interpolation, but after some thinking, I do not think so.

 

However, still I have no idea from where to gain the link id... I will try to figure this out and do some linking, when I was successfull... perhaps I can say more then.

Edited by Aschratt

Share this post


Link to post
Share on other sites
Aschratt

All right, I will create a new reply, because the old one is getting more and more confusing.

 

I found out some more stuff about paths, espcially how they are linked. New with IV is that ped nodes apparently are not linked, except those which are marked as intersection nodes. I guess that's also the way ped nodes are seperated from others. However the link count is stored somewhere in the middle of the flags (bits 12-15). For getting the links you have to loop the link count from the link id (which is an address into section 2). It's like in SA, just the link count is formed by different bits (Pic 1).

 

I also found out many things about flags. First of all I mixed up Alderney with Algoquin ( blush.gif ). Flag 3 is only set for Algoquin, not Alderney. But some more interesting stuff I found out about the other flags: Flag 16 seems to mark ped nodes, but I am not sure, because the intersection nodes are not marked by flag 16. So correctly flag 16 seems to disable node linking. I will check link id's of those nodes marked with flag 16. If I am right they are 0, or ignored. However the link count of those nodes must be zero. Flag 24 is set for those nodes with flag 16 and the intersection nodes, so flag 24 apparently marks ped nodes. But flag 24 seems to be also set for a small group of vehicle nodes in Alderney (^^). But it also can be just ped nodes, drawed above some vehicle nodes... I am not sure. Flag 26 is the opposite to flag 16. It seems to enable linking for ped nodes. However all intersection nodes are marked with this flag, but also a small group of nodes in Algoquin (near the paint and spray at the small road next to the bridge to Bohan, under the railway). For them it is the same as flag 24, descriped above. I have to check this. Flag 27 is also somehow related into this, but I have no idea how. However with flag 27 there comes another small group of ped nodes to the ones above: The one's on broker, where the player starts.

 

So the flag table is looking like that now:

 

 

0-4: Unknown... Not link count, as I guessed... somehow related to traffic level. 3 is only set for Algoquin, 0 is only set for some nodes, the other values are allways 0.Flag 05: Emergency onlyFlag 06: BoatsFlag 07: UnknownFlag 08: Exactly the same as 05Flag 09: Intersection central nodeFlag 10: Is highway (See SA's node flags)Flag 11: Is not highway (See SA's node flags)12-15: Link count (Number of Links, starting with the link id)Flag 16: Disable linking (for PED nodes, as descriped above)17-23: apparently randomly set, perhaps some counterFlag 24: Is ped node (see above)Flag 25: Rarely used, police controls or roadblocks?Flag 26: Enable linking for ped nodes (see above)Flag 27: Not sure (see above)28-31: Apparently 1 for most nodes, but not for all. Almost never 0, and if so the other 3 flags aren't set, too.

 

 

user posted image

(Crossfliedlinking disabled, but it works too... I am just too lazy to code it tounge.gif)

 

Also I took a look to the link format. I am not 100 % sure about it, but this is one major point I will take a look at the next time. Here is the structure:

2b - UINT16  - Target area id2b - UINT16  - Target node id1b - BYTE    - Unknown1b - BYTE    - Link length2b - UINT16  - Flags?

 

 

What's still left to say?

Oh yea, I still have no idea about this unknown 32-bit value in the nodes structure. Also I have no idea about interpolation yet.

But I still got 2 thoughts about linking:

1st I guess the number of lanes is set somehow in the link flags (which I guess are link flags). In San Andreas they were set in the navi node flags, but in IV there are no such flags, just as there are no navi nodes. This leads me to the conclusion that interpolation is done by the game (perhaps with parsing the nodes) - we will find out.

2nd the link flags are very often simply zero. I guess only for boat nodes, but I am not sure.

 

Greetings,

- Aschratt.

Share this post


Link to post
Share on other sites
Intosia

Wow! You've been cracking! Good job smile.gif So basicly you could let cars drive where they normaly wouldnt go? Like letting drive into the ocean lol.gif

Share this post


Link to post
Share on other sites
Aschratt
Wow! You've been cracking! Good job smile.gif So basicly you could let cars drive where they normaly wouldnt go? Like letting drive into the ocean lol.gif

Basicly yes, but the tool I am writing is a (sh*tty-coded, by scratch made) viewer, so I cannot yet edit them (only by entering every info by hand...). But it seems like R* did a lot of crappy bugs in there (Just drive over the bridges, you will see, what I mean...). Perhaps sometime we can fix them. Also this may be useful for future total conversions. smile.gif

Share this post


Link to post
Share on other sites
_Charger_

Pathtypes of IV:

 

IV uses only 38 different pathtypes:

 

 

1: 1 (Boats)2: 2263: 2274: 2285: 2296: 2307: 2318: 2329: 23310: 23411: 23512: 23613: 23714: 23815: 23916: 24017: 24118: 24219: 24320: 24421: 24522: 24623: 24724: 24825: 24926: 25027: 25128: 25229: 25330: 25431: 25532: 22533: 21134: 19 (Cars)35: 22436: 17937: 1238: 147

 

 

Flags of IV:

 

 

Total Flags used: 30906Distinct Flags used: 4083

 

 

Linkflags of IV:

 

 

Total Linkflags used: 51638Distinct Linkflags used: 242

 

 

Information created with tool made by Charger for research. Tool is part of PathScripts by Charger and GTARandom

Edited by _Charger_

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.