Devlog 8: The Black Bug & other Problems


What would game dev be without serious development problems? Debug is always going to be a major part of the process, nothing wrong with that. Unfortunately, development on Unearthed sure has had some hiccups and they go well beyond the typical coding problems I'd expect to see on a project. In this devlog, I'll take you through some of the hurdles Ben and I have had to jump over in order to get the project finished.

When we started work on Unearthed, the current GBStudio build was 2beta5. As I write this, we're up to 4.0, but we were already so far into development by the time 3.0 came out, we felt it wasn't feasible to port the game and all its code into a newer (better) version. As much as Ben and I would have loved to take advantage of all that GBS3+ offers, we would have had to more or less build the code from scratch, potentially adding a year or more on to the already long development timeline. So with that, we continued on and stuck with the now antiquated 2beta5. 

For the more veteran GB devs that are familiar with 2beta5, you may remember a little problem when a scene is copy pasted… and that is, every single event that references a self (being the actor itself), will say its set to self, but has actually been set to the player.

All looks well, but when you look a little closer, the actor has been set to the player!

What this means, is every time the Master Scene was copy pasted, I would need to go through all the actors On Init, On Update and On Interact scripts as well as the On Init of both the surface and underground scene and reset all instances of self back to the respective actor. Even if we set the instance of self to the actual actor in the Master Scene, the copy pasted scene would still produce the bug.

There were sometimes hundreds of these instances to correct in a single level, often obfuscated amongst long lists of events. If one was not fixed, the event would be directed towards the player rather than a rock or a fuel can or a resource or the fuel HUD or the empty mech actor or the optional collectible or the holes in the ground or the… you get the picture. It's added many many hours to development, its particularly tedious work and it is by far the most common bug to find when we have been play-testing the game to date! All because GBS 2beta5 sets the self to the player by mistake when copy pasting scenes. This has been a regular part of the process ever since we built the first Master Scene in the 2nd week of the jam. So when I suggested building master scenes to use as a template to create multiple levels in a game back in Devlog 4: The All-Important Master Scene, it was a good idea - at least theory... Thankfully, that bug is squashed in later versions of GBS!

Then there was the time I had to buy a new PC at one point. The project had become so large that I no longer had enough RAM to support it, causing GBS to crash when I attempted to save the project or ran a build. It was an inconsistent problem and difficult to determine what the cause was (I would regularly lose work for a period of time, not yet aware it was a RAM issue). I soon figured out that having other apps opened at the same time on my (rather old, I must admit) PC was increasing the frequency of these crashes, and that lead me to honing in on the RAM issue.

Suffice to say, I now save a project every few events I place in without even thinking as a direct result of this. It's become an automated habit which is a good thing, in the end.

But that's nothing compared to the Black Bug!

This is what PTSD looks like to me...

The Black Bug is what Ben and I call the event of a black screen that hard-locks the game. It usually occurs On Init of a scene but can also sometimes happen when the player interacts with an actor.

About a year into development (about 2.5 years ago as of writing this), when we had created about half of the planned content, all of a sudden levels and level select screens that were working just fine, would no longer load in, and we were left staring at a black screen indefinitely. Even levels from the jam that hadn't been touched since the jam were now hard-locking for some inexplicable reason. This was a serious problem. We could no longer fine tune mechanics, test level designs out or even debug. It simply stopped development in its tracks! 

After a week or so of pulling a considerable amount of hair off the top of our heads and becoming incredibly desperate, we figured out that putting tiny 0.037 second (about 2 frames) wait events in between long stretches of On Init code would free the hard lock up and all was well. 

Until it wasn't again… as we added more content, more levels, more master scenes, the black screens would return despite the added waits. So we added more waits and more, and then a few more until this band aid approach had become quite ridiculous.

At one point soon after this, we deleted a bunch of old and unused scenes, and low and behold, we found the levels that were hard-locking were loading in just fine! To this day we still don't know why this black bug pops up with any precision, but it seems to be related to how large the game is as it rears its ugly head when we hit around 114 to 118 banks of data.

At the very least, the more content we put in the game, the more this bug showed up. And as I said, that was a serious problem. Firstly, it was mentally exhausting waiting 5 minutes for GBS to run a build just to test a small change or to see if adding a wait event amongst the code would free me to continue working, only for the black bug to occur over and over again. And secondly, we weren't sure we could actually finish the project. We had half a game with no cutscenes and adding more scenes meant the black bug would be haunting us with gaining ferocity.

So what did we do? 

Well, this is the main reason Unearthed development has taken 3 years and not 1.5!  Ben has had to rewrite huge amounts of code so that it's all way more efficient, lowering the amount of data banks, reducing the amount of code in the On Inits of the levels while still carrying out the same functions and exorcising the black bug demon.

A huge overhaul on the custom scripts has occurred twice as a result of the black bug suffocating all progress and taken months to implement. Ben also created a number of HUB scenes that set up much of the upcoming level code from a single scene, rather than having huge amounts of  similar variable settings through all the On Inits of the levels, too (that was a particularly ingenious idea from Ben).

This bug was insane, I actually got so depressed trying to deal with it that I took a break from the project for 2 months straight. But in the end, thanks to Ben's patience and perseverance, the black bug has been kept at bay and we were able to complete the game in full!

When I'm play-testing the game and a level fades in from black, I still hold my breath from the trauma of it all. The fact is that GBS 2 beta 5 is just that, a beta. And no one knows how GBS will behave when projects get as large as Unearthed has become. I do wonder if we had just bitten the bullet when we first found the black bug and ported Unearthed to GBS 3, would it have been less work in the end? Maybe, Haha! But hey, now that Ben and I are at the finish line and we are readying ourselves to share something we are both very proud of, I can say it was all worth it in the end.

I certainly don't want to end this series talking about what went wrong, so in the next Devlog, I'll discuss the development process of Unearthed's artwork on Ben's behalf.

Happy Gaming!

Tom (Gumpy Function)

Get UNEARTHED

Buy Now$12.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.