Jump to content
• Advertisement

# Gameplay Menu UI - Partial Pausing the Game

## Recommended Posts

Hello all!

Unreal Question: I am wanting to make a inventory screen that when opens, the camera zooms in to a close-up of the character, pauses the enemies and environment, but keeps the character's idle animation. The player would be able to equip items and see them appear on the character in real time. However, I don't want an enemy running up and killing the player or an environmental hazard killing them. If something like that is possible, how would one achieve that?

Here is a similar look of what I want to accomplish (I'm assuming this is a MMO so the game isn't actually paused, but this is similar to the look I want)

However, I could settle for something like Destiny's menu, where the character model appears in the menu and not a camera change, but changes are reflected when items are equipped:

Let me know if I can better clarify anything, and thanks in advanced!

#### Share this post

##### Share on other sites
Advertisement

You could pause the game and make the character tick when paused. Not sure it'd still react to input, so you may want to disable it on the controller too.

#### Share this post

##### Share on other sites

Don't pause the world.

In general a pause system stops all animations. It will stop no matter if the characters are idle, or if a character is running, crawling, swinging a sword, jumping through the air, blocking a blow, or doing anything else.  In that scenario you can't continue to play animations, not even idle animations, because they could interfere with other things that are going on. You can't have two characters locked in a battle to the death frozen in time while another is breathing and idling while changing outfits.  All animations must stop in that situation, or the flow can't interrupt gameplay.

If your inventory screen is outside the main gameplay environment there is no need to pause the world.  The character is still visible and animations are running, the difference is that the character isn't being controlled directly by the player.  Do all your menus and UI stuff, and have a character in a world that responds to events coming from the UI.  You might have the UI trigger animations to show weapon swings when a different weapon is equipped or other animations, but it is the menus controlling the character, not the human.

#### Share this post

##### Share on other sites
Posted (edited)

Well, I guess "pause" should indeed be reserved for... well, actually pausing the game. Sorry about that naive answer

An alternative would be lowering "Global Time Dilation" and increasing "Custom Time Dilation" on the character - it wouldn't exactly pause everything, but the achieved effect would be similar. Another, which may be the preferred way I believe, is having some variable in your Game State which all relevant entities use to know whether the menu is active or not and act accordingly.

Regarding the varied scenarios where "playing an idle would break the flow", you could make it work with a more complex system.

For instance, you could check if the game is paused and, should that be the case, decide whether to simply fallback to an idle state (say if the char wasn't in combat) or just freeze it in place (setting playback speed to 0) and layer an idle on top of the current one, eg. keep the sword raised, but the character still breathes (and maybe looks around as if thinking "what the heck is happening?" if you're going for this vibe).

Edited by vlucki

#### Share this post

##### Share on other sites

Sorry for the delay in responding. Been a busy week, but thank you guys for responding so quickly. Just a few follow ups:

On 8/6/2018 at 11:17 PM, frob said:

Don't pause the world.

In general a pause system stops all animations. It will stop no matter if the characters are idle, or if a character is running, crawling, swinging a sword, jumping through the air, blocking a blow, or doing anything else.  In that scenario you can't continue to play animations, not even idle animations, because they could interfere with other things that are going on. You can't have two characters locked in a battle to the death frozen in time while another is breathing and idling while changing outfits.  All animations must stop in that situation, or the flow can't interrupt gameplay.

If your inventory screen is outside the main gameplay environment there is no need to pause the world.  The character is still visible and animations are running, the difference is that the character isn't being controlled directly by the player.  Do all your menus and UI stuff, and have a character in a world that responds to events coming from the UI.  You might have the UI trigger animations to show weapon swings when a different weapon is equipped or other animations, but it is the menus controlling the character, not the human.

So if I were to have a blueprint or code in Unreal that when I press "escape" to bring up the menu it sets the game to pause, that cancels any animation in effect? I've mostly just been using Unreal's base animations as a stop-gap for the time being, but I haven't noticed that happening. It makes sense that if my character was mid-swing when I paused and a camera zoomed in on him, it would be paused mid animation and wouldn't revert to idle for a menu.

For the second paragraph you're talking about only allowing the inventory screen when the character is in a safe place? (Which I think I'm leaning towards having a designated area for equipping new items) Or creating a separate, but identical character that is displayed only in the UI, and idles, but animates when items are equipped? How would the new items equipped translate to the "in game" character? Perhaps I'm overthinking it or misunderstanding something.

On 8/7/2018 at 2:26 AM, vlucki said:

