v0.0.2 Pausing Dilemma


The Problem:

Pausing in video games seems like a simple mechanic, but in reality there can be a lot of things going on behind the scenes to freeze almost every gameplay element. I've never implemented a pause mechanic during my time as a game dev, so I was quite intimidated by it. Luckily there were a lot of online resources to point me towards an easy to use function inside of Unreal. Unfortunately, I still had the problem of figuring out where that pause function needs to go and how to best utilize it, as well as any bugs this may cause.

The Solution:

Originally I only had the pause menu display without actually pausing the game, so I had somewhere to start from. The player is able to press the pause button to bring up the menu, so that's where I would need to call the pause function, right? No. I would need the pausing functionality to be accessed in other classes or events. I do have a class already made that would be perfect to put the pause function in, the Game Instance! I would've liked to put it in a game manager of sorts, but we didn't have one at the time. I gave the game instance a bool to check if the game is paused to make sure the menu can't be opened several times. Once I implemented it, I thought it was ready to go, and it really seemed like it too. I encountered a strange bug when pausing, closing the menu, and pausing again, it would take a bit longer to open the menu each time. This was to do with how I was handling the displaying of the menu, so I had to destroy and create the menu each time it was opened instead of hiding and showing it. After that, I also noticed the countdown timer would keep going down even though the game was paused. So to fix that bug I added a check if the game was paused in that class to not update the timer. Finally, the pausing functionality is fully implemented and can be used wherever we need it to be without any conflict between classes.

Leave a comment

Log in with itch.io to leave a comment.