Commit graph

46 commits

Author SHA1 Message Date
Daniel López Guimaraes
35aed21585 feat: Initial support for persistent gatherings/communities
Implement methods that are needed for Mario Kart 7 communities to work.
Note that support for communities on MK7 is partial since the community
statistics don't load because legacy Ranking isn't implemented. Aside
from that, players can create communities and join others without
issues. Other games which use persistent gatherings may or may not work.

In order to support the `ParticipationCount`, we replace matchmake
session joins with a wrapper which checks if the session is attached to
a community, and if it is, it will increment the participation count of
the player in a new table named `community_participations`. The
`MatchmakeSessionCount` is handled more easily by checking the sessions
that belong to the corresponding community.

A new parameter is also added named `PersistentGatheringCreationMax`
with a default value of 4, as reported and tested on various games. This
allows game servers to change the maximum number of active persistent
gatherings that a player can create. For example, Mario Kart 7 supports
up to 8 persistent gatherings instead of the default of 4.

In Mario Kart 7 there is no limitation on the number of players that can
"join" to a community. That is because they don't really join to it but
they create matchmake sessions linked to the persistent gathering (in
fact, the `MaximumParticipants` parameter on persistent gatherings is
set to 0). Thus, the `participants` parameter is unused in communities
(at least on MK7) and we instead log community participations with a new
tracking table `tracking.participate_community`.

Some changes also had to be done in other places like participant
disconnection handling or gathering registrations in order to implement
persistent gatherings accurately.
2025-02-09 00:04:03 +00:00
Daniel López Guimaraes
21fdc4730e
refactor: Replace AnyDataHolder with AnyObjectHolder 2025-01-09 23:24:02 +00:00
Daniel López Guimaraes
d7f8b585c1
feat: Migrate to new nex-go types 2025-01-01 19:55:13 +00:00
Daniel López Guimaraes
0290f5c994
feat(match-making): Implement JoinMatchmakeSessionBehavior
Also include some minor fixes.
2024-09-01 01:54:36 +01:00
Daniel López Guimaraes
165afdc00d
feat(matchmake-extension): Support selection method for finding sessions
Currently we don't support ranked matchmaking properly nor the "score
based" version.
2024-09-01 01:30:26 +01:00
Daniel López Guimaraes
8caa52cbbe
feat: Add MatchmakingManager abstraction
Allows removal of matchmake_extension_database dependency inside
match-making
2024-07-03 02:08:45 +01:00
Daniel López Guimaraes
20f418e04f
feat(matchmake-extension): Support user and system password 2024-07-01 20:08:44 +01:00
Daniel López Guimaraes
9ccdfc9704
fix(match-making): Add checks for MatchmakeSession fields and messages 2024-07-01 17:17:50 +01:00
Daniel López Guimaraes
cc89c2ed3f
feat(match-making): Split participant disconnect from new joins 2024-06-30 16:10:34 +01:00
Daniel López Guimaraes
e71f872ac1 feat!: Matchmaking rewrite 2024-06-30 14:08:39 +01:00
Ash Logan
3ca998f820 fix(matchmake-extension): Fix result type from AutoMatchmake.. to be AnyDataHolder
feels awfully reminiscent of the contentWriteable bugs of the past
2024-05-03 17:39:10 +10:00
Daniel López Guimaraes
dfe7dba66b
chore: Update module version to v2 2024-04-07 23:56:20 +01:00
Jonathan Barrow
9ef1a27cf2
matchmake-extension: rename postpone method handlers 2024-02-13 16:35:10 -05:00
Jonathan Barrow
2728968441
update: added OnAfter event handlers for common methods 2024-02-13 16:34:03 -05:00
Daniel López Guimaraes
b6c8028476
refactor: Remove common protocols global variables 2024-02-11 14:51:26 +00:00
Daniel López Guimaraes
410ca40c01
refactor: Update ServerInterface to EndpointInterface
Also update method handlers to use the new nex.Error return.
2024-02-11 00:33:30 +00:00
Daniel López Guimaraes
bbb4872e89
Fix typos and use account getters from endpoint 2024-01-25 17:39:32 +00:00
Jonathan Barrow
d15b82cc12
chore: nex.Errors -> nex.ResultCodes 2024-01-24 16:51:45 -05:00
Jonathan Barrow
ce83fe9720
chore: update to new types 2024-01-22 12:40:37 -05:00
Daniel López Guimaraes
33c6ccc225
Update RMC method creation 2023-12-16 15:46:55 +00:00
Daniel López Guimaraes
6aa24a9ccf
Rename common protocols to CommonProtocol
This reduces the redundancy and follows better the Go style.
2023-12-14 23:21:01 +00:00
Daniel López Guimaraes
5168b5c3d4
Update PRUDP cast comments
Now that the websockets server is integrated into PRUDPServer, we have
to question if we even want to remove these casts, since it doesn't make
much sense for HPP.

