common_globals

package
v2.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentGatheringID = nex.NewCounter[uint32](0)
View Source
var CurrentMatchmakingCallID = nex.NewCounter[uint32](0)
View Source
var GetUserFriendPIDsHandler func(pid uint32) []uint32
View Source
var Logger = plogger.NewLogger()

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

func ChangeSessionOwner(currentOwner *nex.PRUDPConnection, gathering uint32, isLeaving bool)

ChangeSessionOwner changes the session owner to a different connection

func DeleteIndex

func DeleteIndex(s []uint32, index int) []uint32

DeleteIndex removes a value from a slice with the given index

func FindConnectionSession

func FindConnectionSession(id uint32) uint32

FindConnectionSession searches for session the given connection ID is connected to

func FindOtherConnectionID

func FindOtherConnectionID(excludedConnectionID uint32, gatheringID uint32) uint32

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

func RemoveConnectionIDFromSession(id uint32, gathering uint32)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL