Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Disconnect requests that the Client disconnects unblocking any current // reads and writes. Disconnect should not block. After the first call, // Disconnect is a no-op. Disconnect() // DisconnectCh returns a channel that is closed when the Client // is disconnected. DisconnectCh() <-chan struct{} // WritePlayerEvent writes a PlayerEvent to the Client. Blocks until the // event has been sucessfully written, an error occurs, or the context is // canceled. WritePlayerEvent(ctx context.Context, evt model.PlayerEvent) error // ReadPlayerAction reads a PlayerAction from the Client. ReadPlayerAction(ctx context.Context) (model.PlayerAction, error) }
A Client represents a (remote) player connection that can be written to and read from.
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
The Coordinator is responsible for connecting players to a game. Once enough players has been found so that a game can be created, the game coordinator creates and starts a new game with the given players.
The lifetime of the game coordinator is not tied to a single game but rather the entire lifetime of the game server.
func NewCoordinator ¶
func NewCoordinator(log *logrus.Logger) (*Coordinator, error)
NewCoordinator creates a new Coordinator, using the given logger.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.