Making Maps in Illic


Today I think is the perfect time to start to talk about how I make maps in Lords of Illic. I had a very optimistic issue on my issue board about making a player map making tool that I deleted recently. It is all editor tools at the moment and since I am ramping down Illic's development it will probably stay that way. I haven't only been deleting issues though. I have also been adding them - one such issue was to improve the process for making maps. The biggest thing missing from Illic at the moment is maps. Oh there are a decent number of drills in the game to teach mechanics but little in the way of proper maps. Since I never know where to start I got my brother to make some maps for me. He already had helped design most of the chapter four maps by sketching them for me on paper. Since it would be more efficient to get him to actually place the tiles himself I convinced him to work in Unity and make them.

I quickly realised a problem, but before that let’s run through how making maps works in Illic. Illic started 2d and thus used Unity's tile map editor to make tiles. When I moved to 3d (a topic worth a blog post or two) I still wanted to use the same tile editing setup - manually stacking combining tiles into a map is error prone. Initially I just spawned the 2d map and spawned prefabs which matched the names of the tiles. Since I wanted the flexibility of being able to change the appearance of the tilesets, I went a step further. In hindsight I was using a factory pattern but I didn’t realise it at the time. The idea of the factory pattern is to have a class in which you can request an object to be constructed without having to know all the details of the object. I made my tile factory as a scriptable object called a tileset. The class matches a string to a prefab and creates it for the game board. That sorted out the differences between basic tile types, but not variations between them. To do that I added a number to the name of tiles in 2d and used that to select a different prefab in the list. So if the tile in the tile map was empty3 it would map to the 4th element of the empty tile list, which is a tile with flowers in it as it happens. With this it was easy to make a desert tileset and a snow tileset for Illic. Even better swapping between types is just a matter of swapping the tileset object in the prefab. Finally I would read the position of sprites I placed on the 2d tilemap to figure out what tile they started in.


I still wasn't happy though. I was still making a 2d tilemap at the start of each level. I knew I could do better. So my next step was to create some editor-only functions. My idea was simple - read out every tile in the board and store it in a scriptable object. The hitch was I couldn't do the processing of the start positions I needed in edit mode. This is when I figured out a neat little trick. You can start playmode from a script. I used this to make a button that on one press started playmode (if it wasn’t enabled already) and the next click created the prefab, processed it and set the results in a scriptable object. As an added bonus I created the scriptable object automatically if it didn’t already exist. What amazing performance increase did I see? Well I didn't see any, but it made me feel better. What I didn’t realise at the time (which was when I was still studying at AIE) was this made it much easier to make tests of my levels as I could load the scriptable objects a lot easier than using the prefabs.

In the intervening years, I noticed it was difficult to tell which character was which. I added in an editor function which set the display of the units on the map to be what their icon would be in the game. I also had it set the name of the objects in the hierarchy. This made me happy enough. It was only when I got my brother to actually put in data from the editor I realised it.


I had decided to centralise where the data was stored into the map information script. I had a list of the player, enemy and neutral teams. Which means you have to sort through these lists to assign stats, positions and more. So when I got my brother to make a map within Unity he didn’t want to fiddle with it. It was quite difficult to tell which character was where… or even what character was which. Naturally I didn’t want to let this stand so I got to work.

My first step was to add in a public string called name. It caused the headers to display the actual character’s name in the list, instead of element 0 and so on. Next I added in a text element which displayed the positions of the characters in the map. When I went to refine the map he had started it was clear how much easier it was.


When I look back at Illic I realise I had always felt making maps was too much effort. I had not fully examined my workflow and the inefficiencies. If you have to switch between different objects because you can’t tell two things apart, of course it is going to feel like a lot of effort to make maps. If I was going to go back and rework the system I would probably set it up so the stats were on scripts attached to the sprites representing units in the prefabs. Watching my brother for a moment made it clear that was how he expected it to be. It is not viable for me to change at this point - I would have to update every single map in the game and well… I am trying to finish Lords of Illic. It is a great reminder that even when it comes to making editor tools user functionality is key. I wonder how many more maps I would have made if it had been a bit easier to do so.

Until next time.

Get Lords of Illic

Leave a comment

Log in with itch.io to leave a comment.