SA-MP Forums Archive
[Plugin] Modern GPS plugin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] Modern GPS plugin (/showthread.php?tid=662109)



Modern GPS plugin - kristo - 23.12.2018

https://www.burgershot.gg/showthread.php?tid=66


Re: Modern GPS plugin - Alexis17 - 23.12.2018

I had thought to use Router Connector, but ЎBut a more active plugin !, I congratulate you boy!


Re: Modern GPS plugin - RogueDrifter - 24.12.2018

Very modern, much wow.


Re: Modern GPS plugin - Crayder - 24.12.2018

Could you make a way to create our own GPS.dat like RouteConnector?


Re: Modern GPS plugin - SyS - 24.12.2018

Nice


Re: Modern GPS plugin - PT - 24.12.2018

Very very Nice job!

-

Happy Christmas


Re: Modern GPS plugin - Logic_ - 24.12.2018

Mashallah. Good work.


Re: Modern GPS plugin - Marshall32 - 24.12.2018

Good job


Re: Modern GPS plugin - cuber - 24.12.2018

very std::thread, very wow.

will use it for sure.


Re: Modern GPS plugin - Awide - 24.12.2018

Any pictures plz?


Re: Modern GPS plugin - NaS - 25.12.2018

Quote:
Originally Posted by kvann
View Post
Version 1.1.0 has been released!
  • Fixed GetMapNodeDistanceFromPoint and GetClosestMapNodeToPoint.
  • Some refactoring.
  • New natives:
Code:
native GetAngleBetweenMapNodes(MapNode:first, MapNode:second, &Float:angle);
native GetMapNodeAngleFromPoint(MapNode:nodeid, Float:x, Float:y, &Float:angle);
native GetMapNodeConnectionCount(MapNode:nodeid, &count);
native GetHighestMapNodeID();
native GetRandomMapNode(&MapNode:nodeid);
I will update the readme soon. I did not add any functions for individual connections yet since their internal structure will probably change a lot in the next release. Also, I must have done my initial benchmarks with a debug build since the plugin is actually over ten times faster than I said in the first post, finding a path through the whole map actually takes under 0.1 seconds.





I have these things planned for the next bigger release or the one after. Right now this plugin only contains functions I needed to convert my gamemode from RouteConnector plus some extras. Runtime editing of nodes and loading/saving them will definitely be a thing, not sure when though, since I have a busy period coming in school. I'm not sure about RebuildNet right now, I believe it's a RouteConnector thing since it prebuilds the graph. This plugin doesn't do that, all the nodes and their connections just act as a graph in the pathfinder. Correct me if I'm wrong though.



Yeah, I took a look at the original data format when trying to understand how directions in GPS.dat work. Road widths and lane counts could also be used in the pathfinding algorithm to prioritise highways and main roads. I would also like to make as much data accessible to developers as possible. Also, for now, I've found out that an offset of 2.5 units is the golden mean that works for most roads.



I'm actually using the fixed one, you're even in the credits. Also, can you confirm if Gamer_Z is the creator of the original one or is it someone else?
Sounds good! The RebuildNet was neccessary for Gamer's Plugin but if it's not neccessary for this one even better! It was pretty inconsistent anyway - if you edited, added or deleted nodes while using the Plugin for Path Finding, the graph would still link to deleted nodes which led to crashes and bugs, also wrong distances and more.

2.5 is good, I used 2.2 for my NPC Drivers but that's probably a negligible difference. However in some parts this is either wrong or just uses 1 of 2 lanes, but that is a minor problem.

About the GPS.dat, didn't see that sorry! I also have a GPS.dat for Vice City, since many people use the VC Map for 0.3DL I guess it could be useful (I created that one with my editor without the original path data, so no additional info is available for that unfortunately however the original node files are pretty much the same).
Problem with that is the position of the VC Map. But if you know the offset, you could just use a loop to move all Nodes to the proper position.

From my knowledge Gamer_Z is the original author of the GPS.dat, I remember he was processing the node*.dat files using a Script or Program and generate his own format for it.

Also the speed is awesome!
With Gamer's Plugin it took about a minute or longer for the initial path calculations, with this one it's under 10 seconds, depending how long the paths are.
Thanks for this great release!

Here's the Vice City GPS.dat if anyone is interested: https://pastebin.com/cVQ2cH9P
There are some chaotic nodes in some places because of too many intersections (limit was 5).


Re: Modern GPS plugin - iorp - 26.12.2018

Thanks for update, I have successfully integrated this plugin with my auto drive and race script. working smooth with amazing performance.


Re: Modern GPS plugin - kristo - 01.01.2019

Version 1.2.0 has been released!
This isn't what I promised in my last few posts, but the plugin has gained quite a few users since then and Kar and Graber found a huge flaw in the algorithm that needed fixing and it was also a good opportunity to roll out some smaller updates.


Re: Modern GPS plugin - NaS - 31.03.2019

Just switched from RouteConnector to this plugin for the NPC Drivers and found a small issue with node connections.
If a node points to another node but it doesn't point back, the path sometimes stops there (although it should probably try to find another way). It seems to work in most cases but rarely doesn't.

An example for that would be near the LS Airport highway (I can try to find two node ids that produce this if this helps).

I also get a warning/error in the console sometimes:

"Failed to dispatch thread: resource unavailable try again: resource unavailable try again"

It keeps spamming that and then crashes. So far no idea why it happens, it doesn't seem to be too busy at that point and I made sure the nodes passed to FindPathThreaded are valid etc.


Re: Modern GPS plugin - kristo - 31.03.2019

Quote:
Originally Posted by NaS
View Post
Just switched from RouteConnector to this plugin for the NPC Drivers and found a small issue with node connections.
If a node points to another node but it doesn't point back, the path sometimes stops there (although it should probably try to find another way). It seems to work in most cases but rarely doesn't.

An example for that would be near the LS Airport highway (I can try to find two node ids that produce this if this helps).

I also get a warning/error in the console sometimes:

"Failed to dispatch thread: resource unavailable try again: resource unavailable try again"

It keeps spamming that and then crashes. So far no idea why it happens, it doesn't seem to be too busy at that point and I made sure the nodes passed to FindPathThreaded are valid etc.
Thanks for reporting, it's interesting that these things have happened to nobody else considering that the plugin is used on some large production servers (KCNR, a spanish and an iranian server, soon on RC-RP). I'll do some testing when I find some time and get back to you if I need some more information. I should implement the last missing features soon, I've left the plugin unmaintained for about 3 months already...


Re: Modern GPS plugin - darkHero - 08.04.2019

No work in Centos 7


Re: Modern GPS plugin - TommyB - 09.04.2019

Quote:
Originally Posted by darkHero
View Post
No work in Centos 7
Here's a static build for you.
https://tommyb.ovh/files/GPS_static.zip


Re: Modern GPS plugin - darkHero - 09.04.2019

This sounds silly, but I was trying to copy in CentOS and I can not imagine it was because I needed to combine the C ++ 11 libraries with C ++ 17, thanks for helping.


Re: Modern GPS plugin - kristo - 12.04.2019

I started working on version 2.0.0, which will finally feature runtime node management, you can keep an eye on the GitHub repository to be updated with the progress.


Re: Modern GPS plugin - Crayder - 13.04.2019

YESSS! That's exactly what I wanted to hear!

Seriously, that's awesome. I requested this is the third post and this genuinely makes me hard.

Now once that's complete we just gotta make a navigational mesh for the entire map of San Andreas...