Documentation
¶
Index ¶
- Constants
- type Callbacks
- type Event
- type GameStateType
- type HdrType
- type InputAckType
- type InputType
- type MsgType
- type Netplay
- func (n *Netplay) Disconnect() ggponet.GGPOErrorCode
- func (n *Netplay) GetEvent(e *Event) bool
- func (n *Netplay) GetNetworkStats(s *ggponet.GGPONetworkStats)
- func (n *Netplay) GetPeerConnectStatus(id int64, frame *int64) bool
- func (n *Netplay) HandlesMsg(addr *net.UDPAddr) bool
- func (n *Netplay) HostConnection(conn *net.UDPConn) *net.UDPConn
- func (n *Netplay) Init(remotePlayer ggponet.GGPOPlayer, localPort string, queue int64, ...)
- func (n *Netplay) IsSynchronized() bool
- func (n *Netplay) OnGameState(msg *NetplayMsgType) bool
- func (n *Netplay) OnInput(msg *NetplayMsgType) bool
- func (n *Netplay) OnInputAck(msg *NetplayMsgType) bool
- func (n *Netplay) OnKeepAlive(msg *NetplayMsgType) bool
- func (n *Netplay) OnLoopPoll() bool
- func (n *Netplay) OnMsg(msg *NetplayMsgType)
- func (n *Netplay) OnQualityReply(msg *NetplayMsgType) bool
- func (n *Netplay) OnQualityReport(msg *NetplayMsgType) bool
- func (n *Netplay) OnSyncReply(msg *NetplayMsgType) bool
- func (n *Netplay) OnSyncRequest(msg *NetplayMsgType) bool
- func (n *Netplay) PumpSendQueue()
- func (n *Netplay) QueueEvent(e *Event)
- func (n *Netplay) Read()
- func (n *Netplay) RecommendFrameDelay() int64
- func (n *Netplay) SendGameState(state lib.SavedFrame)
- func (n *Netplay) SendInput(input *lib.GameInput)
- func (n *Netplay) SendMsg(msg *NetplayMsgType)
- func (n *Netplay) SendPendingOutput()
- func (n *Netplay) SendSyncRequest()
- func (n *Netplay) SetDisconnectNotifyStart(timeout int64)
- func (n *Netplay) SetDisconnectTimeout(timeout int64)
- func (n *Netplay) SetLocalFrameNumber(localFrame int64)
- func (n *Netplay) Synchronize()
- func (n *Netplay) UpdateNetworkStats()
- func (n *Netplay) Write(msg *NetplayMsgType)
- type NetplayMsgType
- type OoPacket
- type QualityReplyType
- type QualityReportType
- type QueueEntry
- type RunningType
- type State
- type StateType
- type SyncReplyType
- type SyncRequestType
- type SyncType
- type Synchronizing
- type TypeEvent
Constants ¶
View Source
const ( MAX_COMPRESSED_BITS = 4096 MSG_MAX_PLAYERS = ggponet.GGPO_MAX_PLAYERS )
View Source
const ( UDP_HEADER_SIZE = 28 /* Size of IP + UDP headers */ NUM_SYNC_PACKETS = 5 SYNC_RETRY_INTERVAL = 2000 SYNC_FIRST_RETRY_INTERVAL = 500 RUNNING_RETRY_INTERVAL = 200 KEEP_ALIVE_INTERVAL = 200 QUALITY_REPORT_INTERVAL = 1000 NETWORK_STATS_INTERVAL = 1000 UDP_SHUTDOWN_TIMER = 5000 MAX_SEQ_DISTANCE = (1 << 15) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks interface {
OnMsg(recvAddr *net.UDPAddr, msg *NetplayMsgType)
}
type Event ¶
type Event struct {
Type TypeEvent
Input lib.GameInput
SavedFrame lib.SavedFrame
Synchronizing Synchronizing
DisconnectTimeout int64
}
type GameStateType ¶
type GameStateType struct {
PeerConnectStatus []ggponet.ConnectStatus
StartFrame int64
Checksum int64
}
type InputAckType ¶
type InputAckType struct {
AckFrame int64
}
type Netplay ¶
type Netplay struct {
Callbacks *Callbacks
Conn *net.UDPConn
LocalAddr *net.UDPAddr
RemoteAddr *net.UDPAddr
Queue int64
LastReceivedInput lib.GameInput
LastAckedInput lib.GameInput
LastSentInput lib.GameInput
LocalConnectStatus []ggponet.ConnectStatus
LocalFrameAdvantage int64
RemoteFrameAdvantage int64
RoundTripTime int64
PeerConnectStatus []ggponet.ConnectStatus
TimeSync lib.TimeSync
CurrentState State
PendingOutput lib.RingBuffer
LastSendTime uint64
MagicNumber uint64
RemoteMagicNumber uint64
Connected bool
NextSendSeq uint64
SendQueue lib.RingBuffer
EventQueue lib.RingBuffer
SendLatency int64
OopPercent int64
OoPacket OoPacket
NetplayState StateType
ReceiveChannel chan NetplayMsgType
ReceiveAddr chan *net.UDPAddr
DisconnectNotifyStart int64
DisconnectNotifySent bool
NextRecvSeq uint64
DisconnectTimeout int64
DisconnectEventSent bool
LastRecvTime uint64
ShutDownTimeout int64
StatsStartTime uint64
KbpsSent int64
BytesSent int64
PacketsSent int64
IsInitialized bool
}
func (*Netplay) Disconnect ¶
func (n *Netplay) Disconnect() ggponet.GGPOErrorCode
func (*Netplay) GetNetworkStats ¶
func (n *Netplay) GetNetworkStats(s *ggponet.GGPONetworkStats)
func (*Netplay) GetPeerConnectStatus ¶
func (*Netplay) Init ¶
func (n *Netplay) Init(remotePlayer ggponet.GGPOPlayer, localPort string, queue int64, status []ggponet.ConnectStatus, poll *lib.Poll, callbacks *Callbacks)
func (*Netplay) IsSynchronized ¶
func (*Netplay) OnGameState ¶
func (n *Netplay) OnGameState(msg *NetplayMsgType) bool
func (*Netplay) OnInput ¶
func (n *Netplay) OnInput(msg *NetplayMsgType) bool
func (*Netplay) OnInputAck ¶
func (n *Netplay) OnInputAck(msg *NetplayMsgType) bool
func (*Netplay) OnKeepAlive ¶
func (n *Netplay) OnKeepAlive(msg *NetplayMsgType) bool
func (*Netplay) OnLoopPoll ¶
func (*Netplay) OnMsg ¶
func (n *Netplay) OnMsg(msg *NetplayMsgType)
func (*Netplay) OnQualityReply ¶
func (n *Netplay) OnQualityReply(msg *NetplayMsgType) bool
func (*Netplay) OnQualityReport ¶
func (n *Netplay) OnQualityReport(msg *NetplayMsgType) bool
func (*Netplay) OnSyncReply ¶
func (n *Netplay) OnSyncReply(msg *NetplayMsgType) bool
func (*Netplay) OnSyncRequest ¶
func (n *Netplay) OnSyncRequest(msg *NetplayMsgType) bool
func (*Netplay) PumpSendQueue ¶
func (n *Netplay) PumpSendQueue()
func (*Netplay) QueueEvent ¶
func (*Netplay) RecommendFrameDelay ¶
func (*Netplay) SendGameState ¶
func (n *Netplay) SendGameState(state lib.SavedFrame)
func (*Netplay) SendMsg ¶
func (n *Netplay) SendMsg(msg *NetplayMsgType)
func (*Netplay) SendPendingOutput ¶
func (n *Netplay) SendPendingOutput()
func (*Netplay) SendSyncRequest ¶
func (n *Netplay) SendSyncRequest()
func (*Netplay) SetDisconnectNotifyStart ¶
func (*Netplay) SetDisconnectTimeout ¶
func (*Netplay) SetLocalFrameNumber ¶
func (*Netplay) Synchronize ¶
func (n *Netplay) Synchronize()
func (*Netplay) UpdateNetworkStats ¶
func (n *Netplay) UpdateNetworkStats()
func (*Netplay) Write ¶
func (n *Netplay) Write(msg *NetplayMsgType)
type NetplayMsgType ¶
type NetplayMsgType struct {
ConnectStatus ggponet.ConnectStatus
Hdr HdrType
SyncRequest SyncRequestType
SyncReply SyncReplyType
QualityReport QualityReportType
QualityReply QualityReplyType
Input InputType
InputAck InputAckType
GameState GameStateType
}
func (*NetplayMsgType) Init ¶
func (n *NetplayMsgType) Init(t MsgType)
func (*NetplayMsgType) PacketSize ¶
func (n *NetplayMsgType) PacketSize() int64
func (*NetplayMsgType) PayloadSize ¶
func (n *NetplayMsgType) PayloadSize() int64
type QualityReplyType ¶
type QualityReplyType struct {
Pong int64
}
type QualityReportType ¶
type QueueEntry ¶
type QueueEntry struct {
QueueTime uint64
DestAddr *net.UDPAddr
Msg *NetplayMsgType
}
func (*QueueEntry) Init ¶
func (q *QueueEntry) Init(time uint64, dst *net.UDPAddr, m *NetplayMsgType)
type RunningType ¶
type StateType ¶
type StateType struct {
Sync SyncType
Running RunningType
}
type SyncReplyType ¶
type SyncReplyType struct {
RandomReply uint64 /* OK, here's your random data back */
}
type SyncRequestType ¶
type Synchronizing ¶
Click to show internal directories.
Click to hide internal directories.