My standard license: Free for any use
My standard license: Free for any use
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
nice, thanks, ill probably make some modifications and post them here
EDIT: as promised:
https://github.com/JernejL/astar
added:
colored cubes, actual path finding that finds the shortest path between the nodes, and some fun stuff
EDIT:
I modified some of the algorythm internals now, for start - i replaced the sorted Tlistbox with a dynamic array instead, and instead of sorting the array i just find the lowest item in the array - which is MUCH faster than sorting the whole list for every added item no matter which sorting algorythm you use, the deletion of item from array is also optimized with using memory MOVE routine.
and i added a cleanup menu button to clear the path searching results.
i also commented most of the new code i added so it should be easy to understand.
Last edited by JernejL; 21-05-2018 at 07:04 AM.
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
Nice one Delpfi
Thanks for posting
The views expressed on this programme are bloody good ones. - Fred Dagg
Some more things that can be added
1. Find a way to make it a class that can easily be included in any game using squares. I have sort of done this in my Run-A-War game but every time I want to reuse the Pathfinding I am finding I need to make modifications.
2. Make weighted cells - so be able to add a river that costs three movement points to cross, or mountains, forests etc.
3. Optimise optimise optimise
Glad to see someone found the tutorial useful anyway
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
I thought of making it a library with some simple callbacks, so you would call it and it would call your callback parameter of your routine that would just call you back for every cube that it wants to search and you would tell it if it is passable and A* weight... this would be very simple to use.
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
Make sure that it is flexiable in its walking and passing schema. For example don't limit it to X, Y int coords. X, Y, Z Singles would be much better, with a step size passed back for each direction. That way if you have a "Warp" from one loc to another you can let the engine know about it.
- Jeremy
http://www.eonclash.com/
Added: fallback case: finds closest point to the goal if there is no direct path!
Ok, i separated the path finding from the form unit, it works like i described - using callbacks, here is the new download:
http://www.gtatools.com/temp/astar1.rar
If you need older one for any reasons it is here:
http://www.gtatools.com/temp/astar1_old.rar
EDIT:
jdarling:
this is now all possible what you described, the map area field is dynamic, and you can also specify it to wrap worlds (it cannot go to negative coords, you need to enlarge the field you give to pathfinder and compensate for it in the callback routines)
im not sure if you could make warp areas, it could be done, just give the cube at the warp entrance much bigger priority if the warp exit is closer..
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
How hard will it be to add ‘ground priorities’, meaning:
road penalty = 0.
dirt path penalty = 1.
Up hill penalty = 5
And so on.
[size=9px]BEGIN GEEK CODE BLOCK
<br />d s-- : a24 GB GCS GTW GE C++ P L+ W++ N+ K- w++++ M- PS+ PE+ Y- t+ 5+++ X+ R*
<br />tv b+ DI++ D+ e++ h+ G-
<br />END GEEK CODE BLOCK[/size]
<br />Create your own GeekCode block at: <a href="">...</a>
very easy.. just tell the pathfinder block cost in the callback.Originally Posted by tanffn
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
Now this is embarrasing, i forgot to include actual astar.pas into the rar file, i added it now ops:
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
Bookmarks