limbov1

package module
v0.0.0-...-3b7ca01 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NETMSG_MAGIC_VALUE           = uint32(0xBEEEAAA3)
	NETMSG_VERSION               = 1
	NETMSG_HEADER_SIZE           = 64
	NETMSG_PAYLOAD_MAX_LENGTH    = 1 << 20
	NETMSG_GCM_SIZE              = 16
	NETMSG_RESERVE_SIZE          = 16
	NETMSG_PAYLOAD_WITH_GCM_SIZE = NETMSG_PAYLOAD_MAX_LENGTH + NETMSG_GCM_SIZE
	NETMSG_SIZE                  = NETMSG_HEADER_SIZE + NETMSG_PAYLOAD_MAX_LENGTH + NETMSG_GCM_SIZE // + gcm tag (16)
)
View Source
const ConnectionsMax = uint64(0xFFFF_FFFF_FFFF_0000)
View Source
const MaxCompotypes = 1<<8 - 1

Variables

This section is empty.

Functions

func ComponentPtr

func ComponentPtr[T any](e Entity, t Compotype) *T

func ContainsComponent

func ContainsComponent(e Entity, t Compotype) bool

func DestroyComponent

func DestroyComponent(e Entity, t Compotype)

func NewComponent

func NewComponent[T any](e Entity, t Compotype, buff *Component) *T

func NewComponentB

func NewComponentB[T any](e Entity, t Compotype) *T

Types

type Component

type Component uint64

func ComponentFor

func ComponentFor(e Entity, t Compotype) Component

FFFF__FFFF_FFFF_FFFF type_ent

func (Component) Closer

func (x Component) Closer() uint64

func (Component) Compotype

func (x Component) Compotype() Compotype

func (Component) Entity

func (x Component) Entity() Entity

type ComponentManager

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

func Components

func Components() *ComponentManager

func (*ComponentManager) Components

func (x *ComponentManager) Components() [][]unsafe.Pointer

func (*ComponentManager) Contains

func (x *ComponentManager) Contains(v Component) bool

func (*ComponentManager) ContainsA

func (x *ComponentManager) ContainsA(e Entity, t Compotype) bool

func (*ComponentManager) Destroy

func (x *ComponentManager) Destroy(v Component)

func (*ComponentManager) FindFirstEntity

func (x *ComponentManager) FindFirstEntity(t Compotype, buff *Entity, condFn func(Entity, unsafe.Pointer) bool) bool

func (*ComponentManager) Get

func (*ComponentManager) Init

func (x *ComponentManager) Init() errnov1.Code

func (*ComponentManager) IterateB

func (x *ComponentManager) IterateB(v Compotype, fn func(Entity, unsafe.Pointer))

func (*ComponentManager) IterateC

func (x *ComponentManager) IterateC(e Entity, handlerFn func(t Compotype, ptr unsafe.Pointer))

func (*ComponentManager) Iterator

func (*ComponentManager) New

func (x *ComponentManager) New(e Entity, t Compotype, buff *Component) errnov1.Code

func (*ComponentManager) OnActivate

func (x *ComponentManager) OnActivate()

OnActivate implements [ISystemComponent].

func (*ComponentManager) OnAllLoaded

func (x *ComponentManager) OnAllLoaded()

func (*ComponentManager) OnPreLoad

func (x *ComponentManager) OnPreLoad()

OnPreLoad implements [ISystemComponent].

func (*ComponentManager) OnUnLoad

func (x *ComponentManager) OnUnLoad()

OnUnLoad implements [ISystemComponent].

type ComponentMask

type ComponentMask [32]byte

func CreateComponentMask

func CreateComponentMask() ComponentMask

func (ComponentMask) Get

func (x ComponentMask) Get(id int) byte

func (ComponentMask) Get64

func (x ComponentMask) Get64(id int) uint64

func (ComponentMask) Has

func (x ComponentMask) Has(v Compotype) bool

func (ComponentMask) IsEmpty

func (x ComponentMask) IsEmpty() bool

func (ComponentMask) Len

