Production II Blog | "Fixing" the Tier System
In my last blog post, I described the current state of Snowball Showdown's tier system, which unfortunately did not work due to unknown issues. Since then, I have made immense progress on it, finding the main error, fixing it, and fully implementing the tier system into the game. Unfortunately, we don't have much use for it right now (as we only have a few items in-game and want to emphasize their randomness, rather than their power levels), but in future builds of Snowball Showdown, this will likely prove beneficial.
Additionally, we received word from Oculus regarding our application to develop Snowball Showdown for the Oculus Quest. Unfortunately, they declined our request. Though we were definitely disheartened to hear this news, we have yet to give up on Snowball Showdown, as we still plan to release on the Oculus store.
"Fixing" the Tier System:
On April 21, I spent several hours examining the code for our tier list in order to uncover why it was causing Unity to crash. I found the cause surprisingly quickly. It was a "while" loop I'd put into the code to make sure that whenever an item went into the Snowblower and triggered the condition where it would exchange the item from the current "line" with another, it wouldn't create an error by selecting a "line" in which the current tier did not exist. However, the loop also checked to keep the Snowblower from outputting the same item a second time, and due to poor syntax on my part, whenever the loop triggered, it repeated endlessly, eventually creating a stack overflow error.
I fixed this issue immediately, and from there, I set about bettering the script as a whole. I implemented several new items into the tier list (dynamite, acorn, stick, and rubber duck), with the dynamite and the stick added new items to the grenade's and knife's item lines. Because of this, I could now more efficiently test the tier system to make sure that items could output their upgraded forms, downgraded forms, or travel to a new "line" entirely. This required me to fix the code up a bit more due to other minor syntax issues, but the system worked properly in the end.
I then decided to close the loop by allowing any generated items to pass their values into a snowball during the combination phase. In doing so, I would make it so that if players passed a combined snowball into the Snowblower, the next emitted item would be based on the passed-in one. Before I went into the script that allowed the player to combine snowballs with other objects, however, I decided to commit my current progress. This way, if the combine script caused any in-game issues (as the script currently breaks at the drop of a hat), the team would be able to roll back to the commit before I made my last changes, saving the build while keeping the basic tier system intact.
This turned out to be the proper course of action, as my changes to the combine script did have disastrous consequences. Unfortunately, due to a breakdown of communication, I did not realize that this was the case at first, and the programmers had to scrounge the code in an effort to fix a variety of bugs. Had I been more open about my changes, we could have avoided this problem entirely, so I have to take responsibility for it. In the future, I plan to communicate more when making any alterations to the game, especially when they involve potentially volatile scripts that I cannot currently test.