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

Redesign find sessions using SearchCriteria #22

Merged

Conversation

DaniElectra
Copy link
Member

The MatchmakeSessionSearchCriteria is intended to be compared with the original session to find valid sessions. Thus, we can remove the SearchCriteria field that we are storing internally and instead compare values with the session.

With this, we implement comparing attributes by default, unless game-specific checks are defined, in which case the attribute search gets overriden. This allows overriding region-locked matchmaking.

This also allows removing session creation that requires search criteria CreateSessionBySearchCriteria and instead move everything to CreateSessionByMatchmakeSession.

We can also remove the cleanup of search criteria, since it's redundant considering we allow game-specific checks.

Friends-only matches are also now supported, and requires setting the GetUserFriendPIDs handler on MatchmakeExtension.

This improves accuracy finding sessions and is how Rambo's MK8 server is implemented.

Aside from that, I'm considering moving the logger to the globals, so that we can log from globals.

Tested successfully with:

  • Mario Kart 7
  • Steel Diver: Sub Wars
  • IRONFALL Invasion

The `MatchmakeSessionSearchCriteria` is intended to be compared with the
original session to find valid sessions. Thus, we can remove the
`SearchCriteria` field that we are storing internally and instead
compare values with the session.

With this, we implement comparing attributes by default, unless
game-specific checks are defined, in which case the attribute search
gets overriden. This allows overriding region-locked matchmaking.

This also allows removing session creation that requires search criteria
`CreateSessionBySearchCriteria` and instead move everything to
`CreateSessionByMatchmakeSession`.

We can also remove the cleanup of search criteria, since it's redundant
considering we allow game-specific checks.

Friends-only matches are also now supported, and requires setting the
`GetUserFriendPIDs` handler on `MatchmakeExtension`.

This improves accuracy finding sessions and is how Rambo's MK8 server is
implemented.

Tested successfully with:
- Mario Kart 7
- Steel Diver: Sub Wars
- IRONFALL Invasion
@jonbarrow
Copy link
Member

I will give this a deeper review later on Friday when I'm back home. However I will say now, I agree with moving the logger to the globals. Not having access to the logger in some cases is not great

Comment on lines +174 to +180
session.GameMatchmakeSession.MatchmakeParam.Parameters["@SR"] = nex.NewVariant()
session.GameMatchmakeSession.MatchmakeParam.Parameters["@SR"].TypeID = 3
session.GameMatchmakeSession.MatchmakeParam.Parameters["@SR"].Bool = true

session.GameMatchmakeSession.MatchmakeParam.Parameters["@GIR"] = nex.NewVariant()
session.GameMatchmakeSession.MatchmakeParam.Parameters["@GIR"].TypeID = 1
session.GameMatchmakeSession.MatchmakeParam.Parameters["@GIR"].Int64 = 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is more just a curiosity than anything, but do we know what purpose these serve?
The official NEX server assigns them (and the Tri-Force Heroes server assigns even more than this), but I've yet to find any client using (or requiring) them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we know the exact purpose, but they are assigned by the server when creating a session on every title I remember so far

Copy link
Member

Choose a reason for hiding this comment

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

I know that Modern Warfare II uses SR to mean "Skill Rating" which is used to determine which rank you are and get matched with. I wonder if this is something similar? I know MW2 is not a NEX, or even WiiU, game but I wonder if the terminology is the same/similar? @SR being true meaning that "Skill Rating" is used when match making, and @GIR (Gathering IDK Rating?) is whatever rank?

Copy link
Member Author

Choose a reason for hiding this comment

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

I know that Modern Warfare II uses SR to mean "Skill Rating" which is used to determine which rank you are and get matched with. I wonder if this is something similar? I know MW2 is not a NEX, or even WiiU, game but I wonder if the terminology is the same/similar? @SR being true meaning that "Skill Rating" is used when match making, and @GIR (Gathering IDK Rating?) is whatever rank?

I could buy that if the types were the same, but that isn't the case. It could be something similar though

This allows us to log inside the matchmaking globals.
@DaniElectra
Copy link
Member Author

I agree with moving the logger to the globals. Not having access to the logger in some cases is not great

Alright, the loggers have been moved to the globals!

Copy link
Member

@jonbarrow jonbarrow left a comment

Choose a reason for hiding this comment

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

Looks really solid from what I can tell!

globals/matchmaking_utils.go Show resolved Hide resolved
@shutterbug2000
Copy link
Collaborator

No issues that I can see! (LGTM ;P)
Is it ready to merge? Have some (unrelated) bugfixes I want to push, but don't want to cause any conflicts :p

@DaniElectra
Copy link
Member Author

Is it ready to merge?

Yes, it should be! I'll wait if @jonbarrow has anything else to say and then it can be merged

@jonbarrow
Copy link
Member

Merge away 👍

@DaniElectra DaniElectra merged commit cfddbc4 into PretendoNetwork:main Oct 23, 2023
@DaniElectra DaniElectra deleted the redesign-search-criteria branch October 23, 2023 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants