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

Lobby service integration #480

Merged
merged 145 commits into from
Feb 24, 2022
Merged

Lobby service integration #480

merged 145 commits into from
Feb 24, 2022

Conversation

pdeschain
Copy link
Contributor

@pdeschain pdeschain commented Feb 14, 2022

Description (*)

This PR introduces the Unity Lobby service into Boss Room in the form of the following features:

  • Create IP-based, Relay-based, public or private lobbies
  • Join either kind of Lobby, alongside with Quickjoin (in our case it would just join some lobby that is public and not locked) and ability to join with Lobby code.

From a technical standpoint this PR builds upon the DIScope, UpdateRunner and MessageChannel PRs and uses them.

Several important changes to the project have been made:

  • There is no option to use Photon Relay any more - this PR removes the Photon integration.
  • ApplicationController - a monobehaviour that lives throughout the application lifecycle and is resposnsible for it's lifecycle. We bind and dispose the core DIScope (it lives while the app is alive) in this class. Think of it as "Main" for the entire app.
  • Every scene in our code-base had a ...State component corresponding to it - now these State classes actually contain bootstrap logic for the scene - they are the entrypoints into the scene, where we can bind the dependencies that will live while the scene is alive, and then will get disposed with when the scene unloads.
  • We log in anonymously into unity Authentication as soon as we load into main menu, which simplifies the latter flow by not requiring us to doubt the fact that we're logged in
  • MainMenu scene got a complete face-swap and now relies on a LobbyPanel prefab. LobbyPanel has a LobbyUIMediator component on it - it's the centerpoint of all the lobby-related UI actions and both create and join UI's are elements of it.

The lobby integration bit consists of:

  • LobbyServiceFacade - the sole facade we have to interact with for lobby api calls of various kinds
  • The classes below are an implementation detail of LobbyServiceFacade
    • LobbyAPIInterface - a thin wrapper on top of Unity Lobby service calls that adds error handling and other neccessities
    • JoinedLobbyContentHeartbeat - keeps updated on the changes to the joined lobby
    • LocalLobbyUser - data for a local player instance (it's displayed name, ID etc)
    • LocalLobby - a local wrapper around a lobby's remote data.

Important:

  • this PR adds a way to specify command-line arguments for the built game. Currently we only can do:
    "-AuthProfile YOUR_VALUE", which would make the auth system use a different profile. Useful when testing with several builds on the same machine.

Related Pull Requests

#463
#462
#461

Issue Number(s) (*)

MTT-2067
MTT-2068
MTT-2069
MTT-2070

Fixes issue(s):

Manual testing scenarios

  1. Pull the project
  2. Open one or more extra project clones
  3. Launch the game on all instances
  4. Create an IP or Relay-based lobby and host it - this client will host the lobby and proceed into our Character Selection scene
  5. This lobby (if public) would be visible on other peers as soon as the host successfully starts a relay allocation (otherwise the lobby, while relay allocation is still pending, is "locked" - it won't appear in any queries for lobbies).
  6. The join code (however you host the game) will be displayed in the Character Selection scene and can be used to join the lobby manually (or to join a private lobby).

Questions or comments

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

also adding DIScope extensions - this messaging system is particularly useful with DI and the extension provided allows to easily bind all the necessary interfaces to the DI Scope for easy retrieval of either publisher or subscriber interfaces to the message channel
Further work is needed to integrate a nice-looking list of public lobbies
Added some more capability to the DI system so that it can handle lazy initialization.
Working on the temporary placeholder class LobbyUIManager that contains setup for the di scope of the lobby system and will do other initialization and reactivity
preparation work to refactor the PopupPanel and put lobbies in front of all of our modes of connection
DI scope now reliably works with method and constructor based injection.
Renamed and refactored UpdateSlow into UpdateRunner - a tool for non-monobehs to run their update logic and for monobehs that want to save on an extra Update call.
Added Bootstrap.cs - a class where we set up core dependencies and that then proceeds to load the first logical scene.
also renamed LobbyUIManager to LobbyUIMediator which is a more accurate reflection of what this class does (an entrypoint to all things LobbyUI)
@fernando-cortez
Copy link
Collaborator

Testing in the editor and I'm seeing an oddity in the creation of a lobby. On both IP and relay you have to give your lobby a name before successful creation? I think this should be an option and not a requirement, no?

Also the name passed in to the lobby creation text box doesn't match the one displayed in the char select screen.

And, I'm hitting a rate limit on Retrieve Lobby as host inside char select screen.

@pdeschain
Copy link
Contributor Author

Not an oddity, expected behavior. Name is a requirement of the lobby API. Maybe we can generate a random string for the user, or highlight that the name is required.

The name passed to the lobby is not the code you get displayed in the game. The UI text was not ideal, I've adjusted it to: Room Name -> Join Code

You hitting the rate limit on retrieve lobby is not a problem, however I've slightly adjusted the update rate. Should be more rare now. The Host is still needs to re-fetch the data from the lobby service.

SamuelBellomo
SamuelBellomo previously approved these changes Feb 24, 2022
LPLafontaineB
LPLafontaineB previously approved these changes Feb 24, 2022
@pdeschain pdeschain merged commit 59d8322 into develop Feb 24, 2022
@pdeschain pdeschain deleted the pdeschain/lobby-integration branch February 24, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-Needs Review PR needs attention from the assignee and reviewers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants