Versions in this module Expand all Collapse all v1 v1.6.0 Apr 11, 2020 Changes in this version + const LagDelay + const LagRecoverDelay + const ObsDisabled + var ErrColorOccupied = errors.New("lobby: Color occupied") + var ErrDesync = errors.New("lobby: Timeslot checksum mismatch") + var ErrFull = errors.New("lobby: Lobby is full") + var ErrHighPing = errors.New("lobby: Ping exceeds lag recovery delay") + var ErrInvalidArgument = errors.New("lobby: Invalid argument") + var ErrInvalidPacket = errors.New("lobby: Invalid packet") + var ErrInvalidSlot = errors.New("lobby: Invalid slot") + var ErrLocked = errors.New("lobby: Lobby is locked") + var ErrMapUnavailable = errors.New("lobby: Map unavailable") + var ErrNotReady = errors.New("lobby: Player was not ready") + var ErrPlayersOccupied = errors.New("lobby: No player slots left") + var ErrSlotOccupied = errors.New("lobby: Slot occupied") + var ErrStraggling = errors.New("lobby: Player was straggling") + type Game struct + LagObservers bool + LagTimeout time.Duration + LoadTimeout time.Duration + TurnRate int + func NewGame(encoding w3gs.Encoding, slotInfo w3gs.SlotInfo, mapInfo w3gs.MapCheck) *Game + func (g *Game) EnqueueAction(a *w3gs.PlayerAction) + func (g *Game) InitDefaultHandlers() + func (g *Game) Stage() Stage + func (g *Game) Start() error + func (g *Game) Tick() Tick + type Lobby struct + ColorSet protocol.BitSet32 + ObsTeam uint8 + ReadyTimeout time.Duration + ShareAddr bool + func NewLobby(encoding w3gs.Encoding, slotInfo w3gs.SlotInfo, mapInfo w3gs.MapCheck) *Lobby + func (l *Lobby) Accept(conn net.Conn) (*Player, error) + func (l *Lobby) ChangeColor(sid int, c uint8) error + func (l *Lobby) ChangeComputer(sid int, ai w3gs.AI) error + func (l *Lobby) ChangeHandicap(sid int, h uint8) error + func (l *Lobby) ChangeRace(sid int, r w3gs.RacePref) error + func (l *Lobby) ChangeTeam(sid int, t uint8) error + func (l *Lobby) Close() + func (l *Lobby) CloseAllSlots() error + func (l *Lobby) CloseSlot(sid int, kick bool) error + func (l *Lobby) CountPlayers() int + func (l *Lobby) JoinAndServe(conn net.Conn, join *w3gs.Join) (*Player, error) + func (l *Lobby) Lock() + func (l *Lobby) OpenAllSlots() error + func (l *Lobby) OpenSlot(sid int, kick bool) error + func (l *Lobby) Player(id uint8) *Player + func (l *Lobby) SendToAll(pkt w3gs.Packet) + func (l *Lobby) ShuffleSlots(shuffleTeams bool) error + func (l *Lobby) SlotInfo() *w3gs.SlotInfo + func (l *Lobby) SlotsAvailable() int + func (l *Lobby) SlotsUsed() int + func (l *Lobby) SwapSlots(slotA int, slotB int) error + func (l *Lobby) Unlock() + func (l *Lobby) Wait() + type Player struct + PingInterval time.Duration + PlayerInfo w3gs.PlayerInfo + StartTime time.Time + func NewPlayer(info *w3gs.PlayerInfo) *Player + func (p *Player) BattleTag() string + func (p *Player) DequeueAck() (checksum uint32, ok bool, more bool) + func (p *Player) InitDefaultHandlers() + func (p *Player) Kick(reason w3gs.LeaveReason) + func (p *Player) Lag() bool + func (p *Player) LeaveReason() w3gs.LeaveReason + func (p *Player) RTT() uint32 + func (p *Player) Ready() bool + func (p *Player) Run() error + func (p *Player) SendOrClose(pkt w3gs.Packet) (int, error) + func (p *Player) Tick() Tick + type PlayerChat struct + type PlayerJoined struct + type PlayerLeft struct + type Ready struct + type Stage uint32 + const StageDone + const StageLoading + const StageLobby + const StagePlaying + func (s Stage) String() string + type StageChanged struct + New Stage + Old Stage + type StartLag struct + type StopLag struct + type Tick uint32