Hey! I recently wrote a blog post about the level building workflow in my current game and I thought it could also help others who want to build their own worlds with tilemaps.
I’m using Tiled as the tool to create the tilemaps and then import them in the UE4 as the basic structure of a level. This is how one of my tilemaps looks like:
http://roll-playing-game.com/blog/wp-content/uploads/2015/03/Example-Tilemap.png
For my game, the tilemap describes the complete floor of the level, as well as the position of point orbs (yellow spheres), standard floor traps (red) etc. The first draft of a level only takes a few minutes to build (or rather: paint). Tiled also supports multiple tilemap layers.
The level tilemap is saved as a .json file by Tiled, which I then import into UE4 with a few lines of C++. I created a Tilemap class that extends AActor and handles the import using the Json module. I posted about this about a year ago in the forums: Read data from File - Some kind of dynamic level - Blueprint - Unreal Engine Forums
In the Unreal Editor, I have a blueprint based on the Tilemap C++ class that calls ReadTilemapFile() in its Construction Script and then uses the information that was loaded into the Tiles Array to create the level. The Tiles Array is an array of a custom struct that contains information about a specific tile, e.g. if it’s a floor tile or a floor trap. The C++ class also calculates the floor tile type based on its surrounding tiles (floor, inner corner wall, outer corner wall, …). I have multiple Instanced Static Mesh (ISM) components on the Tilemap blueprint for each tile type. When parsing the Tiles Array, instances are added to the according components. So each time I change the tilemap in Tiled and save the json file, I just need to run the Contruction Script of the Tilemap blueprint to see the changes in the UE4 editor.
Not all tile types can be represented by Instanced Static Mesh components, in my case for example yellow orb particles that are attracted and collected by the ball. For these, only their initial locations are stored during the Construction Script and they are spawned on Begin Play using the stored locations. I still have an ISM component for them on the tilemap, but only as static “gizmo”-like representations for me to be able to see their locations while editing the map.
This is the level section from the Tiled tilemap seen above. Also includes gameplay objects manually placed in the editor after parsing the tilemap such as Laser Beams and Floor Texts:
http://roll-playing-game.com/blog/wp-content/uploads/2015/03/Example-Loaded-Tilemap.png
Gameplay objects with properties that should be customizable in the editor (i.e. most of them) and those that are not positioned inside the 2D grid are obviously not loaded with the tilemap but manually placed. As I have to edit them one by one anyway (e.g. to adjust the projectile speed of a turret), it’s not a problem to add them manually to the level in the editor and not in the tilemap.
If you have questions, ask away!