-
Notifications
You must be signed in to change notification settings - Fork 14
[OF-1784] Multiplayer System #842
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
base: main
Are you sure you want to change the base?
Conversation
🚀 Pull Request Review GuidelinesThank you for taking the time to review this Pull Request. The following is a summary of our Pull Request guidelines. The full guidelines can be found here. 💬 How to Provide FeedbackWe use a comment ladder when leaving review comments to avoid any ambiguity.
All comments should be prefixed with one of the above tags, for example: 🎯 PR Author Focus Areas
Thanks again for taking the time to review this Pull Request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly doc stuff.
| /// @brief Gets all scopes associated with the given space id. | ||
| /// @param SpaceId const csp::common::String& : The id of the space we want to get scopes for. | ||
| /// @param Callback csp::systems::ScopesResultCallback : Callback when asynchronous task finishes. | ||
| /// @pre Must already have entered the space of the SpaceId parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Consider] Stating what happens when this precondition is violated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: 2553f80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Comment] I still think this erroring behaviour is poor, an empty array of scopes is not a good marker for "You were not in the space", it could be caused by anything. I'm presuming we don't get a helpful error from CHS telling us why the request failed, which is what I'd ideally like.
[Question[ To give better errors, would we have to query CHS again to check if we're in the space beforehand? Seems like context the forwarded CHS response should be able to provide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: 9860b3d
Used the space system to check if we're in the space. We do this for HotspotSequenceSystem, as well.
| CSP_ASYNC_RESULT void GetScopeLeader(const csp::common::String& ScopeId, ScopeLeaderResultCallback Callback); | ||
|
|
||
| /// @brief Starts leader election for the given scope. | ||
| /// This should not need to be called outside of testing, as leader election is done automatically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Consider] Maybe we should do the __ thing for the naming that we've been talking about for this? Heck, i'd even feature flag it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: 2553f80 by setting these types NO_EXPORT, until we understand how scopes are going to be used in CSP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] I was under the impression we agreed on the __ naming convention for methods that only make sense in a test context going forwards. Am I mistaken in my understanding of either our new standard or what this method is? We can't just agree to do things and then not do them. I'm fine with this code, but you'll need to bring a reason why you didn't want to use the naming convention to the next sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in: 16e3767
|
|
||
| void MultiplayerSystem::GetScopesBySpace(const csp::common::String& SpaceId, ScopesResultCallback Callback) | ||
| { | ||
| constexpr const char* ReferenceType = "GroupId"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Consider] Thinking of/Finding a central location for magic strings like this (Unless it is specific to just this method). At least doc why this is what it is/is it arbitrary or magic, if nothing else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added docs. I can't think of any other magic string, and I dont ant to create a file for one string at this point. f99c3dd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Consider] The most important piece of information about this string is whether it is magic or not, ie, could you put anything here, or does it relate to other data? Ie is it something that CHS or we populate so it has to say exactly "GroupId". That's not expressed in the comment.
| } | ||
|
|
||
| // Ensure default scope has correct default values. | ||
| const csp::systems::Scope& DefaultScope = GetScopesResult.GetScopes()[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Does CHS guarantee the order scopes are returned in, e.g. these are not ordered by last modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure, but there is always 1 default scope, currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check with MCS as a precaution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeromagnopus How are the scopes retrieved from /scopes/referenceType/{referenceType}/referenceId/{referenceId} ordered?
| if (GetScopesResult.GetScopes().Size() != 1) | ||
| { | ||
| FAIL(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] This assumes that the only scope being returned is the default; it is possible that in the future we may have several scopes by default, which would cause this test to be invalid. Do we know if any additional scope is intended to be introduced? (Thinking that POI could have an impact here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None that I know of. However, I think this is useful to keep here so we know that the behaviour has been changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check with MCS as a precaution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeromagnopus Do you know of any additional default scopes that will be created?
641d1f3 to
65e9952
Compare
We were previously conflating the multiplayer hub uri and the multiplayer service uri, which require different values, but also a both have the same change to the RootUri. 2 seperate uris have now been setup to represent the 2 The helper function has also been updated which transforms the RootUri to be generic, so it can be used for both multiplayer uris
This adds a multiplayey system where we can put functionality from the chs multiplayer service api. We may want to make other system abstractions in the future, as this api contains a lot of different functionality. For now, only the functions needed for testing leader election have been implemented
f99c3dd to
a22b329
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved on the understanding that the open question will be answered.
This is part 1 of the server-side leader election work, which contains a new MultiplayerSystem which exposes the necessary functionality for leader election from the mcs MultiplayerServices api.
This work allows us to:
While setting up the MultiplayerSystem, I ran into an issue with our URIs, which is fixed within this ticket. We were conflating the MultiplayerConnection Uri and the MultiplayerServices uri, which should be separate. This has been fixed by creating 2 separate uris. and also applying the root uri transform on both uris, as they both need this.