Complex pathfinding
The limitations on movement in the demo are as follows
Mob can move forward or backward
Mob can only turn by 45 degrees when also making a move in that direction
Mob can't clip corners when moving diagonal
Originally I was going to use a tank graphic but then I remembered I can't draw and just went with an arrow instead. Just click on the map to move to that tile.
http://www.byond.com/developer/Theodis/ ComplexPathfindingDemo
And if you cut out the comments the amount of code to make that work is actually pretty small for quite an impressive effect.
This library has many potential applications and the demo provided with the library just shows the basics of how to use it. Since I haven't really used it myself I don't have too many ideas for practical applications in BYOND that people might need it for. So I'm open to suggestions for demo ideas if people are having specific pathfinding issues they need an example of a solution for.
[Edit] And if you want to have more fun with you can easily control the possible movement since I did it on a case by case basis in the AdjacentNodes proc. If you want to see it pathfind without moving straight forward just comment out the line that tests and adds nodes for forward. Or if you want to disable turning while moving backwards, or just left turns it's real easy to do with the code and interesting to see how it comes up with paths without certain kinds of movement.
Posted by Theodis on Sunday, February 08, 2009 08:45PM
- 9 comments
(link)
/
(Edited on Sunday, February 08, 2009 08:55PM)

#2 Theodis:
Ahh neat just barely noticed this box here! Anyway yeah I could package it up as a library. But I think a stack works more efficiently when implemented with a normal list rather than a linked one.
Sunday, June 07, 2009 09:09AM
#1 IainPeregrine:
Ahoy Theodis. I use a linked list structure you posted on the forums ages ago (ID:347289). I've even edited my BYOND directory so that it shows up as a library (Theodis.Queue). Perhaps you could release it as such, so that others can use it, too? You can find it, in the form I use it, here.
I took the liberty of adding a Stack() proc so that the same linked list object can be used for both stacking and queuing. Thanks.
Thursday, June 04, 2009 03:03AM