func (x ComponentMask) Len() int

in bytes

func (ComponentMask) Reset

func (x ComponentMask) Reset()

func (ComponentMask) Set64

func (x ComponentMask) Set64(id int, v uint64) ComponentMask

func (ComponentMask) String

func (x ComponentMask) String() string

func (ComponentMask) With

func (ComponentMask) With8

func (x ComponentMask) With8(id int, v uint8) ComponentMask

func (ComponentMask) With16

func (x ComponentMask) With16(id int, v uint16) ComponentMask

func (ComponentMask) With32

func (x ComponentMask) With32(id int, v uint32) ComponentMask

func (ComponentMask) With64

func (x ComponentMask) With64(id int, v uint64) ComponentMask

func (ComponentMask) WithB

func (x ComponentMask) WithB(v ...Compotype) ComponentMask

func (ComponentMask) Without

func (x ComponentMask) Without(i Compotype) ComponentMask

type Compotype

type Compotype uint8

func (Compotype) Closer

func (x Compotype) Closer() uint8

func (Compotype) Int

func (x Compotype) Int() int

func (Compotype) String

func (x Compotype) String() string

type CompotypeAllocator

type CompotypeAllocator func() unsafe.Pointer

type CompotypeManager

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

func Compotypes

func Compotypes() *CompotypeManager

func (*CompotypeManager) Allocate

func (x *CompotypeManager) Allocate(v Compotype) unsafe.Pointer

func (*CompotypeManager) Init

func (x *CompotypeManager) Init() errnov1.Code

func (*CompotypeManager) Register

func (x *CompotypeManager) Register(allocFn CompotypeAllocator, buff *Compotype) bool

type ConnectionId

type ConnectionId uint64

func CreateConnectionId

func CreateConnectionId() ConnectionId

func (ConnectionId) Closer

func (x ConnectionId) Closer() uint64

func (ConnectionId) Id

func (x ConnectionId) Id() uint64

func (ConnectionId) Protocol

func (x ConnectionId) Protocol() uint8

func (ConnectionId) SetId

func (x ConnectionId) SetId(v uint64) ConnectionId

func (ConnectionId) SetProtocol

func (x ConnectionId) SetProtocol(v uint8) ConnectionId

func (ConnectionId) SetState

func (x ConnectionId) SetState(v uint8) ConnectionId

func (ConnectionId) State

func (x ConnectionId) State() uint8

type ConnectionProtocol

type ConnectionProtocol uint8
const (
	UnknownConnProto ConnectionProtocol = 0
	TCPConnProto     ConnectionProtocol = 1
	WsConnProto      ConnectionProtocol = 1 << 1
	UDPConnProto     ConnectionProtocol = 1 << 2
)

func (ConnectionProtocol) Closer

func (x ConnectionProtocol) Closer() uint8

func (ConnectionProtocol) Int

func (x ConnectionProtocol) Int() int

func (ConnectionProtocol) String

func (x ConnectionProtocol) String() string

type Entity

type Entity uint64

func CreateEntity

func CreateEntity(id uint32, gen uint16) Entity

func (Entity) Closer

func (x Entity) Closer() uint64

func (Entity) Gen

func (x Entity) Gen() uint16

func (Entity) Id

func (x Entity) Id() uint32

type EntityManager

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

func Entities

func Entities() *EntityManager

func (*EntityManager) Cleanup

func (x *EntityManager) Cleanup()

func (*EntityManager) Count

func (x *EntityManager) Count() int

func (*EntityManager) Create

func (x *EntityManager) Create() Entity

func (*EntityManager) Destroy

func (x *EntityManager) Destroy(v Entity)

DestroyEntitySystem -> ent.Destroy -> sync Publish("entity.destroy")

func (*EntityManager) Has

func (x *EntityManager) Has(e Entity, t Compotype) bool

func (*EntityManager) HasComponent

func (x *EntityManager) HasComponent(e Entity, t Compotype) bool

func (*EntityManager) HasComponentB

func (x *EntityManager) HasComponentB(e Entity, t Compotype) bool

