netplay

package
v0.0.0-...-e65b098 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_PLAYERS = 64

Variables

View Source
var FRAME_DELAY int64 = 2 // default frame delay set to 2, could use ping instead
View Source
var MAX_FRAME_DELAY int64 = 6
View Source
var Synchronized = false

Functions

func AdvanceFrame

func AdvanceFrame(inputs []byte, disconnectFlags int64)

func BoolToByte

func BoolToByte(inputs [input.ActionLast]bool) []byte

func ByteToBool

func ByteToBool(inputs []byte) [input.ActionLast]bool

func DisconnectPlayer

func DisconnectPlayer(player int64)

func GetCurrentTimeMS

func GetCurrentTimeMS() uint64

func Idle

func Idle()

func Init

func Init(numPlayers int64, players []ggponet.GGPOPlayer, localPort string, numSpectators int64, test bool)

func InitSpectator

func InitSpectator(numPlayers int64, hostIp string, hostPort uint64)

func RandBoolSlice

func RandBoolSlice() [input.ActionLast]bool

func RunFrame

func RunFrame()

Types

type Callbacks

type Callbacks struct{}

func (*Callbacks) AdvanceFrame

func (c *Callbacks) AdvanceFrame(flags int64)

func (*Callbacks) BeginGame

func (c *Callbacks) BeginGame(game string) bool

func (*Callbacks) LoadGameState

func (c *Callbacks) LoadGameState(buffer []byte, length int64)

func (*Callbacks) LogGameState

func (c *Callbacks) LogGameState(filename string, buffer *byte, len int64)

func (*Callbacks) OnEvent

func (c *Callbacks) OnEvent(info *ggponet.GGPOEvent)

func (*Callbacks) SaveGameState

func (c *Callbacks) SaveGameState(buffer []byte, length *int64, checksum *int64, frame int64)

type ChecksumInfo

type ChecksumInfo struct {
	FrameNumber int64
	Checksum    int64
}

type NonGameState

type NonGameState struct {
	LocalPlayerHandle ggponet.GGPOPlayerHandle
	Players           [MAX_PLAYERS]PlayerConnectionInfo
	NumPlayers        int64
	Now               ChecksumInfo
	Periodic          ChecksumInfo
}

func (*NonGameState) SetAllConnectState

func (n *NonGameState) SetAllConnectState(state PlayerConnectState)

func (*NonGameState) SetConnectState

func (n *NonGameState) SetConnectState(handle ggponet.GGPOPlayerHandle, state PlayerConnectState)

func (*NonGameState) SetDisconnectTimeout

func (n *NonGameState) SetDisconnectTimeout(handle ggponet.GGPOPlayerHandle, when int64, timeout int64)

func (*NonGameState) UpdateConnectProgress

func (n *NonGameState) UpdateConnectProgress(handle ggponet.GGPOPlayerHandle, progress int64)

type PlayerConnectState

type PlayerConnectState int64
const (
	Connecting    PlayerConnectState = 0
	Synchronizing PlayerConnectState = 1
	Running       PlayerConnectState = 2
	Disconnected  PlayerConnectState = 3
	Disconnecting PlayerConnectState = 4
)

type PlayerConnectionInfo

type PlayerConnectionInfo struct {
	Type              ggponet.GGPOPlayerType
	Handle            ggponet.GGPOPlayerHandle
	State             PlayerConnectState
	ConnectProgress   int64
	DisconnectTimeout int64
	DisconnectStart   int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL