Wednesday, December 27, 2017

Pathfinding

So... I've already done Dijkstra's pathfinding algorithm for other things, so it wasn't (supposed) to be a huge deal to port it over to the game, but like many things, plans didn't really survive contact with the enemy.

Basically, while that kind of pathfinding works nicely for small grids, when you're dealing with 500x500 boards, you're not going to be practically able to pathfind from one side to the other.  So I wrote a version to take a subset of the board and pathfind that, with the idea of stringing them together or using a node-like approach.

However, this turned out to be somewhat impractical to test in the game itself, even in the very simple form it is now, so I had to build a stub program to debug the pathfinding object:





Anyway, I think I've tracked down the major error (which had to do with expecting the coordinates passed in manner they weren't.)  I'm probably going to do a bit more research before I decide on a larger solution to the matter, though.