func (*EntityManager) Init

func (x *EntityManager) Init() errnov1.Code

func (*EntityManager) IsAlive

func (x *EntityManager) IsAlive(v Entity) bool

func (*EntityManager) Iterator

func (x *EntityManager) Iterator() *Iterator[Entity]

func (*EntityManager) Mask

func (x *EntityManager) Mask(v Entity) ComponentMask

func (*EntityManager) Masks

func (x *EntityManager) Masks() []ComponentMask

func (*EntityManager) SetMask

func (x *EntityManager) SetMask(e Entity, v ComponentMask)

func (*EntityManager) WithComponent

func (x *EntityManager) WithComponent(e Entity, v Compotype)

func (*EntityManager) WithComponents

func (x *EntityManager) WithComponents(e Entity, v ...Compotype)

func (*EntityManager) WithoutComponent

func (x *EntityManager) WithoutComponent(e Entity, v Compotype)

type Event

type Event struct {
	Name string
	Data any
}

type EventManager

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

func Events

func Events() *EventManager

func (*EventManager) Count

func (x *EventManager) Count() int

func (*EventManager) Destroy

func (x *EventManager) Destroy()

func (*EventManager) Init

func (x *EventManager) Init() errnov1.Code

func (*EventManager) PostPublisherRun

func (x *EventManager) PostPublisherRun()

func (*EventManager) Publish

func (x *EventManager) Publish(n string, v any)

func (*EventManager) PublishAsync

func (x *EventManager) PublishAsync(n string, v any)

PublishAsync implements [IManager].

func (*EventManager) Subscribe

func (x *EventManager) Subscribe(k string, v ListenerFn) uint64

func (*EventManager) Unsubscribe

func (x *EventManager) Unsubscribe(id uint64)

type ISystem

type ISystem interface {
	Load() errnov1.Code

	OnAllLoaded()

	Activate() bool
	Update(dt time.Duration)
	Deactivate()

	Unload()
}

type Iterator

