I press the exit button to close a menu. The menu closes as expected but, the action in the game world connected to the same button occurs (jump, crouch, attack, et cetera). This has occurred in a few big-budget games I’ve played recently. Do you think this is an intentional choice or programming oversight?

It’s absolutely a programming oversight. The vast majority of the time, the player wants to do one single action at a time - navigate the UI, perform some kind of action, move somewhere, etc. When we allow for multiple actions to occur simultaneously, the player can end up in situations they did not expect nor desire due to the simultaneous actions.

Remember, when it comes to dealing with edge cases we developers live in a land of worst-case scenarios. The worst case scenario in this case is that the player can accidentally break the game state while in such a situation. The player could get into a fight that they did not intend, fall off a ledge, consume a critical or valuable item, or any of a thousand other problems. We have to consider how damaging to the player experience the issue might be. Obviously, a broken game state is a lot worse experience than an errant extra jump input as the player returns to gameplay. This is usually why we completely disable normal inputs during UI menu navigation - so that the player will remain in the exact same position for the duration of the menu navigation, even if the rest of the game world continues to update (e.g. in a multiplayer game) and behave normally.

Readers may recall my post on [ladders] and notice some parallels between the state transitions here. That is:

  • Ladder : UI Menu
  • Regular Gameplay : Regular Gameplay
  • Get Onto the Ladder : Transition from Gameplay to Menu
  • Climb up/down the Ladder : Navigate the Menu
  • Get Off of the Ladder : Transition from Menu to Gameplay

It is during these transition stages that a lot of bugs can occur if we do not properly clean up the state we’re leaving and set up the new state we are entering. If you see misbehaving inputs like the ones you asked about, it is usually because of these state transition cleanup issues.

[Join us on Discord] and/or [Support us on Patreon]

Got a burning question you want answered?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *