Hello and welcome back to another Blightmare dev blog!  This past week, I spent some time away from the editor and focused on some of the neglected parts of the game itself.  In particular, I took at stab at the main menu and pause menu.  These menus are almost the same, and we wanted them to feel like they were part of the game instead of a bunch of buttons to click.  This means we built essentially a level that is the menu.  When we're in the main menu, things are easy because the main menu is the only thing going on, but when we're in the pause menu things get more complicated.  Today's post is about that complication and how we're handling it.

What makes the pause menu complicated?  We want Blissa to feel exactly the same as she does in the rest of the game, which means we would like to reuse her prefab.  The problem with this, is we don't want the copy of Blissa in the main game to move at all.  In fact, we don't want anything in the main game to move or really do anything while the game is paused.  We can't just globally pause time because the pause menu is essentially just a different level.  Instead, we have to either use multiple timelines which we can control independently (we didn't pick this) or we can implement the ability to pause each mechanic (we did this).  The nice thing about pause is that we only either pause or resume one time, so as long as we do it before we load the pause level, the pause event won't be picked up by any of the objects in the pause level, and we can use exactly the same logic.

Collision is an interesting one in the context of an overlaid level.  Blightmare is a 2D game, so it's difficult to distinguish between which terrain should be active during the pause menu and which should be active during the game.  This poses a problem if you happen to pause in a small cave, or somewhere that would prevent Blissa from getting to each part of the pause level.  In order to deal with this problem, we had to duplicate some of the physics layers and be very careful about which layers were used in which scene.  This means that the Blissa we spawn in the pause scene is actually slightly different from the Blissa in the main game, but only in the collision masks, so all the important bits are preserved.

The last thing to take care of might actually be the most important: the visuals.  We don't want the game level leaking through to the pause screen, so we have to make sure the camera used for the pause screen only shows the pause screen.  One way to do this is to use an approach like the physics solution, and put the pause menu graphics on isolated render layers that are only visible to the pause camera.  We have many layers for Blightmare to create the complete parallax environment, so this represents quite a few dedicated layers as well as a significant annoyance with having to change the render layer for each visual element put into the pause level.  To reduce the amount of work required, we can instead take advantage of the fact that, unlike collision detection, rendering does respect the full 3D position of objects.  We simply move the entire pause menu back in 3D and then put the camera behind the game, and then we're guaranteed to never see any graphics from the game in the pause menu.  The easiest way to see this is by switching to 3D mode in the editor, and zooming out a bit:

Putting all of these techniques together gets us a pause menu that feels a lot more part of the game than flat UI would.  We think it adds just a little bit of extra value to the game and we hope you agree!  If you found this interesting, please head over to our Steam page to add Blightmare to your wishlist and pop over to our Twitter to give us a follow.  Thanks for reading and have a great week!