Also updaete SecureConnection::Register to support TCP addresses on the
client for websocket implementations.
2023-12-14 21:33:25 +00:00
Jonathan Barrow
cf7a3ef105
merge: fix merge conflict 2023-12-09 23:30:48 -05:00
Daniel López Guimaraes
161f95da5f
Use ServerInterface and ClientInterface
There are some places where the PRUDP implementation is still needed,
but they aren't needed for HPP.
2023-12-07 14:05:33 +00:00
Jonathan Barrow
5dd7310eda
export most helpers rather than use setters 2023-12-01 02:54:56 -05:00
Jonathan Barrow
0e39f84cf9
use new PID, DateTime and method returns 2023-11-14 22:47:15 -05:00
Jonathan Barrow
045afaab5b
use new PID type 2023-11-13 01:22:16 -05:00
Jonathan Barrow
edcc444a36
work with new nex-go 2023-11-12 06:47:56 -05:00
Jonathan Barrow
011d7a1753
pass the original packet to method handlers instead of client 2023-11-01 07:50:32 -04:00
Daniel López Guimaraes
5160332968
Move logger to globals
This allows us to log inside the matchmaking globals.
2023-10-20 23:27:38 +01:00
Daniel López Guimaraes
363fe3cba5
Redesign find sessions using SearchCriteria
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
2023-10-19 18:42:05 +01:00
shutterbug2000
aa73a77404 Code review fixes 2023-10-12 15:44:03 -05:00
shutterbug2000
5903bbbd53 Move session creation and notification sending
This helps reduce duplicate code and bugs that result from it
2023-10-12 12:29:58 -05:00
shutterbug2000
bb05a69934 Fix typo in methods too 2023-10-11 20:09:02 -05:00
Daniel López Guimaraes
d33369f5bc
Rework handling of player disconnects
Reassign owner on session when it leaves unreliably.
2023-09-03 00:46:50 +01:00
Daniel López Guimaraes
d9bb79bc0e
Better check for nil clients
EndParticipation triggered a nil client during testing. Add checks for
all client searches.
2023-09-02 11:51:23 +01:00
Daniel López Guimaraes
242bf55ff1
Various fixes 2023-08-31 18:32:47 +01:00
Jonathan Barrow
b369cddadf
Added BrowseMatchmakeSession and refactor FindSessionsByMatchmakeSessionSearchCriterias 2023-08-31 00:45:28 -04:00
Jonathan Barrow
c033481f9b
Rename and refactor some matchmaking utils 2023-08-30 21:23:22 -04:00
Jonathan Barrow
130669545d
Improved matchmake criteria searching 2023-08-27 18:21:16 -04:00
Daniel López Guimaraes
71163070db
Update go modules and proper error handling
With the latest release of nex-protocols-go we can now implement error
handling in a clean way.
2023-08-06 01:44:42 +01:00
SuperMarioDaBom
5b5b237027 Update to new naming style in nex-protocols-go 2023-07-27 13:54:39 -07:00
shutterbug2000
d66db4e657
Apply suggestions from code review
Fixes some spacing issues

Co-authored-by: Jonathan Barrow <jonbarrow1998@gmail.com>
2023-07-12 14:40:58 -05:00
shutterbug2000
f3f84c3cbd Fix code review issues 2023-07-12 19:31:54 +00:00
shutterbug2000
5760221e74
Apply suggestions from code review
Co-authored-by: Daniel López Guimaraes <112760654+DaniElectra@users.noreply.github.com>
2023-07-12 13:47:32 -05:00
shutterbug2000
9ec24f6297 Implement methods for Pokemon Gen6
This allows Wonder Trade and Random Matchup free battle to function.
PSS matchup will require more methods.
2023-07-12 17:26:56 +00:00