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

fix: synced WinState was causing issues on a replay attempt (MTT-4490) #724

Merged
merged 6 commits into from
Aug 31, 2022

Conversation

pdeschain
Copy link
Contributor

Description

Was:

  • BossRoom scene pickled a networkObject with WinState netvar with DontDestroyOnLoad
  • PostGame scene was supposed to clean up that networkObject
  • however when BossRoom scene is exited to MainMenu - that cleanup didn't happen, causing issues on an attempt to enter the BossRoom scene again

Now:

  • BossRoom state passes the WinState via a new server-only PersistentGameState (plain C# class, passed in via DI)
  • PostGame state is loaded, and on the server it passes the data from persistentGameState to a new NetworkBehaviour called PostGameStateData (yes, it's not a very pretty name) and it then in turn synchronizes the WinState information across all the peers.
  • This way we do not need to pickle networkObjects with DontDestroyOnLoad
  • Late joiners are automatically taken care of by a netvar in PostGameStateData, which in turn doesn't survive beyond the PostGame scene

Issue Number(s)

MTT-4490

Contribution checklist

  • Tests have been added for boss room and/or utilities pack
  • Release notes have been added to the project changelog file and/or package changelog file
  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • JIRA ticket ID is in the PR title or at least one commit message
  • Include the ticket ID number within the body message of the PR to create a hyperlink

@pdeschain pdeschain added 2-Easy This PR is trivial and can be reviewed quickly 1-Needs Review PR needs attention from the assignee and reviewers labels Aug 30, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
SamuelBellomo
SamuelBellomo previously approved these changes Aug 30, 2022
@SamuelBellomo SamuelBellomo added 2-One More Review One review in, one to go and removed 1-Needs Review PR needs attention from the assignee and reviewers labels Aug 30, 2022
LPLafontaineB
LPLafontaineB previously approved these changes Aug 30, 2022
Copy link
Contributor

@LPLafontaineB LPLafontaineB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is fixing MTT-4487 as well

…tiplayer.samples.coop into pdeschain/winstate-networkbehaviour-cleanup
This reverts commit 9688fa0.
@pdeschain pdeschain enabled auto-merge (squash) August 31, 2022 15:39
@pdeschain pdeschain merged commit 33bc24c into develop Aug 31, 2022
@pdeschain pdeschain deleted the pdeschain/winstate-networkbehaviour-cleanup branch August 31, 2022 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-Easy This PR is trivial and can be reviewed quickly 2-One More Review One review in, one to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants