Dynamic A* Pathfinding 3.2

Advanced game related topics
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Dynamic A* Pathfinding 3.2

Post by Heathen »

Update coming
Last edited by Heathen on Fri May 03, 2013 4:14 am, edited 78 times in total.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

...
Last edited by Heathen on Fri Dec 28, 2012 10:21 pm, edited 18 times in total.
SCRJ
User
User
Posts: 93
Joined: Sun Jan 15, 2006 1:36 pm

Post by SCRJ »

Nice example, thanks! :D
But, have a look on the picture :( :

http://img227.imageshack.us/img227/267/imgtv1.jpg
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

Thanks for pointing that out 8)

Check the first post for an update :)
SCRJ
User
User
Posts: 93
Joined: Sun Jan 15, 2006 1:36 pm

Post by SCRJ »

Thanks...but now, the code crashes with the same error on line 88:

Code: Select all


      t = GetTickCount_() 
      FreeMemory(*path) ;<<Here.
      *path = get_path(startx,starty,tox,toy,#width,#height,allowdiag,blockdiag) 

:(
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

SCRJ wrote:Thanks...but now, the code crashes with the same error on line 88:

Code: Select all


      t = GetTickCount_() 
      FreeMemory(*path) ;<<Here.
      *path = get_path(startx,starty,tox,toy,#width,#height,allowdiag,blockdiag) 

:(
I updated the example in the second post :)
SCRJ
User
User
Posts: 93
Joined: Sun Jan 15, 2006 1:36 pm

Post by SCRJ »

Now it works correctly!
Good job, man 8)
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

I optimized much of the code, now it is much much faster. The code is updated in the first post and the example is also updated.
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

Hi Heathen I suggest the ff:
-use binary heap - really fast even on very large maps.
-use arrays instead of linklist

Your code looks clean and easy to understand. :wink:

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

JCV wrote:Hi Heathen I suggest the ff:
-use binary heap - really fast even on very large maps.
-use arrays instead of linklist

Your code looks clean and easy to understand. :wink:
Thanks for the suggestions :) I will consider them for the next version.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

Updated to 1.0, added binary heaps and lots of optimizations. I also added procedures for loading and saving of paths, aside from that I added a procedure called nearest_node() which can be used for finding the nearest node in a precomputed path relative to an x and y position. This way, if the object strays off of the path for whatever reason, it can pathfind to the nearest node of the precomputed path.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Wow thats good stuff. THanks!
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

...
Last edited by Heathen on Fri Dec 28, 2012 10:21 pm, edited 1 time in total.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

...
Last edited by Heathen on Fri Dec 28, 2012 10:21 pm, edited 1 time in total.
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Great job !
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Post Reply