top of page

Ethica Divided

Ethica Divided is a turn-based strategy set in a fantasy world, where an idle leader has allowed their kingdom to be overrun by goblins. This was a project undertaken for my High Level Game Development module in second year and marks my first ever solo project in Unity.

Ethica Divided marks the proper starting point in my career. Up until this project, I had only worked on two “learning the ropes” projects and one game jam. From these, I noticed the games I had made had key elements of AI to them. I then took it upon myself to attempt to create a turn-based strategy that was inspired by the combat system used in Heroes of Might and Magic.

Pathfinding was the biggest learning point in the project. Having had some experience with a grid-based game with my tower defence I was naive to think it would be easy to implement. I laid out the grid and started adding units to it that simply moved to a point on the grid. Only further during development where I started to add more units did I see the problem with this system. If units were trapped in by other units, they shouldn’t have been able to move however, units had no concept of being blocked so pushed passed other units displacing them. Upon doing some research I learnt about Unity NavMesh, and how they could be used to create a ‘walkable’ area. After having spent some time experimenting with this, I quickly found other flaws in my setup. As there was no path as such units freely took any path they wanted, which often meant walking off the grid or worse off the nav mesh. Here is where I learnt the hard way, that using proper pathfinding is the best solution and that it should be done earlier in development. An A* Pathfinding algorithm was then created and used to make a grid of nodes that defined world position, gird position and whether it was walkable. Using the algorithm, the shortest path could then be calculated providing the desired paths and correctly detecting blocked units.

As mentioned, there was a gap between creating the first grid movement and implementing A*. This time was heavily spent on creating a combat system. An enemy opponent was simulated, by having AI units have a small state machine that dictated what their action would be. These states were Seek, Attack, Flee and Dead. If a unit was in the seeking state (which all units started in), their goal was to find a target and get close to it. Once within range they would move into attack state where they would hit their target. They were able to exit this state by either killing their target or going out of range where they would return to the Seek state. No matter what state the target was currently in, if they had low health, they would move into the flee state. If they had no health, they would go into the dead state. Flee state allowed the unit to pick a grid space far from it’s target so that it wouldn’t get hit. The dead state did nothing apart from remove itself from the turn order.

Being my first solo project in Unity, I reserved some time to explore adding in some polish to the game so that it wasn’t just capsule fighting on a grid. These polishes included assets, animations, and sounds. Two asset packs were used, one for the humans and one for the goblins. These were swapped in and set up as new prefabs for both teams. A moderate amount of time was spent learning the animator and learning how to get animations to play that matched what was happening. At the time a weaker area of mine, as it is clear a few animations didn’t quite work the way I wanted with wrong rotations. Once something was functional, the final touches were adding the sound effects. Yet another learning point for me, as most sounds just worked as they were one shot sounds, but the biggest pain I had was setting up the footstep sounds. This was quite a challenge, as both unit types had varying ranges, meaning they could run different lengths making it hard for a single sound. Being quite against having various length footstep sounds to match correct distances, I had the idea to make one looping sound that toggled on and off. This did the job well enough, and one small tweak in pitch allowed a varied and different sound play for goblins who would have been lighter on their feet and take quicker steps.

bottom of page