type Iterator[T comparable] struct {
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator[T comparable](v []T) *Iterator[T]

func (*Iterator[T]) Count

func (x *Iterator[T]) Count() int

func (*Iterator[T]) First

func (x *Iterator[T]) First(buff *T, fn func(T) bool) bool

func (*Iterator[T]) ForEach

func (x *Iterator[T]) ForEach(fn func(T))

func (*Iterator[T]) Get

func (x *Iterator[T]) Get() T

func (*Iterator[T]) HasNext

func (x *Iterator[T]) HasNext() bool

func (Iterator[T]) Next

func (x Iterator[T]) Next()

func (*Iterator[T]) Reset

func (x *Iterator[T]) Reset()

type ListenerEntry

type ListenerEntry struct {
	Id  uint64
	Lis ListenerFn
}

type ListenerFn

type ListenerFn func(string, any)

type NetMessage

type NetMessage byte

NetMessage

func NetMessageOf

func NetMessageOf(v []byte) *NetMessage

func (*NetMessage) Builder

func (x *NetMessage) Builder() *NetMessageBuilder

func (*NetMessage) Bytes

func (x *NetMessage) Bytes(len int) []byte

func (*NetMessage) BytesB

func (x *NetMessage) BytesB(offset, len int) []byte

func (*NetMessage) Closer

func (x *NetMessage) Closer() *byte

func (*NetMessage) Flags

func (x *NetMessage) Flags() NetMessageFlag

func (*NetMessage) Header

func (x *NetMessage) Header() *byte

func (*NetMessage) HeaderChecksum

func (x *NetMessage) HeaderChecksum() uint32

func (*NetMessage) HeaderRealChecksum

func (x *NetMessage) HeaderRealChecksum() uint32

func (*NetMessage) KeyID

func (x *NetMessage) KeyID() uint8

func (*NetMessage) Magic

func (x *NetMessage) Magic() uint32

func (*NetMessage) Payload

func (x *NetMessage) Payload() *byte

func (*NetMessage) PayloadChecksum

func (x *NetMessage) PayloadChecksum() uint32

func (*NetMessage) PayloadLen

func (x *NetMessage) PayloadLen() uint32

func (*NetMessage) PayloadRealChecksum

func (x *NetMessage) PayloadRealChecksum() uint32

func (*NetMessage) Reserved

func (x *NetMessage) Reserved() *byte

func (*NetMessage) Sequence

func (x *NetMessage) Sequence() uint32

func (*NetMessage) SessionID

func (x *NetMessage) SessionID() uint64

func (*NetMessage) Timestamp

func (x *NetMessage) Timestamp() uint64

func (*NetMessage) TotalLen

func (x *NetMessage) TotalLen() uint32

func (*NetMessage) Type

func (x *NetMessage) Type() NetMessageType

func (*NetMessage) Version

func (x *NetMessage) Version() uint16

type NetMessageBuilder

type NetMessageBuilder byte

NetMessageBuilder

func (*NetMessageBuilder) Build

func (x *NetMessageBuilder) Build()

func (*NetMessageBuilder) PutFlags

func (*NetMessageBuilder) PutKeyID

func (x *NetMessageBuilder) PutKeyID(v uint8) *NetMessageBuilder

func (*NetMessageBuilder) PutPayloadChecksum

func (x *NetMessageBuilder) PutPayloadChecksum(v uint32) *NetMessageBuilder

func (*NetMessageBuilder) PutPayloadLen

func (x *NetMessageBuilder) PutPayloadLen(v uint32) *NetMessageBuilder

func (*NetMessageBuilder) PutSequence

func (x *NetMessageBuilder) PutSequence(v uint32) *NetMessageBuilder

func (*NetMessageBuilder) PutSessionID

func (x *NetMessageBuilder) PutSessionID(v uint64) *NetMessageBuilder

func (*NetMessageBuilder) PutTimestamp

func (x *NetMessageBuilder) PutTimestamp(v uint64) *NetMessageBuilder

func (*NetMessageBuilder) PutType

func (*NetMessageBuilder) ReserveBytes

func (x *NetMessageBuilder) ReserveBytes(offset int, v *byte, len int) *NetMessageBuilder

type NetMessageFlag

type NetMessageFlag byte

NetMessageFlag

const (
	FlagNone       NetMessageFlag = 0x00
	FlagCompressed NetMessageFlag = 0x01
	FlagEncrypted  NetMessageFlag = 0x02
	FlagSigned     NetMessageFlag = 0x04
)

func (NetMessageFlag) Closer

func (x NetMessageFlag) Closer() byte

func (NetMessageFlag) Contains

func (x NetMessageFlag) Contains(v NetMessageFlag) bool

func (NetMessageFlag) Is

func (NetMessageFlag) With

func (NetMessageFlag) Without

type NetMessageType

type NetMessageType uint32

NetMessageType

func (NetMessageType) Closer

func (x NetMessageType) Closer() uint32

type NetworkHandler

type NetworkHandler [5]byte

func NetworkHandlerFor

func NetworkHandlerFor(proto ConnectionProtocol, typ NetMessageType) NetworkHandler

func (NetworkHandler) Closer

func (x NetworkHandler) Closer() [5]byte

func (NetworkHandler) Proto

func (NetworkHandler) Type

func (x NetworkHandler) Type() NetMessageType

type NetworkHandlerFn

type NetworkHandlerFn func(Entity, *byte, uint32) errnov1.Code

type NetworkHandlerManager

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

func NetworkHandlers

func NetworkHandlers() *NetworkHandlerManager

func (*NetworkHandlerManager) Exist

func (*NetworkHandlerManager) Get

func (*NetworkHandlerManager) Init

func (*NetworkHandlerManager) Register

func (*NetworkHandlerManager) Unregister

func (x *NetworkHandlerManager) Unregister(v NetworkHandler)

type NetworkManager

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

func Networks

func Networks() *NetworkManager

func (*NetworkManager) Addr

func (x *NetworkManager) Addr(v ConnectionId) net.Addr

func (*NetworkManager) Connect

func (x *NetworkManager) Connect(con net.Conn, buff *ConnectionId) errnov1.Code

func (*NetworkManager) ConnectB

func (x *NetworkManager) ConnectB(conn net.Conn, proto uint8, buff *ConnectionId) errnov1.Code

func (*NetworkManager) Connection

func (x *NetworkManager) Connection(v ConnectionId) net.Conn

Connection implements [IConnectionManager].

func (*NetworkManager) Count

func (x *NetworkManager) Count() int

Count implements [IConnectionManager].

func (*NetworkManager) Destroy

func (x *NetworkManager) Destroy(v ConnectionId)

Destroy implements [IConnectionManager].

func (*NetworkManager) Init

func (x *NetworkManager) Init() errnov1.Code

func (NetworkManager) IsAlive

func (x NetworkManager) IsAlive(v ConnectionId) bool

func (*NetworkManager) OnAllLoaded

func (x *NetworkManager) OnAllLoaded()

func (*NetworkManager) Protocol

func (x *NetworkManager) Protocol(v ConnectionId) uint8

func (*NetworkManager) TCPAddr

func (x *NetworkManager) TCPAddr(v ConnectionId) *net.TCPAddr

type SystemManager

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

func Systems

func Systems() *SystemManager

func (*SystemManager) Activate

func (x *SystemManager) Activate() bool

OnActivate implements [ISystemComponent].

func (*SystemManager) Contains

func (x *SystemManager) Contains(v string) bool

func (*SystemManager) Count

func (x *SystemManager) Count() int

func (*SystemManager) Create

func (x *SystemManager) Create(k string, v ISystem) int

func (*SystemManager) Deactivate

func (x *SystemManager) Deactivate()

OnDeActivate implements ISystem.

func (*SystemManager) Destroy

func (x *SystemManager) Destroy(v string)

func (*SystemManager) Load

func (x *SystemManager) Load() errnov1.Code

func (*SystemManager) OnAllLoaded

func (x *SystemManager) OnAllLoaded()

func (*SystemManager) System

func (x *SystemManager) System(v string) ISystem

func (*SystemManager) SystemByIndex

func (x *SystemManager) SystemByIndex(v int) ISystem

func (*SystemManager) SystemTypeByIndex

func (x *SystemManager) SystemTypeByIndex(v int) string

func (*SystemManager) Unload

func (x *SystemManager) Unload()

OnUnLoad implements [ISystemComponent].

func (*SystemManager) Update

func (x *SystemManager) Update(dt time.Duration)

type WorkerManager

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

func Workers

func Workers() *WorkerManager

func (*WorkerManager) Cancel

func (x *WorkerManager) Cancel(v string) bool

func (*WorkerManager) Close

func (x *WorkerManager) Close()

func (*WorkerManager) Destroy

func (x *WorkerManager) Destroy(v string)

func (*WorkerManager) Init

func (x *WorkerManager) Init() errnov1.Code

func (*WorkerManager) Run

func (x *WorkerManager) Run(ttl time.Duration, jobFn func(context.Context)) string

type World

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

func GetWorld

func GetWorld() *World

func (*World) Activate

func (x *World) Activate() bool

OnActivate implements ISystem.

func (*World) CreateCompotype

func (x *World) CreateCompotype(allocFn CompotypeAllocator, buff *Compotype) bool

func (*World) CreateEntity

func (x *World) CreateEntity() Entity

func (*World) CreateSystem

func (x *World) CreateSystem(name string, v ISystem) int

func (*World) Deactivate

func (x *World) Deactivate()

OnDeActivate implements ISystem.

func (*World) Load

func (x *World) Load() errnov1.Code

func (*World) OnAllLoaded

func (x *World) OnAllLoaded()

OnAllLoaded implements ISystem.

func (*World) Ticks

func (x *World) Ticks() uint64

func (*World) Unload

func (x *World) Unload()

OnUnLoad implements ISystem.

func (*World) Update

func (x *World) Update(dt time.Duration)

Jump to

Keyboard shortcuts

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