limbov1

package module
v0.0.0-...-5188bb3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: GPL-3.0 Imports: 14 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
View Source
const MaxNetConnTypes = math.MaxUint8

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 GetDescriptor

func GetDescriptor(v net.Conn) uintptr

func InitNetModule

func InitNetModule() errnov1.Code

func LocationOf

func LocationOf(i int, j int) location

func NewComponent

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

func NewComponentB

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

func SystemExists

func SystemExists[T any]() bool

func SystemPtr

func SystemPtr[T any]() *T

func SystemRegister

func SystemRegister[T any](allocFn func(*System)) bool

Types

type ActivateFn

type ActivateFn = func() bool

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) Len

func (x *ComponentManager) Len(v Compotype) int

func (*ComponentManager) Navigate2

func (x *ComponentManager) Navigate2(i location, buff *Component) errnov1.Code

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 DeactivateFn

type DeactivateFn = func()

type DestroyFn

type DestroyFn = func()

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 InitFn

type InitFn = func() errnov1.Code

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]) ForEachB

func (x *Iterator[T]) ForEachB(condFn func(T) bool) bool

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 NetConn

type NetConn uint64

func MakeNetConn

func MakeNetConn() NetConn

func (NetConn) Closer

func (x NetConn) Closer() uint64

func (NetConn) Gen

func (x NetConn) Gen() uint8

func (NetConn) Id

func (x NetConn) Id() uint64

func (NetConn) SetGen

func (x NetConn) SetGen(v uint8) NetConn

func (NetConn) SetId

func (x NetConn) SetId(v uint64) NetConn

func (NetConn) SetType

func (x NetConn) SetType(v NetConnType) NetConn

func (NetConn) Type

func (x NetConn) Type() NetConnType

type NetConnType

type NetConnType uint8

func (NetConnType) Closer

func (x NetConnType) Closer() uint8

func (NetConnType) Int

func (x NetConnType) Int() int

type NetConnTypeManager

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

func NetConnTypes

func NetConnTypes() *NetConnTypeManager

func (*NetConnTypeManager) Count

func (x *NetConnTypeManager) Count() int

func (*NetConnTypeManager) Init

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

func (*NetConnTypeManager) Register

func (x *NetConnTypeManager) Register(buff *NetConnType) bool

func (*NetConnTypeManager) Reset

func (x *NetConnTypeManager) Reset()

type NetHandlerFn

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

type NetHandlerManager

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

func NetworkHandlers

func NetworkHandlers() *NetHandlerManager

func (*NetHandlerManager) Exist

func (*NetHandlerManager) Get

func (*NetHandlerManager) Init

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

func (*NetHandlerManager) Register

func (x *NetHandlerManager) Register(nett NetConnType, msgt NetMessageType, fn NetHandlerFn) bool

func (*NetHandlerManager) Unregister

func (x *NetHandlerManager) Unregister(v NetworkHandler)

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) String

func (x *NetMessage) String() string

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 MakeNetworkHandler

func MakeNetworkHandler(nett NetConnType, msgt NetMessageType) NetworkHandler

func (NetworkHandler) Closer

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

func (NetworkHandler) ConnType

func (x NetworkHandler) ConnType() NetConnType

func (NetworkHandler) MsgType

func (x NetworkHandler) MsgType() NetMessageType

type NetworkManager

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

func Networks

func Networks() *NetworkManager

func (*NetworkManager) Addr

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

func (*NetworkManager) Connect

func (x *NetworkManager) Connect(conn net.Conn, typ NetConnType, buff *NetConn) errnov1.Code

func (*NetworkManager) Connection

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

func (*NetworkManager) Count

func (x *NetworkManager) Count() int

func (*NetworkManager) Destroy

func (x *NetworkManager) Destroy(v NetConn)

func (*NetworkManager) Handle

func (x *NetworkManager) Handle(v NetConn, buff *uintptr) bool

func (*NetworkManager) Init

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

func (NetworkManager) IsAlive

func (x NetworkManager) IsAlive(v NetConn) bool

func (*NetworkManager) TCPAddr

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

func (*NetworkManager) Type

func (x *NetworkManager) Type(v NetConn) NetConnType

type System

type System struct {
	Instance   unsafe.Pointer
	Init       InitFn
	Activate   ActivateFn
	Update     UpdateFn
	Deactivate DeactivateFn
	Destroy    DestroyFn
}

type SystemManager

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

func Systems

func Systems() *SystemManager

func (*SystemManager) Activate

func (x *SystemManager) Activate() bool

func (*SystemManager) Contains

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

func (*SystemManager) Count

func (x *SystemManager) Count() int

func (*SystemManager) Deactivate

func (x *SystemManager) Deactivate()

OnDeActivate implements [ISystem].

func (*SystemManager) Destroy

func (x *SystemManager) Destroy()

func (*SystemManager) Init

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

func (*SystemManager) Load

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

func (*SystemManager) Register

func (x *SystemManager) Register(allocFn func(*System) uintptr) bool

func (*SystemManager) System

func (x *SystemManager) System(v uintptr) *System

func (*SystemManager) Update

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

type UpdateFn

type UpdateFn = func(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

func (*World) CreateCompotype

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

func (*World) CreateEntity

func (x *World) CreateEntity() Entity

func (*World) Deactivate

func (x *World) Deactivate()

func (*World) Destroy

func (x *World) Destroy()

func (*World) Init

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

func (*World) Ticks

func (x *World) Ticks() uint64

func (*World) Update

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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