Documentation
¶
Index ¶
- Constants
- type Player
- type Room
- type RoomEvent
- type Server
- func (s *Server) LeaveRoom(player *Player)
- func (s *Server) OnClose(conn *gws.Conn, err error)
- func (s *Server) OnMessage(conn *gws.Conn, message *gws.Message)
- func (s *Server) OnOpen(conn *gws.Conn)
- func (s *Server) OnPing(conn *gws.Conn, payload []byte)
- func (s *Server) OnPong(conn *gws.Conn, payload []byte)
- type ServerRpcError
- type TConv
- type TSeq
- type UDPServer
Constants ¶
View Source
const ( IKCP_MTU_SIZE = 900 IKCP_MAX_MESSAGE_SIZE = 4096 MAX_INPUTS_PER_PLAYER_PER_FRAME = 10 MAX_PLAYERS_PER_ROOM = 8 MIN_FRAME_RATE = 1 )
View Source
const ( OpPing = iota OpPong OpServerInput OpClientFrame )
View Source
const ( PingInterval = 20 * time.Second PingWait = 10 * time.Second PendingPlayerTimeout = 10 * time.Second )
View Source
const ( RoomEventPreJoin = "pre_join" RoomEventJoin = "join" RoomEventLeave = "leave" RoomEventJoinTimeout = "join_timeout" RoomEventKcpReady = "kcp_ready" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Player ¶
type Room ¶
type Room struct {
Port int `msgpack:"port"`
Version string `msgpack:"version"`
MaxPlayers int `msgpack:"max_players"`
FrameRate int `msgpack:"frame_rate"`
Players map[TConv]*Player `msgpack:"players"`
FrameID TSeq `msgpack:"frame_id"`
// contains filtered or unexported fields
}
func (*Room) WriteToUDP ¶
type Server ¶
type ServerRpcError ¶
type ServerRpcError string
const ( ErrOK = "" ErrRoomNotFound ServerRpcError = "room_not_found" ErrRoomNotInitialized ServerRpcError = "room_not_initialized" ErrMaxPlayersExceeded ServerRpcError = "max_players_exceeded" ErrVersionMismatch ServerRpcError = "version_mismatch" ErrAlreadyJoinedRoom ServerRpcError = "already_joined_room" ErrPlayerJoinTimeout ServerRpcError = "player_join_timeout" ErrNoAvailablePort ServerRpcError = "no_available_port" )
Click to show internal directories.
Click to hide internal directories.