SA-MP Forums [Include] Dijkstra.inc - Dijkstra pathfinding algorithm
 User Name Remember Me? Password
 New Account Members List Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
 20/04/2012, 07:44 PM #1 RyDeR` High-roller     Join Date: Feb 2009 Location: Belgium Posts: 3,052 Reputation: 696 Dijkstra.inc - Dijkstra pathfinding algorithm Introduction This is a basic implementation of the dijkstra algorithm, including a basic example of a GPS system working on nodes, using this include. Function(s) We have only one basic function: pawn Code: `stock Dijkstra(const aeNodes[][], iStart, iEnd, aiPath[], const iSize = sizeof(aeNodes))` Here's how the node array should look like: pawn Code: `enum e_Nodes {    Float: e_fNX,    Float: e_fNY,    Float: e_fNZ,    e_iLink1,    e_iLink2,    e_iLink3,    e_iLink4};` If the link is invalid you have to use -1. See usage in the example filterscript. Example In the link below, there's a basic GPS system using this pathfinding include. The nodes included are complete LV nodes and were made by me a while ago. I will do the whole San Andreas world once I have some free time and when I feel like it. I don't recommend using the default San Andreas nodes from NODESX.DAT with this include as there are too much to calculate in a reasonable time. [ame]http://www.youtube.com/watch?v=rENx33otwE4[/ame] GPS.pwn Download Dijkstra.inc __________________ Sup? Last edited by RyDeR`; 17/05/2012 at 09:38 AM.
 20/04/2012, 08:11 PM #2 Danny High-roller     Join Date: Jul 2010 Location: In a galaxy far far away, near the Netherlands Posts: 2,841 Reputation: 2128 Re: Dijkstra.inc - Dijkstra pathfinding algorithm So, this is basically a sort of system including positions for checkpoints and the system calculates where's the closest position is? Am I right with this? Cause I'm afraid I don't really understand the working and usages of this system. __________________ I hate reputation-askers, so DON'T ASK, JUST EARN! come into my life, it's a man made paradise http://www.buzzfeed.com/norbertobric...omp-stomp-clap
 20/04/2012, 08:15 PM #3 Fj0rtizFredde High-roller     Join Date: Jun 2008 Location: Sweden Posts: 1,059 Reputation: 120 Re: Dijkstra.inc - Dijkstra pathfinding algorithm Nice done, Ryder. I will be using this in my future project. __________________ Latest crap I've made: [Include]CleverBot - Never Be Alone Again!
20/04/2012, 08:31 PM   #4
Macluawn
Gangsta

Join Date: Aug 2010
Location: Latvia
Posts: 637
Reputation: 78
Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
 Originally Posted by -Danny- So, this is basically a sort of system including positions for checkpoints and the system calculates where's the closest position is? Am I right with this? Cause I'm afraid I don't really understand the working and usages of this system.
dijkstra's algorithm find the shortest path between any 2 points.

 20/04/2012, 09:21 PM #5 wups High-roller     Join Date: Apr 2010 Location: Lithuania Posts: 1,251 Reputation: 137 Re: Dijkstra.inc - Dijkstra pathfinding algorithm Well, there is this plugin released, you know? __________________ My Releases: Code: ```[Includes] Simple,Fast Anti-Money Hack with FS support Server Sided Weapons OnPlayerShootPlayer v8 OnPlayerVehicleDamage GetPlayerDialogID [FilterScripts] Mechanical Gear System v2 Default Map Icons MySQL E-Mail system [GameModes] Escape from Area 51```
 20/04/2012, 09:33 PM #6 TheArcher High-roller     Join Date: Dec 2009 Location: Home Posts: 2,377 Reputation: 251 Re: Dijkstra.inc - Dijkstra pathfinding algorithm Just Amazing! Keep your work up. __________________
20/04/2012, 10:11 PM   #7
RyDeR`
High-roller

Join Date: Feb 2009
Location: Belgium
Posts: 3,052
Reputation: 696
Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Thanks!

Quote:
 Originally Posted by wups Well, there is this plugin released, you know?
It is not the same. The GPS thing is just an example using this include. You can create tons of other stuff using this include.
__________________

Sup?

 20/04/2012, 11:03 PM #8 [NVC]Eduardo Huge Clucker     Join Date: Jan 2012 Posts: 224 Reputation: 1 Re: Dijkstra.inc - Dijkstra pathfinding algorithm Nice __________________ • Brasil - Virtual World RPG® v1.0 IP: 37.59.160.245:7777 + Forum: vwbrasil.forumeiros.com
 20/04/2012, 11:27 PM #9 Nanory Big Clucker     Join Date: Feb 2009 Posts: 120 Reputation: 12 AW: Dijkstra.inc - Dijkstra pathfinding algorithm I love Dijkstra and it's really useful. As you said with this algorithm you can do a lot of things. We learned it at school (graph theory) and it's not only for GPS Systems. Furthermore the plugin from Gamer_Z doesn't work on every server (on the other hand Gamer_Z work is also good) __________________ Life of German German Reallife since 2008
21/04/2012, 12:59 AM   #10
Y_Less
Beta Tester

Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,497
Reputation: 3206
Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Actually, most GPSes don't use this simply because to calculate any route would take FAR too long. I believe they do multiple levels - find the shortest path between near you and your destination on major roads, then get you to and from those major roads using a subset of the smaller roads between where you are and the nearest point on the major road.
__________________
 | Worst. Exit. Ever. |
 | git.io/Y | y-less.com | jump.pk |

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Double-O-Seven Scripting Help 1 10/10/2011 09:17 PM M4S7ERMIND Includes 17 22/07/2011 09:03 PM MJ! Help Archive 0 18/08/2010 08:38 PM

All times are GMT. The time now is 06:05 AM.

 -- (EN) English -- (RU) Русски Contact Us - SA-MP - Archive - Top