serdes

package
v0.0.0-...-bf9f9cd Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinWorldUpdate

type BinWorldUpdate struct {
	Tick       uint16
	PlayerTick uint16
	UserId     uint64
	WorldData  map[uint32][]net.Union
	Delete     []ecs.Id
}

type ClientLogin

type ClientLogin struct {
	UserId uint64
}

type ClientLoginResp

type ClientLoginResp struct {
	UserId uint64
	Id     ecs.Id
}

type ClientLogout

type ClientLogout struct {
	UserId uint64
}

type ClientLogoutResp

type ClientLogoutResp struct {
	UserId uint64
	Id     ecs.Id
}

type Serdes

type Serdes struct {
	// contains filtered or unexported fields
}

func New

func New() *Serdes

func (*Serdes) Marshal

func (s *Serdes) Marshal(v any) ([]byte, error)

func (*Serdes) Unmarshal

func (s *Serdes) Unmarshal(dat []byte) (any, error)

type WorldUpdate

type WorldUpdate struct {
	Tick       uint16
	PlayerTick uint16
	UserId     uint64
	WorldData  map[ecs.Id][]ecs.Component
	// WorldData EntityMap // TODO - might be nice to reduce the BinWorldUpdate to just the entity map
	Delete []ecs.Id
}

TODO - for delta encoding of things that have to be different like ecs.Ids, if you encode the number as 0 then that could indicate that "we needed more bytes to encode the delta"

func (WorldUpdate) MarshalBinary

func (w WorldUpdate) MarshalBinary() ([]byte, error)

func (*WorldUpdate) UnmarshalBinary

func (w *WorldUpdate) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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