SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 16/04/2017, 06:45 PM   #41
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 542
Reputation: 73
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
Originally Posted by Battlezone View Post
I'm planning to use this include for my bots that are spawned in small closed map with many walls inside it, but my problem here is about finding a way to change the path in this case:
The route is traced between 2 nodes, but there's a wall between those 2 nodes and as a bot cannot climb the walls, I need to choose the next shortest path to that node that contains no obstacles, any idea on how to do this ?
I'm thinking of making small local levels between nodes but it looks complicated to me
Well if i'm not mistaking on Gamer_Z's Thread a bit similar to this he has the latest nodes provided by NaS you could check it out and see if that solves your problem.
ISmokezU is offline   Reply With Quote
Old 16/04/2017, 06:51 PM   #42
Battlezone
Gangsta
 
Battlezone's Avatar
 
Join Date: Aug 2013
Location: Berlin
Posts: 803
Reputation: 155
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
Originally Posted by ISmokezU View Post
Well if i'm not mistaking on Gamer_Z's Thread a bit similar to this he has the latest nodes provided by NaS you could check it out and see if that solves your problem.
Thanks for the fast reply.
I've just checked the plugin and found an interesting feature; nodes arrays.
So using it, I would be able to make those local levels, but I'm still unsure about the technique to make these levels, I need some help concerning that.
Also, wouldn't it be better if I use this include in terms of performance, as there wouldn't be many nodes to calculate thus the process would be better than loading that plugin?
Battlezone is offline   Reply With Quote
Old 16/04/2017, 08:32 PM   #43
renatog
Huge Clucker
 
Join Date: Mar 2016
Posts: 331
Reputation: 48
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
Originally Posted by Battlezone View Post
Thanks for the fast reply.
I've just checked the plugin and found an interesting feature; nodes arrays.
So using it, I would be able to make those local levels, but I'm still unsure about the technique to make these levels, I need some help concerning that.
Also, wouldn't it be better if I use this include in terms of performance, as there wouldn't be many nodes to calculate thus the process would be better than loading that plugin?
Plugins are better than plain PAWN in performance, generally. You can generate the nodes with ColAndreas, using RayCast from the top to the ground avoiding your objects.
renatog is offline   Reply With Quote
Old 16/04/2017, 10:14 PM   #44
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 542
Reputation: 73
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
Originally Posted by Battlezone View Post
Thanks for the fast reply.
I've just checked the plugin and found an interesting feature; nodes arrays.
So using it, I would be able to make those local levels, but I'm still unsure about the technique to make these levels, I need some help concerning that.
Also, wouldn't it be better if I use this include in terms of performance, as there wouldn't be many nodes to calculate thus the process would be better than loading that plugin?
It's your choice both are similar One has more features than one i could say. For me i used the Plugin which is the 4th Plugin in my server and i have no problem with it, But at starting Gamer_Z's Plugin Scared me a bit, But after he explained it in a tutorial i understood it.
ISmokezU is offline   Reply With Quote
Old 24/06/2018, 07:31 AM   #45
Gr00t
Banned
 
Join Date: Apr 2018
Posts: 24
Reputation: 7
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Sorry for bumping an old thread.

Does someone have GPS.pwn example script?
Gr00t is offline   Reply With Quote
Old 24/06/2018, 09:37 AM   #46
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 461
Reputation: 35
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

you just add points with this script and it will find shortest way to connect them, but its badly written.
PHP Code:
fDist afDist[iStart] + floatsqroot(floatpower(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX], 2.0) + floatpower(aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY], 2.0) + floatpower(aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ], 2.0));
fDist=afDist[iStart] + VectorSize(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX],aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY],aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ]); 
CodeStyle175 is offline   Reply With Quote
Old 24/06/2018, 09:50 AM   #47
Gr00t
Banned
 
Join Date: Apr 2018
Posts: 24
Reputation: 7
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

Quote:
Originally Posted by CodeStyle175 View Post
you just add points with this script and it will find shortest way to connect them, but its badly written.
PHP Code:
fDist afDist[iStart] + floatsqroot(floatpower(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX], 2.0) + floatpower(aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY], 2.0) + floatpower(aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ], 2.0));
fDist=afDist[iStart] + VectorSize(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX],aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY],aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ]); 
Can you re-write the function good?
whats wrong in the original function?

Do you mean, change this:
Code:
fDist = afDist[iStart] + floatsqroot(floatpower(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX], 2.0) + floatpower(aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY], 2.0) + floatpower(aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ], 2.0));
to:
Code:
fDist=afDist[iStart] + VectorSize(aeNodes[iStart][e_fNX] - aeNodes[i][e_fNX],aeNodes[iStart][e_fNY] - aeNodes[i][e_fNY],aeNodes[iStart][e_fNZ] - aeNodes[i][e_fNZ]);
Gr00t is offline   Reply With Quote
Old 19/06/2019, 11:17 AM   #48
Admireal
Big Clucker
 
Join Date: Sep 2016
Posts: 81
Reputation: 5
Default Re: Dijkstra.inc - Dijkstra pathfinding algorithm

example link broken
Admireal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
An algorithm for vehicle streamers Double-O-Seven Scripting Help 1 10/10/2011 08:17 PM
[Include] M4S7reamer v1 (object streamer that uses a zoning algorithm) M4S7ERMIND Includes 17 22/07/2011 08:03 PM
Bullets Algorithm ? MJ! Help Archive 0 18/08/2010 07:38 PM


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


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.