Astar
Monkey Forums/Monkey Code/Astar
| ||
Ported the excellent astar Pathfind class originally from Curtastic. Here is a simple test app |
| ||
Nice porting. I would add this for newbee users and 'new modules' (I follow the 'blitzmax' way - modules folder...) 1. create a NEW folder gw in the monkey's modules folder. 2. create in gw a new folder astar: this is the name of the 'module' 3. save the module source code in gw/astar as 'astar.monkey' You should get something like this in the the monkey's module structure C:\monkey \modules \gw \astar astar.monkey \mojo \monkey \trans |
| ||
Just implemented this for something, so thank you very much GW_ :) |
| ||
Perfect timing! I was just hunting for an implementation of A* in Monkey before I got my hands dirty rolling my own. Now I just need to adapt it to my needs. :) |
| ||
Thanks for the code! Here's a simplified version I created for a roguelike game I'm working on. It requires map movement data as a 1-dimensional integer array (that simulates a 2d grid), where >=1 is blocked, 0=not blocked. It makes use of object- -pooling, -referencing and -reuse so this version should be significantly faster on some platforms, though I've not tested it. It's also instance-based, so each creature/vehicle in your map could have its own pathfinding system with different parameters (that's how I'm using it, anyway). [Left-click] to toggle a grid cell blocked/unblocked. [Space] to block 100 random cells. astarint.monkey astarinttest.monkey EDIT: 29-JUL-12: fixed a bug in astarint.monkey |