-
Notifications
You must be signed in to change notification settings - Fork 0
Objecthelper
This defines interfaces used within the project.
This interface holds all values that define a client. These include the Playername, the PlayerID (currently unused), the websocket connection and the Pool(Lobby) that the client is connected to. Once a client has been authenticated this structure gets created and represents the client from thereon out.
Sample usage:
var client := Client{
Playername: "wiki"
ID: "none"
Conn: clientConn
Pool: connectedPool
}
This interface holds all values that define a Pool (server side representation of a lobby). It consists of multiple channels for user join/leave, highscore updates, player position updates and broadcast messages.
Sample Usage:
newPool := Pool{
UserJoin: make(chan *Client),
UserLeave: make(chan *Client),
Clients: make(map[*Client]bool),
Broadcast: make(chan ObjectStructures.ReturnMessage),
TimeList: make(map[int]ObjectStructures.HighScoreStruct),
TimeListSet: make(chan ObjectStructures.HighScoreStruct),
UserStateList: make(map[int]ObjectStructures.PlayerPosition),
UserStateSet: make(chan ObjectStructures.PlayerPosition),
}
This interface stores all values for a Lobby. It is used as a representation of the lobby that can be send to clients and the masterserver.
It contains the LobbyID (this is the ID used to join a Lobby), the code for the current map and the lobbyname.
Sample usage:
newLobby := {
ID: "sampleID"
MapCode: "sampleMap"
LobbyName: "sampleLobby"
}
Refer to the [wiki entry](Client Package) for this specific package structure
Refer to the [wiki entry](Client Package) for the ClientMessage.
Refer to the [wiki entry](Server Package) for this specific package structure
Refer to the [wiki entry](Server Package) for the Server message.
Refer to the [wiki entry](Server Package) for the Server message.