Well, I guess "pause" should indeed be reserved for... well, actually pausing the game. Sorry about that naive answer

An alternative would be lowering "Global Time Dilation" and increasing "Custom Time Dilation" on the character - it wouldn't exactly pause everything, but the achieved effect would be similar. Another, which may be the preferred way I believe, is having some variable in your Game State which all relevant entities use to know whether the menu is active or not and act accordingly.

Regarding the varied scenarios where "playing an idle would break the flow", you could make it work with a more complex system.

For instance, you could check if the game is paused and, should that be the case, decide whether to simply fallback to an idle state (say if the char wasn't in combat) or just freeze it in place (setting playback speed to 0) and layer an idle on top of the current one, eg. keep the sword raised, but the character still breathes (and maybe looks around as if thinking "what the heck is happening?" if you're going for this vibe).

Ok, that last one does sound a bit more complicated, but I think I understand what is involved in it. And it does seem closer to the current idea for the UI that I had.

#### Share this post

##### Share on other sites
Posted (edited)
4 hours ago, Brandon Segraves said:

So if I were to have a blueprint or code in Unreal that when I press "escape" to bring up the menu it sets the game to pause, that cancels any animation in

It sounds like you don't understand the game loop yet, so I will explain it here, once you understand the answer is very clear:

A game is just a loop when it is in code, usually a kind of while loop.

While (Quit == false){
//The code for the game is here
//Seting Quit to True will stop the loop
}

Often pausing the game is some kind of IF check to see if the game should run:

While (Quit == false){
if (Pause == false)
{
//Game runs while pause is false
}
//if pause is true the game code is just skiped over
}

So you see if you pause the game you pause everything, as such you shouldn't use pause for these effects. Instead you should only pause some things, not all things.

In Unreal, we can not only pause the game but also pause every level that is active, because every level is a sub loop inside the loop:

The Unreal UI is also a sub loop, so is the character controller, neither of these are in the "Pause Game" check but instead is an actual level on it's own:

As you can see if you call "Pause Game" from the UI the levels will be paused, but both the controller and the UI will keep functioning as normal.

If you wanted the character and world to pause, but you don't want the camera to pause, you would use two levels. Level 1 will have content to pause, level 2 will have whatever should not pause. Then In the UI or Controller you will tell it to pause level 1.

If you haven't used Unreal's level streaming system yet, this is how:

1.) Under the Window option in the editor, select "Levels".

2.) Create a empty map, completely empty.

3.) In the "Levels" window add the new map to the list of levels. This will immediately add the two levels together.

The reason you want a empty level is because lights etc will conflict when streamed into one scene. As a example I added a "default" level into a existing level:

In theory what you want is: A persistent that is empty. Inside this will be the "World" level and "Don't Pause" level. Under the world level you will also have shards that you are streaming.

Don't be afraid of Unreal's level streaming, it is supper easy to use.

Edited by Scouting Ninja

#### Share this post

##### Share on other sites

I'm still learning Unreal, so I don't know how to archive this in Unreal. I'm sorry in advance if this might not help!.

I think you could just makes all enemy stop updating its states, including animation and such. I guess you could disable most of the components inside the enemy object while keeping the player one active (well I guess you still have to disable some of the player actor's components).

Personally I think it might not wort headaches implementing the menu where player actor still active and the rest is not. I think switching to another screen/level/scene temporary (what is the word used in Unreal ?) will look better and more straightforward to implement. Imagine if the actor is middle of some action, and the player enter the menu, are you going to switch the animation to idle ? What about switching back to the old state after exit menu? Will it perform the same? etc.

#### Share this post

##### Share on other sites
Posted (edited)
40 minutes ago, mr_tawan said:

Imagine if the actor is middle of some action, and the player enter the menu, are you going to switch the animation to idle ?

Actually when you use two levels this becomes very easy, because you would just use two of the player characters.

1.) One character will be in the world level, the other one in the DontPause level. The second one should be invisible.

2.) The moment the game is paused the original player model animation is captured as a Snapshot.

3.) The second character is turned visible and active, while the original is made invisible just before pause; or after pause using the Unreal "Tickable when paused" function.

4.) The second character Blends between the Snapshot animation and idle animation.

5.) Equip character etc. Blend back to the snapshot animation as the player exits menu.

6.) Update the original character with the new gear, make it visible and active. Hide the second character and making it inactive. Then unpause the level.

Taking a look at the Unreal tools, maybe the developers had this in mind from the start?

Edited by Scouting Ninja

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5
• Advertisement

• 11
• 18
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632929
• Total Posts
3009279
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!