Submissions from 2017-10-31 to 2017-11-01 (1 total)

As I touched on in my last post, the movement ability was a bit overzealous in allowing the player to move further than he logically should. Ideally, the 'TileMask' for some things (like movement) shouldn't be static 2D arrays representing valid tiles, but more intelligent ones based what is reachable within a certain distance. If this sounds like a flood-fill to you, you would be ... close! But in order to be able to reconstruct the path, I need a little bit more info. Enter: Dijkstra's algorithm. It's like a breadth first search that remembers where every tile came from!

In order to do this, I refactored the TileMask into an abstract class, and derived a special version for the Dijkstra mask. The original mask that is designed in the inspector on a grid was refactored as another derived class. The Ability* objects use the common interface, and don't care about how the valid tiles are generated. Neat!

Here's a pic of the Dijkstra mask with a distance of 4 (you can get quite far using diagonals!):


The previous movement mask would have allowed you to go past the wall to the right of the player, since it didn't track movement cost.

I haven't actually implemented the logic to reconstruct the path from the Dijkstra grid, and give it to the player to follow, but that will have to wait for another day.