While I wait for things to come together for future voxel experiments, on with some work on path finding on my RTS project.
I read up on the A* method, but luckily there is a built in function in GLBasic that performs the algorithm.However there are some limits to what it can provide….For one, it doesn't use any form of bounding boxes so my objects need to have their path offset to compensate for that. Secondly, it creates a solution array of every single position of movement.So my current task, making it usable and functional.First I started off by reducing the move list, so only distinct positions are saved.Then a scan through the list and a few collision checks to offset the path properly. This is almost working now, but still some issues.I had put in diagonal movement and movement that skips a path finding if the direction is unobscured, but have those disable while I worked on some issues that popped up.The Demo here.So, here's a demo with an updated map editor(still some more to add) and also the test mode for the game.There are two selectable units on the screen, no multi selection yet, or movement through the mini-map isn't included yet. You'll notice the path finding isn't quite right in some parts of the map, do to thin collision areas and the algorithm is not quite right yet.Hopefully I'll get this wrapped up soon. Although I may end up writing out the A* algo just so I can directly manipulate it as the built-in one cause brief lag spikes.
Ooo A*! One of my favorite topics. You might find this interesting.
If you do a search on 'Hierarchical A*' you'll get a lot more info.I believe I read something on HAA, but that was a pretty nice PDF, gave me some ideas for making a path finding algo of my own…or possible alternative ideas.