o3de / o3de-multiplayersample

Multiplayer sample project for the Open 3D Engine
https://o3de.org
Other
83 stars 59 forks source link

Added "disconnect" call to script to reset the multiplayer state to allow LoadLevel to work #376

Closed mbalfour-amzn closed 1 year ago

mbalfour-amzn commented 1 year ago

The MultiplayerSystemComponent has logic that prevents a client from initiating "LoadLevel" at any point after the client has connected to a server for the first time, even if a disconnect occurs. However, the "disconnect" console command will reset the client-side state back to uninitialized, allowing the LoadLevel to succeed. This change to the game's ClientDisconnect state calls "disconnect" explicitly before calling "LoadLevel" so that it can successfully navigate back to the start screen. (Side note - this is why testing the feature with using "disconnect" on the client always worked :( )

image

This potentially should get fixed in the Multiplayer Gem as well in the development branch, GHI entered here: https://github.com/o3de/o3de/issues/15771 . But since it can't get fixed in the stabilization branch, the workaround in this PR is required.