by Firedroid

As our development progresses we’re closer and closer to a version that supports puzzles and can be played as a game (although it’ll be a work-in-progress). So we’ve had to think about how we’re making those puzzles and how to feed them into our game. Now we already stumbled upon the Tiled Map Editor, which is a free and opensource mapping tool for games that are based on tilemaps. We filed it away as a great tool for later use, while we focused on the basic elements of the game.

Recently that core has become complete enough to warrant a second visit to Tiled and see how we could use it to build our puzzles. We made a tileset and set to work!

First up is handling rotation. The tileset has four different versions for straight lines and corners, as they can go up, down, right or left. We only have one 3d model for such things, so they needed to be mapped to the tileset. We thought about building fancy and complicated solutions but in the end we simply used an array with objects that contain information about the tile. Each tile in the tileset is coupled with such an object, which holds information like rotation, direction, height, etc, everything the engine needs.

Tiled outputs an XML file containing the information about the map size, layers and tiles in it and after fiddling with some Unity scripts people wrote we decided to just use C#’s native XML functions. In the end this works really neat and we’re very happy with Tiled as our tool for building levels since it’s a good map editor for our needs.