PretendoNetwork / nex-protocols-common-go

Reusable implementations of NEX methods found in many servers
GNU Affero General Public License v3.0
19 stars 8 forks source link

Redesign find sessions using SearchCriteria #22

Closed DaniElectra closed 1 year ago

DaniElectra commented 1 year ago

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:

jonbarrow commented 1 year ago

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

DaniElectra commented 1 year ago

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!

shutterbug2000 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Merge away 👍