Documentation ¶
Overview ¶
Package lobby handles players connecting to games and communication between games and players
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Debug is a flag that causes the game to log the types messages that are read. Debug bool }
Config contiains the properties to create a lobby
func (Config) NewLobby ¶
func (cfg Config) NewLobby(log log.Logger, socketRunner SocketRunner, gameRunner GameRunner) (*Lobby, error)
NewLobby creates a new game lobby.
type GameRunner ¶
type GameRunner interface {
Run(ctx context.Context, wg *sync.WaitGroup, in <-chan message.Message) <-chan message.Message
}
GameRunner handles running and managing games.
type Lobby ¶
type Lobby struct { Config // contains filtered or unexported fields }
Lobby is the place users can create, join, and participate in games. It is a middleman between the socket runner and game runner. It also handles communication from the server to add and remove sockets.
func (*Lobby) AddUser ¶
AddUser adds a user to the lobby, it opens a new websocket (player) for the username.
func (*Lobby) RemoveUser ¶
RemoveUser removes all sockets for the user from the lobby.
Click to show internal directories.
Click to hide internal directories.