Documentation ¶
Index ¶
- type Conn
- type Context
- type InputBuf
- func (b *InputBuf) Append(prev *InputFrame, ictx *input.Context)
- func (b *InputBuf) AppendFrame(prev, frame InputFrame)
- func (b *InputBuf) Decode(frames *InputFrames) error
- func (b *InputBuf) MarshalBinary() ([]byte, error)
- func (b *InputBuf) Skip(frames uint64) *InputBuf
- func (b *InputBuf) UnmarshalBinary(buf []byte) error
- type InputFrame
- type InputFrames
- type MatchState
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { State MatchState Signal *scnet.Signal Game *scnet.Game }
func (*Conn) UpdateState ¶
type Context ¶
type Context struct { LocalInputs InputFrames RemoteInputs InputFrames Known State Predicted State Drop uint8 Dropped bool // contains filtered or unexported fields }
type InputBuf ¶
type InputBuf struct { StartFrame uint64 Length uint64 FrameAdv int64 Packed []byte Bits uint8 // number of bits remaining in final byte of packed buffer }
func (*InputBuf) AppendFrame ¶
func (b *InputBuf) AppendFrame(prev, frame InputFrame)
func (*InputBuf) Decode ¶
func (b *InputBuf) Decode(frames *InputFrames) error
func (*InputBuf) MarshalBinary ¶
func (*InputBuf) UnmarshalBinary ¶
type InputFrames ¶
type InputFrames []InputFrame
InputFrames is a slice of InputFrame. The index in the slice corresponds to the frame number.
func (InputFrames) Predict ¶
func (f InputFrames) Predict(num uint64) InputFrame
Predict returns the predicted input for a specified frame number. If the frame is known, the actual input is returned. Otherwise, the last known input is returned.
type MatchState ¶
type MatchState int
const ( StateMatchmakingWait MatchState = iota StateMatchmakingConnecting StateMatchReady StateConnectionFailed )
MatchState constants.
type State ¶
type State interface { // Frame returns the current frame number. Frame() uint64 // Update advances the frame number by 1 and processes the game's logic. // There should be no externally visible effects of this function call. Update(p1, p2 InputFrame) // Clone makes a copy of the State. Clone() State // OnRollback is called when a rollback occurs. The game should reset // all externally visible state. (eg. sound effects) OnRollback() // OnFrame is called after Update if the changes to the state should be // made externally visible. OnFrame() }
Click to show internal directories.
Click to hide internal directories.