I have an amusing anecdote that I feel reflects a lot of what makes video game development fun, interesting, and difficult.
We're going to be solving the issue of "how does the player make a choice during a dialog or interaction?" Pause for a moment and decide about how that should work. We can probably agree on a high level that there should be text shown to a player and two or more options to select from. The details are what we care about, though.
Do we pause the game while the player is thinking?
If no, how do we handle enemies attacking the player? Do we pick a default option when they're attacked? Do we close the menu? Do we prevent enemies from attacking the player?
If we pick a default option, what if that option is a bad one? Our writers need to remember that the last dialog option will get picked if the player is attacked. What if the choice is one of immense gravity -- a one-time event, like "take or leave the source of immense power"? Should we still decide for the player? Perhaps neither and we close the menu, but if we close the menu, what if the dialog is at the end of a cutscene or exchange? Sure, we could just resume the dialog from where we left off, but if the player is broken out of the exchange then what if the character offering the choice dies while the player is in combat? So let's force the player to go through the dialog again. I hope you don't re-check that the player has any quest items because those might have been removed during the dialog.
Perhaps that all sounds too complex, but if we prevent enemies from attacking the player during a choice, then you had better remember that, because you've got a bug in waiting. Fallout happens to have such a bug.
Or perhaps you want to avoid all that headache, so you decide to pause the game. I personally think that's reasonable. I have a state in my game for paused that gets set when the pause menu is up or the main menu is showing. Sounds okay so far. We pause the game and wait for the player to pick one or the other.
I have only one pause state: the game is paused or it's not. I don't have a 'paused in menu' and 'paused while making a choice' as separate states. This means when the player pauses the game to change their controls or volume settings...
Our pause menu pops over the dialog menu. More importantly, though, the game unpauses when the player closes the pause menu, as it should. So we could split the pause state into 'paused waiting for selection' and 'paused waiting for menu', but hold on wait, what if the player decides to pause the game in the middle of making a decision and save it, then loads the game? Now we need to remember that a dialog was open and the player was in the middle of a choice. I hope you have everything saving and restoring properly and that you have a good way of triggering events.
Or maybe you did. But I hope your choice menu was expecting not to be preempted:
This is why we can't have nice things.
So let's take the easiest thing: the player can't access the pause menu while and popup menus are open. I hope you're not expecting to use the multiple choice menu to enable and disable the pause menu, because if a story trigger preempts the closing dialog (like a scene change) then your player won't be able to access the main menu any more.
Ultimately, the solution in this case is to have the pause menu check to see if there are any option menu or pause menu popups visible before it will allow itself to pop open. This does put a dependency between the two and makes the code less trivial, but it's the least messy option I've found.
Этот веб-сайт использует файлы cookie для улучшения вашего опыта во время навигации по нему. Продолжайте использовать этот веб-сайт как обычно, если вы согласны с использованием файлов cookie. Ознакомьтесь с нашей Политикой Конфиденциальности для получения подробной информации. Выбирая Принять, вы даете согласие на использование файлов cookie.