Add Create Match with Name (#77) - #206
Open
greenSwanz wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77.
Adds the ability to optionally pass a name when creating a match, matching the other Nakama SDKs. Per the documentation, the name is used by the server to generate the match ID, so two clients creating a match with the same name end up in the same match.
Implementation
nameparameter tocreateMatch/createMatchAsync(and theNRtClientInterfacedeclarations), usingstd::optional<std::string>to follow the existinglistMatchesconvention.std::optionalrather than a defaulted empty string so the no-name behaviour is preserved exactly,mutable_match_create()is always called, andset_nameonly runs when a name is actually provided. Existing callers are unaffected.Note on the test
The test creates two matches with the same name from a single session and asserts they return the same match ID. If the server behaves differently for a same-session repeat, I'm happy to switch it to a two-session setup like test_rt_matchmaker
Testing
test_rt_create_match_with_nameintest_match.cpp, registered intest_rt_match(). It creates two matches with the same name and asserts they return the same match ID, verifying the name feeds into ID generation.