Weekly Update – June 4, 2021

This week was mostly consumed by writing unit tests. The goal of completing the detailed feature list for Release 3 was missed.

  • Took a deep dive into unit testing. 20 months into development of Legend, the first unit test was written. This week I wrote about 30 unit tests, with each test performing anywhere from 1 to 10 assertions. The unit test setup fully loads a level first. This is an unconventional way to do unit testing, but is preferable in my case because there are so many interdependencies and most of the bugs occur due to some sequence of prior events (and therefore wouldn’t manifest when testing a class in isolation). The process of creating the unit tests led to some refactoring and a few new methods that will likely only be used for testing purposes, for example getting a count on a private collection. I also discovered some bugs right out of the gate. 
  • Overhauled the message log. One of the planned Release 3 features is a better message log, both from an end-user and a code quality standpoint. Instead of having explicit message log writes throughout the code, game events are raised, and an event handler determines 1) is the player aware of the event and 2) does the player care about the event. When the answer to both of these questions is yes, an event is generated to log a message. The message log UI controller listens for these events and displays new messages in the log. I also wrote a message formatter to determine the appropriate subject and object to display in the message (depending on whether the message refers to the player or another actor or object). For some messages, the message formatter also determines the appropriate verb, for example “am” for first-person, “are” for second-person, and “is” for third-person.
  • Kept using Rider. I’m totally sold on Rider at this point. It took some getting used to, but I’m getting a ton of value out of it now that I’ve gained some proficiency with it. The code recommendations have helped tidy up my code. The refactoring, debugging, testing capabilities have greatly improved my productivity.

I’m 75% through writing the initial set of unit tests. Next week, I’ll finish these and get back to finalizing the detailed feature list for Release 3. 





Leave a Reply

Your email address will not be published. Required fields are marked *