Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / A* algorithm (and/or Dijkstra's algorithm?)

Author
Message
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 13th Jul 2005 04:57
Does anyone have code in Dark Basic that helps find the shortest distance between two waypoints with many in the middle? I know the pseudocode... it's kinda like this:

`-----------------------------
create an array P
add the start node S, to P giving it one element
Until first path of P ends with G, or P is empty
extract the first path from P
extend the path one step to all neighbors creating X new paths
reject all paths with loops
add each remaining new path to P
If G found -> success. Else -> failure.
`-----------------------------

Unfortunately, i'm not sure how to extend the path. r u supposed to
use arrays? Help please! Oh yeah, and I tried using IanM's library and it doesn't work... i even tried to convert the code manually into DBC code except i have no idea as to how to convert queues. Thank you.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Jul 2005 08:52
Hey, I'm having exactly the same problem right now, but I've found this good website that helps out a little, http://www.policyalmanac.org/games/aStarTutorial.htm, even though it helps a little, I still havent the slightest clue how to code it out, infact, I was just trying it out right there....

Btw, do you want it in 2D or 3D?

Your signature has been erased by a mod because it's larger than 600x120...
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 13th Jul 2005 13:46
3d, cuz i'm trying to make an fps with waypoints that the enemy follows. Thanks for the page
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 15th Jul 2005 00:20
Hey, just so you know, I got the pseudocode from http://www.ai-depot.com
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 19th Jul 2005 07:42
No one wants to help? Tear
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 1st Aug 2005 19:00
Um, doesn't look like anyone wants to help...

MODS can lock this thing if you want to...

If practice makes perfect and nobody is perfect, then why practice?

Login to post a reply

Server time is: 2025-05-22 12:52:32
Your offset time is: 2025-05-22 12:52:32