Path finding in pawn -
cessil - 01.01.2019
background
I started this project around 2015 just to see if I could remake what I believe would have been the hardest part of Crazybob's CnR script, then I got bored, lacked motivation and dropped it for several years..
I picked it up only to create a script to detect if you're driving on the wrong side of the road and then dropped it again.
Seeing a couple threads on path finding in the last couple of days inspired me to go through it again and I found several errors in my past scripts, I fixed them up and completed it, here's a short example of a path from LS stadium to LS docks
download
I created it in flash first to save me many hours loading, reloading the game which can be downloaded here
https://ufile.io/9s2ym
instructions
hold any key and move mouse to pan
mouse wheel to zoom
click a start position and an end position to create a path
after that, porting it over was pretty quick.
I haven't used anything of the other users work from here (gps wise), I used Aschratts to decompile the nodes, ran macros over to be able to put it into flash and then ran more scripts to fix it up and make it useable
I went with two different sets of nodes, one with just intersections and another with all the nodes
I ran the algorithm over the intersections to create the path and then used a function to highlight the nodes in between each intersection
I wanted to see what it'd look like on the minimap with icons, but it's really ugly having all those icons down there perhaps gangzones would look nicer.
speed
I really wasn't too fussed with performance, but I thought others would be, it took
154ms from KACC to the top of mount chilliad which you can see above checks just about every node in that case, it could be sped up as it's using square root distances but I'm not fussed, another way would be to do what real GPS' do and prioritise main roads
here's the enums I used in pawn
Code:
enum IntersectionInfo
{
Float:Int_xpos,
Float:Int_ypos,
Float:Int_zpos,//xyz
NID,//node id, the index of this node in the array that contains all the nodes
iN1,//intersection neighbour 1
n1,//neighbour 1 in the all nodes array
g1,//g cost or value from this node to intersection neighbour 1
iN2,
n2,
g2,
iN3,
n3,
g3,
iN4,
n4,
g4,
};
enum NodeInfo
{
Float:Node_xpos,
Float:Node_ypos,
Float:Node_zpos,//xyz
nn1,//node neighbour 1
nn2,
nn3,
nn4,
};
Re: Path finding in pawn -
KayJ - 01.01.2019
Nice
Re: Path finding in pawn -
jop9888 - 01.01.2019
Are you going to release the code?
Re: Path finding in pawn -
Kar - 01.01.2019
Good job. The GPS Plugin pretty much completes this.
I already made 2 more types of GPS styles, GTAIV/V and something like CrazyBobs with the plugin.
~9-11ms from Chilliad to KACC on my home host (Intel i7 7700HQ).
Re: Path finding in pawn -
RogueDrifter - 01.01.2019
Path finding everywhere
Re: Path finding in pawn -
cessil - 02.01.2019
Quote:
Originally Posted by jop9888
Are you going to release the code?
|
If the gamer z plugin does the exact same thing but faster I don't see a point in doing so
Quote:
Originally Posted by Kar
Good job. The GPS Plugin pretty much completes this.
I already made 2 more types of GPS styles, GTAIV/V and something like CrazyBobs with the plugin.
~9-11ms from Chilliad to KACC on my home host (Intel i7 7700HQ).
|
oh yeah I forgot I was going to make a text draw saying things like left turn in x m, another idea just crossed my mind is I could create a road naming program and use the script to say what road you're driving on.
I got the i5-8400
Quote:
Originally Posted by RogueDrifter
Path finding everywhere
|
true, that's because it's fun to mess around and visualise
Re: Path finding in pawn -
X337 - 02.01.2019
oh cool good job