Documentation ¶
Index ¶
- Variables
- func AddPlayersToSession(session *CommonMatchmakeSession, connectionIDs []uint32, ...) *nex.Error
- func ChangeSessionOwner(currentOwner *nex.PRUDPConnection, gathering uint32, isLeaving bool)
- func DeleteIndex(s []uint32, index int) []uint32
- func FindConnectionSession(id uint32) uint32
- func FindOtherConnectionID(excludedConnectionID uint32, gatheringID uint32) uint32
- func FindSessionByMatchmakeSession(pid *types.PID, searchMatchmakeSession *match_making_types.MatchmakeSession) uint32
- func GetAvailableGatheringID() uint32
- func RemoveConnectionFromAllSessions(connection *nex.PRUDPConnection)
- func RemoveConnectionIDFromSession(id uint32, gathering uint32)
- type CommonMatchmakeSession
Constants ¶
This section is empty.
Variables ¶
var CurrentGatheringID = nex.NewCounter[uint32](0)
var CurrentMatchmakingCallID = nex.NewCounter[uint32](0)
var GetUserFriendPIDsHandler func(pid uint32) []uint32
var Logger = plogger.NewLogger()
var Sessions map[uint32]*CommonMatchmakeSession
Functions ¶
func AddPlayersToSession ¶
func AddPlayersToSession(session *CommonMatchmakeSession, connectionIDs []uint32, initiatingConnection *nex.PRUDPConnection, joinMessage string) *nex.Error
AddPlayersToSession updates the given sessions state to include the provided connection IDs Returns a NEX error code if failed
func ChangeSessionOwner ¶
ChangeSessionOwner changes the session owner to a different connection
func DeleteIndex ¶
DeleteIndex removes a value from a slice with the given index
func FindConnectionSession ¶
FindConnectionSession searches for session the given connection ID is connected to
func FindOtherConnectionID ¶
FindOtherConnectionID searches a connection ID on the session that isn't the given one Returns 0 if no connection ID could be found
func FindSessionByMatchmakeSession ¶
func FindSessionByMatchmakeSession(pid *types.PID, searchMatchmakeSession *match_making_types.MatchmakeSession) uint32
FindSessionByMatchmakeSession finds a gathering that matches with a MatchmakeSession
func GetAvailableGatheringID ¶
func GetAvailableGatheringID() uint32
GetAvailableGatheringID returns a gathering ID which doesn't belong to any session Returns 0 if no IDs are available (math.MaxUint32 has been reached)
func RemoveConnectionFromAllSessions ¶
func RemoveConnectionFromAllSessions(connection *nex.PRUDPConnection)
RemoveConnectionFromAllSessions removes a connection from every session
func RemoveConnectionIDFromSession ¶
RemoveConnectionIDFromSession removes a PRUDP connection from the session
Types ¶
type CommonMatchmakeSession ¶
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) }
func CreateSessionByMatchmakeSession ¶
func CreateSessionByMatchmakeSession(matchmakeSession *match_making_types.MatchmakeSession, searchMatchmakeSession *match_making_types.MatchmakeSession, hostPID *types.PID) (*CommonMatchmakeSession, *nex.Error)
CreateSessionByMatchmakeSession creates a gathering from a MatchmakeSession
func FindSessionsByMatchmakeSessionSearchCriterias ¶
func FindSessionsByMatchmakeSessionSearchCriterias(pid *types.PID, searchCriterias []*match_making_types.MatchmakeSessionSearchCriteria, gameSpecificChecks func(searchCriteria *match_making_types.MatchmakeSessionSearchCriteria, matchmakeSession *match_making_types.MatchmakeSession) bool) []*CommonMatchmakeSession
FindSessionsByMatchmakeSessionSearchCriterias finds a gathering that matches with the given search criteria