Skip to content

refactor: replacing GameNetPortal with state machine [MTT-1742] [MTT-3501] [MTT-3502] #666

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

Merged
merged 87 commits into from
Jul 11, 2022

Conversation

LPLafontaineB
Copy link
Contributor

@LPLafontaineB LPLafontaineB commented May 30, 2022

Description

This PR aims to simplify and clarify the connection flow in Boss Room. It replaces GameNetPortal (as well as ClientGameNetPortal and ServerGameNetPortal) with a state machine (ConnectionManager). This state machine receives inputs from other parts of our code, and registers to callbacks from NGO. It then redirects these inputs and callbacks to the current state, which then handles it accordingly.

ConnectionManager is responsible for initializing the different states and redirecting inputs and callbacks to them. It also handles our custom messaging for giving a disconnect reason to clients.
The connection logic itself is the responsibility of the different states.

Issue Number(s)

MTT-1742, MTT-3502 & MTT-3501

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

@LPLafontaineB LPLafontaineB added the 5-Design Review Draft to review design ideas before committing to future work label May 30, 2022
(cherry picked from commit 4bbe421)
(cherry picked from commit e30c8f9)
* Removed use of clientSceneMap
* Replaced with OnLoadEventCompleted and OnSynchronizeComplete callbacks

(cherry picked from commit 80fe462)
(cherry picked from commit 0a3680d)
(cherry picked from commit 2c83355)
(cherry picked from commit 991bd90)
(cherry picked from commit 67e2fbe)
(cherry picked from commit 47444a1)
(cherry picked from commit 2accfe4)
* Reconnecting now inherits from Offline
* Also extracted GetPlayerId() to Offline state

(cherry picked from commit 4f1c105)
(cherry picked from commit 429ee19)
(cherry picked from commit b23b99f)
* shutting down host now changes state to offline
* fixed return value of JoinRelayServerAsync

(cherry picked from commit 593da8a)
(cherry picked from commit fd9e635)
(cherry picked from commit 532bd10)
@LPLafontaineB LPLafontaineB force-pushed the lplb/gamenetportal-refactor branch from 9d3c1b7 to 2516936 Compare June 2, 2022 20:00
@LPLafontaineB LPLafontaineB changed the base branch from pdeschain/folder-assembly-refactor to develop June 2, 2022 20:02
fernando-cortez
fernando-cortez previously approved these changes Jun 2, 2022
Copy link
Collaborator

@fernando-cortez fernando-cortez left a comment

Choose a reason for hiding this comment

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

I really like this! A suggestion would be to include a little blurb (either in each state) or somewhere central where you could detail what state each state can transition to. Even without that, it was real simple to navigate. 🚀

@LPLafontaineB LPLafontaineB 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 Jul 6, 2022
Copy link
Contributor

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

I like the update and love the new state machine approach!
From what I can tell, it looks like a bunch of really good improvements.

@LPLafontaineB LPLafontaineB changed the title refactor: replacing GameNetPortal with state machine [MTT-1742] refactor: replacing GameNetPortal with state machine [MTT-1742] [MTT-3501] [MTT-3502] Jul 11, 2022
@LPLafontaineB LPLafontaineB merged commit fd60daa into develop Jul 11, 2022
@LPLafontaineB LPLafontaineB deleted the lplb/gamenetportal-refactor branch July 11, 2022 15:15
SamuelBellomo added a commit that referenced this pull request Jul 12, 2022
* develop:
  refactor: replacing GameNetPortal with state machine [MTT-1742] [MTT-3501] [MTT-3502] (#666)
  chore: update NGO, tools, authentication and relay packages (#690)
  feat: replacing discope with vcontainer [MTT-3675] (PR recreated) (#679)
  updated changelogs with fixes made to the release changelog (#688)

# Conflicts:
#	Assets/Scenes/CharSelect.unity
#	Assets/Scenes/PostGame.unity
#	Assets/Scenes/Startup.unity
#	Assets/Scripts/ApplicationLifecycle/ApplicationController.cs
#	Assets/Scripts/Gameplay/ConnectionManagement/ClientGameNetPortal.cs
#	Assets/Scripts/Gameplay/ConnectionManagement/GameNetPortal.cs
#	Assets/Scripts/Gameplay/ConnectionManagement/ServerGameNetPortal.cs
#	Assets/Scripts/Gameplay/DebugCheats/Unity.BossRoom.DebugCheats.asmdef
#	Assets/Scripts/Gameplay/GameState/ClientBossRoomState.cs
#	Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs
#	Assets/Scripts/Gameplay/GameState/ClientPostGameState.cs
#	Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs
#	Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs
#	Assets/Scripts/Gameplay/GameState/ServerCharSelectState.cs
#	Assets/Scripts/Gameplay/GameState/ServerPostGameState.cs
#	Assets/Scripts/Gameplay/GameplayObjects/ClientDoorVisualization.cs
#	Assets/Scripts/Gameplay/UI/IPUIMediator.cs
#	Assets/Scripts/Gameplay/UI/PostGameUI.cs
#	Assets/Scripts/Infrastructure/DIScope.cs
#	Assets/Tests/Runtime/Unity.BossRoom.Tests.Runtime.asmdef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-One More Review One review in, one to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants