Versions in this module Expand all Collapse all v0 v0.1.4 Jan 3, 2020 v0.1.3 Nov 19, 2019 Changes in this version type Game + func (g *Game) ProcessActionL(a event.GameAction) v0.1.2 Oct 30, 2019 v0.1.1 Oct 28, 2019 Changes in this version + const IdleStart + const IdleTimeout + var Version = "0.0.0" + func GameName(name string) string type Command + const CommandListGames + const CommandStats + type Conn struct + In chan GameCommandInterface + LastTransfer time.Time + Player int + Terminated bool + func (s *Conn) Close() + func (s *Conn) JoinGame(name string, gameID int, newGame *ListedGame, logger chan string, ...) (*Game, error) + func (s *Conn) Write(gc GameCommandInterface) type Game + Eternal bool + ID int + MaxPlayers int + Name string + SpeedLimit int + TimeStarted time.Time + type GameCommandDisconnect struct + Message string + Player int + func (gc GameCommandDisconnect) Command() Command type GameCommandJoinGame + Listing ListedGame + Version int + type GameCommandListGames struct + Games []*ListedGame + func (gc GameCommandListGames) Command() Command + type GameCommandStats struct + Created time.Time + Games int + Players int + func (gc GameCommandStats) Command() Command + type ListedGame struct + ID int + MaxPlayers int + Name string + Players int + SpeedLimit int type Player + Idle time.Duration + Moved time.Time v0.1.0 Oct 19, 2019 Changes in this version + const CommandQueueSize + const ConnTimeout + const DefaultPort + const DefaultServer + const LogDebug + const LogQueueSize + const LogStandard + const LogVerbose + const PlayerHost + const PlayerUnknown + const UpdateDuration + func NetworkAndAddress(address string) (string, string) + func Nickname(nick string) string + type ClientInterface interface + Attach func(in chan<- GameCommandInterface, out <-chan GameCommandInterface) + Detach func(reason string) + type Command int + const CommandDisconnect + const CommandGameOver + const CommandJoinGame + const CommandMessage + const CommandNewGame + const CommandNickname + const CommandPing + const CommandPong + const CommandQuitGame + const CommandReceiveGarbage + const CommandSendGarbage + const CommandStartGame + const CommandUnknown + const CommandUpdateGame + const CommandUpdateMatrix + func (c Command) String() string + type ConnectingPlayer struct + Client ClientInterface + Name string + type Game struct + Event chan interface{} + FallTime time.Duration + GameOver bool + Local bool + LocalPlayer int + LogLevel int + Minos []mino.Mino + NextPlayer int + Players map[int]*Player + Rank int + Seed int64 + SentGameOverMatrix bool + Started bool + Starting bool + Terminated bool + func NewGame(rank int, out func(GameCommandInterface), logger chan string, ...) (*Game, error) + func (g *Game) AddPlayer(p *Player) + func (g *Game) AddPlayerL(p *Player) + func (g *Game) HandleReadCommands(in chan GameCommandInterface) + func (g *Game) Log(level int, a ...interface{}) + func (g *Game) Logf(level int, format string, a ...interface{}) + func (g *Game) ProcessAction(a event.GameAction) + func (g *Game) RemovePlayer(playerID int) + func (g *Game) RemovePlayerL(playerID int) + func (g *Game) Reset() + func (g *Game) ResetL() + func (g *Game) Start(seed int64) int64 + func (g *Game) StartL(seed int64) int64 + func (g *Game) StopL() + func (g *Game) WriteAll(gc GameCommandInterface) + func (g *Game) WriteAllAndLogL(gc GameCommandInterface) + func (g *Game) WriteAllL(gc GameCommandInterface) + func (g *Game) WriteMessage(message string) + type GameCommand struct + SourcePlayer int + func (gc *GameCommand) SetSource(source int) + func (gc *GameCommand) Source() int + type GameCommandGameOver struct + Player int + Winner string + func (gc GameCommandGameOver) Command() Command + type GameCommandInterface interface + Command func() Command + SetSource func(int) + Source func() int + type GameCommandJoinGame struct + GameID int + Name string + PlayerID int + func (gc GameCommandJoinGame) Command() Command + type GameCommandMessage struct + Message string + Player int + func (gc GameCommandMessage) Command() Command + type GameCommandNickname struct + Nickname string + Player int + func (gc GameCommandNickname) Command() Command + type GameCommandPing struct + Message string + func (gc GameCommandPing) Command() Command + type GameCommandPong struct + Message string + func (gc GameCommandPong) Command() Command + type GameCommandQuitGame struct + Player int + func (gc GameCommandQuitGame) Command() Command + type GameCommandReceiveGarbage struct + Lines int + func (gc GameCommandReceiveGarbage) Command() Command + type GameCommandSendGarbage struct + Lines int + func (gc GameCommandSendGarbage) Command() Command + type GameCommandStartGame struct + Seed int64 + Started bool + func (gc GameCommandStartGame) Command() Command + type GameCommandTransport struct + Command Command + Data json.RawMessage + type GameCommandUpdateGame struct + Players map[int]string + func (gc GameCommandUpdateGame) Command() Command + type GameCommandUpdateMatrix struct + Matrixes map[int]*mino.Matrix + func (gc GameCommandUpdateMatrix) Command() Command + type IncomingPlayer struct + Conn *ServerConn + Name string + type Player struct + Matrix *mino.Matrix + Name string + Preview *mino.Matrix + Score int + func NewPlayer(name string, conn *ServerConn) *Player + type Server struct + Games map[int]*Game + I []ServerInterface + In chan GameCommandInterface + Logger chan string + NewPlayers chan *IncomingPlayer + Out chan GameCommandInterface + func NewServer(si []ServerInterface) *Server + func (s *Server) FindGame(p *Player, gameID int) *Game + func (s *Server) Listen(address string) + func (s *Server) Log(a ...interface{}) + func (s *Server) Logf(format string, a ...interface{}) + func (s *Server) NewGame() (*Game, error) + func (s *Server) StopListening() + type ServerConn struct + Conn net.Conn + ForwardOut chan GameCommandInterface + In chan GameCommandInterface + LastTransfer time.Time + Player int + Terminated bool + func Connect(address string) *ServerConn + func NewServerConn(conn net.Conn, forwardOut chan GameCommandInterface) *ServerConn + func (s *ServerConn) Close() + func (s *ServerConn) JoinGame(name string, gameID int, logger chan string, draw chan event.DrawObject) (*Game, error) + func (s *ServerConn) Write(gc GameCommandInterface) + type ServerInterface interface + Host func(newPlayers chan<- *IncomingPlayer) + Shutdown func(reason string)