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.

Code Snippets / Dbp A-Star code

Author
Message
Proteus
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location: The Future
Posted: 9th May 2003 00:03
I`ve found a lot of A-star example codes alround the net but I couldn`t find a Dark Basic one... I`ve just finished my own so here it goes:

ps. sorry for the mess in the code
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 9th May 2003 00:36
Very good! Even holding down shift (solve path) and drawing walls, the shortest path is calc'd in almost real time!

Gronda, Gronda
Proteus
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location: The Future
Posted: 9th May 2003 02:54
Thanks and it can get even faster... I just need to find a sorting system to the open list... but for now it`s good for turn based games

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th May 2003 16:11
Bearing in mind that I don't know how your code works yet, how would you want your openlist to be sorted?

I have an array dll on my site that has an array sort function that maybe could do what you want if I tweak it. For example an ascending sort on 'f' is possible, and fairly easy if it is made the first field in the tile type.
Proteus
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location: The Future
Posted: 9th May 2003 23:28
It would be sorted like you said Ascending 'f's

right now i`m making a turn-based game so speed isn`t quite needed but if anyone is trying to make a rts than I think that would help...
thanks

davidt
20
Years of Service
User Offline
Joined: 29th Apr 2003
Location: United Kingdom
Posted: 9th May 2003 23:38
Thank-you so much! x-d

I have just started programming some A-star pathfinding code in the last week and have got stuck multiple times! This is just what I need, thanks again.

I am making a 3d rts game, so IF(!) it ever gets finished, I will make sure you are credited for this.

Thanks, david

Spec - Abit NF7-S nForce 2, AMD Athlon 2100+, 256Mb PC2700, ATI Radeon 9000Pro, 20Gb Seagate U6, DVD-ROM, Zip 100, 15" TFT monitor
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th May 2003 04:54
Proteus
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location: The Future
Posted: 10th May 2003 06:14
Thanks guys & davidt hope it helps you in your rts

Login to post a reply

Server time is: 2024-04-25 13:23:05
Your offset time is: 2024-04-25 13:23:05