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

feat!: Matchmaking rewrite #35

Merged
merged 25 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e71f872
feat!: Matchmaking rewrite
DaniElectra Jun 28, 2024
54f171f
fix(get_session_urls): Don't get station URLs from owner PID
DaniElectra Jun 30, 2024
03912fd
fix(find_by_single_id): Add missing mutex unlocks
DaniElectra Jun 30, 2024
cc89c2e
feat(match-making): Split participant disconnect from new joins
DaniElectra Jun 30, 2024
9ccdfc9
fix(match-making): Add checks for MatchmakeSession fields and messages
DaniElectra Jul 1, 2024
ed1f78c
fix(match-making): Don't use "negative" PIDs for extra participants
DaniElectra Jul 1, 2024
20f418e
feat(matchmake-extension): Support user and system password
DaniElectra Jul 1, 2024
14ae73e
chore: Update go modules
DaniElectra Jul 1, 2024
8caa52c
feat: Add MatchmakingManager abstraction
DaniElectra Jul 3, 2024
dfe34ba
fix(matchmake-extension): Unlock mutex after CreateMatchmakeSessionWi…
ashquarky Aug 9, 2024
6953e78
fix(matchmake-extension): Fix typo in JoinMatchmakeSessionWithParam
ashquarky Aug 9, 2024
9639ab6
Merge pull request #41 from ashquarky/matchmaking-rewrite
DaniElectra Aug 10, 2024
ff20935
feat: Add extension point for CanJoinMatchmakeSession
ashquarky Aug 12, 2024
32d393f
Merge pull request #42 from ashquarky/matchmaking-rewrite
DaniElectra Aug 25, 2024
69e3b1f
feat(match-making): Add tracking system
DaniElectra Aug 30, 2024
808a786
fix(match-making): Check if participants are allowed to change owner
DaniElectra Aug 31, 2024
32a375d
feat(matchmake-extension): Implement GIDForParticipationCheck
DaniElectra Aug 31, 2024
165afdc
feat(matchmake-extension): Support selection method for finding sessions
DaniElectra Sep 1, 2024
0290f5c
feat(match-making): Implement JoinMatchmakeSessionBehavior
DaniElectra Sep 1, 2024
80765de
fix(matchmake-extension): Remove extra open participation check
DaniElectra Sep 1, 2024
b7042f3
fix(matchmake-extension): Fix min/max participants search
DaniElectra Sep 30, 2024
16ed5f1
fix(matchmake-extension): Only use attribute 1 on selection method
DaniElectra Sep 30, 2024
e853c5d
fix(match-making): Change host when host disconnects
DaniElectra Oct 3, 2024
dd5156d
chore: Remove debug log from SendNotificationEvent
DaniElectra Nov 4, 2024
7b42e6a
chore: Update go modules
DaniElectra Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions globals/matchmaking_globals.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
package common_globals

import (
"database/sql"
"sync"

"github.com/PretendoNetwork/nex-go/v2"
match_making_types "github.com/PretendoNetwork/nex-protocols-go/v2/match-making/types"
"github.com/PretendoNetwork/nex-go/v2/types"
)

type CommonMatchmakeSession struct {
GameMatchmakeSession *match_making_types.MatchmakeSession // * Used by the game, contains the current state of the MatchmakeSession
SearchMatchmakeSession *match_making_types.MatchmakeSession // * Used by the server when searching for matches, contains the state of the MatchmakeSession during the search process for easy compares
ConnectionIDs *nex.MutexSlice[uint32] // * Players in the room, referenced by their connection IDs. This is used instead of the PID in order to ensure we're talking to the correct client (in case of e.g. multiple logins)
// MatchmakingManager manages a matchmaking instance
type MatchmakingManager struct {
Database *sql.DB
Endpoint *nex.PRUDPEndPoint
Mutex *sync.RWMutex
GetUserFriendPIDs func(pid uint32) []uint32
GetDetailedGatheringByID func(manager *MatchmakingManager, gatheringID uint32) (types.RVType, string, *nex.Error)
}

var Sessions map[uint32]*CommonMatchmakeSession
var GetUserFriendPIDsHandler func(pid uint32) []uint32
var CurrentGatheringID = nex.NewCounter[uint32](0)
var CurrentMatchmakingCallID = nex.NewCounter[uint32](0)
// NewMatchmakingManager returns a new MatchmakingManager
func NewMatchmakingManager(endpoint *nex.PRUDPEndPoint, db *sql.DB) *MatchmakingManager {
return &MatchmakingManager{
Endpoint: endpoint,
Database: db,
Mutex: &sync.RWMutex{},
}
}
Loading
Loading