top of page
  • Writer's pictureEvan McGrath

Evan's Dev Blog 1/27 - A Week of Errors

Hello everyone! Apologies for the delayed post. This weekend was filled with a number of unforeseen circumstances in "Random Encounter" that took up most of my attention. I wanted to have the game up and running on Android this weekend and while I was successful, I discovered some serious flaws in my code that could freeze the game under specific conditions.

First, I figured I should put the Effect system to the test and create some new spells. I figured a status condition would be the best place to start, so I begun development on a spell that would inflict paralysis. While affected, the target's speed would be cut by 75%, and each time the target attempts to move, they have a chance of doing nothing. While all the code was easy to write and functioned in my brief tests, the game would completely freeze up upon the removal of the paralysis effect. The nature of the freeze was very characteristic of an infinitely looping coroutine, so I figured I must have broken something in the turn order or the sequencer. I spent many hours placing debug logs to try and discover the cause of the freeze, but nothing seemed to work. All components of the Effect system worked in my brief test, so clearly nothing was wrong there.

As it turns out, the Effect itself was to blame for the problem, but not in the way I expected. When a turn ends, the game checks to see if an Effect should remain, removing it if necessary and when an Effect is removed, its on remove event is called. This setup in theory should not cause any problems. However, the paralysis effect called for its removal during the on remove event. This oversight caused an infinite loop where it would keep firing the removal event from itself. Though the issue was infinite recursion as expected, it did not occur in the place I thought. This issue brought to my attention that I really need to get editor tools in place for "Random Encounter" to prevent certain functions from being used in unintended ways.

This past week, I also joined a new project! MassDiGI recently acquired the rights to a serious game for mobile, and it is my job to update it to a newer version of Unity, and adjust the game to work well on modern devices. The project originally started in Unity 5, so updating all the way to Unity 2019 would be no easy task. Thankfully, the only issue with the update was an out of date ad package. With that issue squared away, it came time to build. My first couple of builds would not open, which I figured at first must be caused by platform specific code, but in reality was caused by a bad AndroidManifest file. With that file removed, the game functioned fine on platform! I expect to have the game up on the Google Play store within two months once it is thoroughly tested enough and any issues are fixed.

Next week I will definitely have a less ranty blog post up, hopefully on the right day this time!

Until Saturday!

bottom of page