I’m working on developing a training simulator, and would like for the simulation to pause at various points so that the trainees can answer questions related to what they’re doing.
The single-player prototype worked without a hitch, but the project I’m working on is a multiplayer game hosted on a dedicated server. So far, every attempt to pause the game has failed.
#Blueprint Code
Here’s the relevant blueprint code in my PlayerController:
I created “TEST_ClientRequestPause” and tied it to a button press so that I could test easier. It makes an RPC call to the server-side method (which would normally be triggered by an event on the server). The server-side event then calls other RPCs to attempt to pause the game. I’ve tried:
- Server-side only
- Client-side only
- Multicast
The image above shows calls to the client-only and multicast RPCs.
#Client Log
[2019.01.08-16.31.27:064][470]Strm: Error: Client request pause
[2019.01.08-16.31.27:096][472]Strm: Error: Invoking multicast pause
[2019.01.08-16.31.27:097][472]Strm: Error: Multicast pause success: false
[2019.01.08-16.31.27:097][472]Strm: Error: Invoking client pause
[2019.01.08-16.31.27:098][472]Strm: Error: Client pause success: false
#Server Log
[2019.01.08-16.31.27:076][296]Strm: Error: Server request
[2019.01.08-16.31.27:077][296]Strm: Error: GameMode can pause: true
[2019.01.08-16.31.27:077][296]Strm: Error: Invoking multicast
[2019.01.08-16.31.27:078][296]Strm: Error: Multicast pause success: false
#Analysis
The RPCs seem to be functioning as expected (the events are in the expected order and in the expected logs).
The GameMode is reporting that it can pause. Perhaps network pausing is limited somewhere else (this post seems to indicate that network pausing is disabled by default).
The log indicates that immediately after invoking “SetGamePaused(true),” the “IsGamePaused” node is returning false. I’ve also connected the boolean output of the “SetGamePaused” node to my log statement - it also returns false in all cases.
If anyone has any insight on why that might be the case, I would love to hear it. Is there an option somewhere in the project that needs to be set? Do I need to manage my RPCs differently? Answer #6 from vipeout in this post seems to suggest that the clients need to pause before the server pauses, but I can’t seem to get the clients to pause (and I’m less concerned with preserving the “pauser” in the world state). Is there a known issue that would prevent a dedicated server from pausing? Are there any common mistakes that might cause the “SetGamePaused” node to return false?
Thanks!