How Bugs are Fixed


Hello everyone! Today I wanted to show you how I fixed two bugs in our game subLIMINAL.

The first issue that I wanted to show was a particularly irritating one. On the first level, once the player picked up a coffee mug, the ground inexplicably moved downwards a few units, causing the walls, chairs, tables, and everything else to appear as if it was floating.

https://imgur.com/9QQijjQ

This obviously was not wanted. My first idea as to why this was happening was some unwanted collisions between the mesh collider I had on the ground, and the colliders in the walls. To try and fix this I changed it to a very thin box collider.

Unfortunately this didn't work.

https://imgur.com/3CLtRxD

My second idea was to change the parent of the ground from the root of the scene, to the empty game object that we were using to organize all of our environment objects.

The position of an object depends on its parent as well as its position values. A cylinder with (20, 0, 0) as its local position value will have a global position of (20, 0, 10) if made a child of an object with a position of (0, 0, 10).

Fortunately this did work!

The second bug that I wanted to show was one I had already fixed, but I thought it was too interesting to not talk about. The player has text appear below the crosshair, which says what the player character is thinking at this moment. It works fine if you only display one string of text once, and never use it again, but once you use it again undesirable things like this happen.

This is because of the specific way that I implemented the text appearing and fading out, and is actually two issues.

The first is easily fixed, the text's alpha value is slowly reduced from 255 to 0, making it slowly become transparent, but it isn't reset to fully opacity once the text is removed, causing any new text to start out as transparent already. This can easily be solved by just setting the alpha to 255.

The second issue wasn't so easily fixed. I had to make a way for the coroutine to either, not run when another instance was running, or to stop all other instances once a new one began. While the latter was preferable, the former turned out to be the easiest and simplest one to implement.

By adding a new private global variable that I called isTextWriting, and setting it to false I was able to add in an if statement before the text was changed, checking if isTextWriting was false. If it was, I set it to true, then ran the coroutine normally, setting it back to false when the coroutine was over. If it was true however, the coroutine would skip over everything in it, quickly ending itself.

And with that, level one was running a lot smoother mechanics wise!

Files

SUBLIMINAL_BETABUILD.zip 169 MB
Jun 29, 2023

Get subLIMINAL

Leave a comment

Log in with itch.io to leave a comment.