I have started drawing idle and moving animations for Camp Guards. This is one of the most important jobs the player’s army units can do, so I plan for them to get a lot of bonus experience. The sprites should show if the guard is mounted on a horse or a Pegasus. I also decided recently that rather than griffins or wyverns, Eagles of Manwë would be a second flying mount. Maybe I will create a second type of walking mounts later…





On the backend of things, I have found a solution to a longstanding issue that I had with my events management system. The code was hard to understand because my events used nested switch statements to change behavior dependent on game state and substate. It is recommended on the internet (Stack Overflow) not to use nested switches, and now I understand why! Deep indentations, confusing function behavior, multiple behaviors depending on game states…
I knew there had to be a better way to deal with states, but I did now know how! My events where incredibly spaghettified, and working on it in my usual way made it worse. This would demoralize me, discouraging me from trying to change anything, stalling development of my event system.
I found a solution in the book “Expert C Programming”: a Finite State Machine (FSM). in an FSM, different code is executed depending on the input and current machine state. I just needed to put my function (referred to as actions) inside an array and call them using the game state as an index. Simple, and frankly brilliant! Now all my actions do basically one thing, and my event receivers are much simpler to understand, only calling an action depending on game state.