Architecture and Testing Scenes


Hello there,

It has been quite a bit of time since I last posted anything. I would like to start with why I suddenly decided to write this entry - my year based subscription to Adobe Illustrator is about to expire. In the distant path I gravitated towards illustrator and its vectors because it made more sense to me to think of my art in terms of lines and fills rather than pixels on the screen. Since I have no intention to renew, I wanted to make any final revisions to my characters before it expired.

Why? For as long as I can remember Adobe has been a company I have not had a high opinion of, but it felt as though I could only make art by tracing my low quality pencil drawings and endlessly revising them or by taking pieces of other older drawings and copying them and adjusting them. In the last year or two I have been allocating time every day to draw with pencil and paper and have rarely looked at Illustrator, only renewing my subscription last year so I could make adjustments to Lords of Illic. I like the few pieces I updated or added in the last year, but I feel ready to move on from that process. I also feel like Adobe has crossed a line and I can’t even support them begrudgingly. So before my subscription expires I have updated the banner with Emilia’s new character art. It is part of the journey of letting go of this over five year project and freeing myself to work on something new. In this blog entry I would like to explore what I have been working on and how it will fix some big lingering regrets about Lords of Illic.

So what have I been working on? I had a great idea or perhaps it is better to say that I have noticed an obvious thing that Lords of Illic is missing. That is a testing scene. Back when I was studying my TAFE game programming degree at AIE, I had two major projects. In both of those projects the first thing I created was a scene to test parts of my games in isolation. You get a nice fast feedback cycle, press play, test, stop, refine. Lords of Illic does have automated testing to ensure that code works as intended, but a game in Unity is a lot more than just code. There is still a lot of configuration of prefabs and other assets that needs to be tested. In the past I avoided making maps because while the way I made maps may have been clever in terms of code, it wasn’t a good experience for a game designer. In a similar way without a testing scene that allows me to get characters and abilities onto the board as fast as possible, it makes it very laborious to test visual effects, sound effects, animations and so on. 

My testing scene

It is not that exciting by design

When I was working on my testing scene I noticed some UI elements were displaying over the top of tooltips. It was a simple fix to ensure that the tooltip was always the last child. It was then that I noticed it. When I changed my tooltip class it had to re-compile the entire project. I use a lot of assembly definitions to separate code from each other to prevent exactly this from happening. Using assembly definitions like this is important not just because it is frustrating but because all those extra seconds waiting to complete the domain add up. So why was this the case? It was naturally because the Tooltips were in an assembly definition called “Generic UI” that almost all code in Illic references. The assembly is used so much because it contains an interface that allows different objects in the game to be displayed in the UI. The tooltip class however was just the tip of the iceberg. Within the definition there was tweening UI, how generic UI elements are displayed and an input interface.

I took a moment to take stock of the situation. Why was it like this?

Because when I was trying to fix the UI code there were bigger fish to fry. 

Because Illic is too complicated for me to know where everything is.

Because for a lot of this project I didn’t really know better. 

Whatever excuses I came up with I couldn’t rest until I cleaned out these base dependencies. Moving the UI classes was easy. Embarrassingly easy. Input was a bit tricker. The extra level of difficulty is quite understandable. The main reason I ended up in refactoring hell for two years on this project was because of poor input handling. Over those years as I learnt to be a software engineer rather than a hobbyist programmer, I began to realise how important it was to corral input into carefully defined interfaces. Lords of Illic resisted this. I like to believe my code back then was better than spaghetti. Maybe it wasn’t. Either way it was a tough fight to get everything in order. Yet the interface for my input manager was still something every class could see. Maybe this was fine. It was just an interface, it wouldn’t change often and it gave access to my classes to input if need be. Except of course as soon as we know about input testing it becomes harder. It becomes harder to reuse components. It had been easy enough to make a fake input manager, and easy enough to test with it. But it was still extra effort, it still slowed me down, it still made me want to write tests less. Besides Unity’s inspector makes it so easy to have a class which invokes an event on a button press. And it is so easy to drag a function into that event. I could feel it would be worthwhile (even if only because I wouldn’t think about it at 3am in the morning).

I tried a number of things, which didn’t work and got unreasonably upset. It ruined a nice evening out with my family (I personally felt terrible eating lovely Thai food, but thankfully I didn’t let my mood spill out and ruin it for anyone else). After a night of letting it stew I figured out the solution. I removed some unnecessary inheritance, did a few clever tricks and voila only one assembly in Lords of Illic needed a reference to an input manager. (Note my input manager is not a singleton, I provide references by dependency injection). Which brings me to the best part of this story. In the process of sorting this out, I had to disconnect the GameBoard class from input, which in turn required me to rework how mouse-over selections are performed. The new code made it much easier to change how these tile selections work. Now you click on a tile to select it and move the camera to focus on the tile. Which allows you to play the larger maps only with the mouse. Which in turn means Lords of Illic works on android without any special code. 

Eons ago I had Lords of Illic on the play store for free. Since then Google has really tightened up what it will host on the store in an effort to remove less serious apps which don’t generate money from the store. It felt bad to see Illic disappear from the store and see more and more obstacles to its return. These were not just the additional requirements for the play store, but also how the android specific code could not keep up with the rest of Lords of Illic.It feels fantastic to know I could bring it back to the store. I don’t think it worth the effort of privacy policies and business and so on, but I succeeded on the level I really care about. My code is generic enough to work on three very different input mediums. It also fixes the issue I had with the input where the mouse and keyboard would fight for selections. Which created a glitch where inputs were eaten when you switched between the two. A big problem which I had given up fixing.

There are even more architectural changes which I have fixed in the months since I started on this road. I find these uninteresting, as they are all artifacts of how much I have improved since I started the project over four years ago. I am not a hundred percent happy with the input at the moment, so it may be a month or more before I post the next patch and quite possibly the last patch. (Somehow I feel like it really won’t be). The one I know I want to add are persistent visual effects for buffs and debuffs on units. I may also allow combat without opening the full battle UI and quite add sound effects. Either way all I can do is to work until I feel done, until I am ready to let go. I am hoping this final leg of the journey will be the best part of working on the game. Whatever the case it is an important part of my journey as a creative. 

So until next time, I hope you enjoy the game.

Get Lords of Illic

Leave a comment

Log in with itch.io to leave a comment.