traffic Peds movement on path nodes

Recommended Posts

Now I'm just try to understand how NPC HLC Traffic and 'traffic' (default MTA resource) is working, i.e. how the peds choose where to move and where to stop, etc.
I know: peds randonly spawn around player on closest nodes and moves to another nodes. Nodes have flags (roadblock, emergency, highway, etc.). Each node have a links to another nodes. But for what a node need a neighbors and links and how it using, I don't know.

Can't understand how they choose the right node from others. Please, explain how this system works. I suppose this algorithm has been taken from singleplayer, right?
I've read an article at https://gta.fandom.com/wiki/Paths_(GTA_SA) trying to find out, but couldn't...

17 hours ago, Thomas_Nightfire said:

Can't understand how they choose the right node from others.

Take a look at this function:

This function allows you to calculate the shortest distance between a line and a point. If you did that for every line between the notes, you would be able to figure out which one is the closest to your ped or car.

• 1
8 hours ago, IIYAMA said:

Take a look at this function:

This function allows you to calculate the shortest distance between a line and a point. If you did that for every line between the notes, you would be able to figure out which one is the closest to your ped or car.

For what? May be I just need to get the distance between two points? Ped pos and node pos?

7 hours ago, Thomas_Nightfire said:

I only gave you the concept of how traffic resource is doing that. You think you wouldn't find an enchanted version of that same code in the traffic resource? I am pretty sure there is, which is where  you could start your search + understanding the code.

Edited by IIYAMA

Create an account

Register a new account

• Recently Browsing   0 members

×

• MTA Network

×
• Create New...