It took a day to merge the prototype game with the level from the map editor. This was mainly due to generating the navigation data. As I’ve mentioned before, this data is a series of connected rectangles, and I had code to generate it from a grid of tiles. It’s an interesting problem, and not as simple as it sounds because ideally you want to minimise the number of rectangles that comes out.

But the level is not a grid of tiles, though it may look that way. It’s a hierarchy of nodes of different types; some nodes containing a list of tiles in several layers.

The trap I had fallen into was making the algorithm much more dependent on the data structure than it needed to be. For which I blame OO with its easy access to members. So a refactor was needed.

There’s a long way to go before this is a proper game. But making a level in the editor and walking around it is a nice milestone to reach.