Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplepause #2149

Closed
wants to merge 7 commits into from
Closed

Conversation

TheUnknownCylon
Copy link
Contributor

The what: This branch demonstrates the possibility of a pause function for the OpenRA game engine.

The why: when playing with a friend or family member, it is sometimes desired to pause the game. For instance to get a drink or something to eat, when the phone rings, etc. Pausing the game will not ruin your life then, and it also won't ruin your game.

The how: the usage is very simple now. During the game, one can press the PAUSE key on the keyboard, and the game will pause. The game can be un-paused by pressing the key again.

In the background the following is done to make this work:

  • The client sends PAUSE GAME REQUEST to the server.
  • The server replies with PAUSE GAME to all clients.
  • From now on, the ordermanager.tick() will not be invoked
    Note: pause messages are immediate orders (so one can unpause).

Some remarks:

  • Orders can be given, but are queued. The UI will not update these orders until the game un-pauses.
  • It has been tested with 1vs1.

Possible future extentions:

  • Adding a pause option in the game-menu (for keyboards without a pause-key)
  • Freeze the game with a "pause screen", where the user can un-pause, resign, chat, and change settings
  • By the game-creating adding a setting which enables/disables the pause-option.

removed this dependency from World.
Game is paused when PAUSE on the keyboard has been hit. It can also be unpaused this way.
: The game is (un-)paused by <PLAYERNAME>
@chrisforbes
Copy link
Member

I have added some notes to your commits. Generally looks good.

@chrisforbes
Copy link
Member

Check that your timer stuff doesn't clash badly with the KOTH ui, which also shows just below the timer.

@chrisforbes
Copy link
Member

Does the pause/unpause work properly in replay?

@chrisforbes
Copy link
Member

Let's have this on F3 as well. Not everyone has a hardware PAUSE key anymore.

@TheUnknownCylon
Copy link
Contributor Author

Chris, I'll continue working on it next weekend.
As far as I can tell: replay seems to work fine (it does not replay the pause, but it replays the pause 'chat'-messages).

@chrisforbes
Copy link
Member

I've put this ticket in the release milestone for this Saturday. I'd
like to ship it then.

@chrisforbes
Copy link
Member

Have done some testing, seems to work great.

@TheUnknownCylon
Copy link
Contributor Author

Hi Chris,

Sorry for the delay. Is there still work to do? Or is it all finished yet?
I have looked into the paused-display. I have problems solving the KOTH-paused-placement. To me it seems that the circle in KOTH is drawn by the OpenRA.Mods.RA, and the pause-text by OpenRA.Game. It think it is not possible (and should not be possible) for the OpenRa.Game to know whether the game is KOTH or not. Therefor it can not calculate an alternative height for the pause-text.

Possible solutions are: MM:SS (paused)
MM:SS\n\n(paused)

The first one does not fit in a 800x600 window.
The second one does look ugly in normal game.

I have time Wednesday to make the proper adjustments. Please let me know.

@chrisforbes
Copy link
Member

800x600 is below the minimum resolution anyway. The UI is set up for 1024x768 or higher.

Screen resolution should be 1024x786+
Removed if-else branch in favour of sugar construct a?b:c.

Note: One should (at least) consider to move var client = ... to the
start of the switch construct. 4 branches of this switch are using this.
(DRY)
@chrisforbes
Copy link
Member

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants