loki

package module
v0.0.0-...-93c852a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

Loki

Loki is an Entity-Component-System (ECS) game engine. Loki is compatible with but does not depend on ebitengine.

Loki is under construction/not ready for use.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batch

func Batch[U Component, V any](u *Update, op ops.RowOperation[Entity, V], fn func(Entity, V) (U, bool))

func Execute

func Execute[V any, U Component](u *Update, op ops.RowOperation[Entity, V], fn func(Entity, V) (U, bool))

func IsEphemeral

func IsEphemeral(col reflect.Type) bool

func Set

func Set(store store.Store[Entity], entity Entity, components ...Component)

Types

type Attribute

type Attribute[T AttributeType] struct{}

func (Attribute[T]) Value

func (Attribute[T]) Value() T

type AttributeType

type AttributeType interface {
	Component
	// contains filtered or unexported methods
}

type Behavior

type Behavior[T BehaviorType] struct{}

func (Behavior[T]) Value

func (Behavior[T]) Value() T

type BehaviorType

type BehaviorType interface {
	Component
	// contains filtered or unexported methods
}

type Component

type Component interface {
	// contains filtered or unexported methods
}

type ComponentKey

type ComponentKey interface {
	Component

	Value() Component
	Type() reflect.Type
	// contains filtered or unexported methods
}

func KeyFor

func KeyFor(c Component) ComponentKey

func KeyOf

func KeyOf[C Component]() ComponentKey

type Context

type Context interface {
	Parent() Context
	Store() Store
	Value(any) any
	Done() <-chan struct{}
}

type Entity

type Entity int64

An Entity is an object in the [Surface]. This excludes terrain and built structures. Positive entities represent long-lived objects and negative entities represent transient objects, like projectiles.

The zero entity is not used.

type Ephemeral

type Ephemeral[T EphemeralType] struct{}

func (Ephemeral[T]) Value

func (Ephemeral[T]) Value() T

type EphemeralType

type EphemeralType interface {
	Component
	// contains filtered or unexported methods
}

type MultiSystem

type MultiSystem []System

func (MultiSystem) Append

func (s MultiSystem) Append(others ...System) MultiSystem

func (MultiSystem) Apply

func (s MultiSystem) Apply(u *Update)

func (MultiSystem) InsertAfter

func (s MultiSystem) InsertAfter(target System, others ...System) MultiSystem

func (MultiSystem) InsertBefore

func (s MultiSystem) InsertBefore(target System, others ...System) MultiSystem

type NoSystem

type NoSystem struct{}

func (NoSystem) Apply

func (NoSystem) Apply(u *Update)

type SlottedComponent

type SlottedComponent interface {
	Component
	GetSlot() int
}

type Store

type Store interface {
	store.Store[Entity]
	Begin() StoreSnapshot
}

type StoreRoot

type StoreRoot interface {
	Store

	// DeleteColumn deletes an entire column.
	//
	// TODO: This is not a good solution.
	DeleteColumn(reflect.Type)

	Flatten()
}

type StoreSnapshot

type StoreSnapshot interface {
	Store
	Commit()
}

type System

type System interface {
	Apply(*Update)
}

type SystemFunc

type SystemFunc func(*Update)

func (SystemFunc) Apply

func (f SystemFunc) Apply(update *Update)

type SystemFunc2

type SystemFunc2 func(update, next *Update)

func (SystemFunc2) Apply

func (f SystemFunc2) Apply(update *Update)

type Update

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

func (*Update) Begin

func (u *Update) Begin(keyValues ...any) *Update

func (*Update) Commit

func (u *Update) Commit()

func (*Update) Done

func (u *Update) Done() <-chan struct{}

func (*Update) Parent

func (u *Update) Parent() Context

func (*Update) Root

func (u *Update) Root() Context

func (*Update) Span

func (u *Update) Span() fixed.Fixed

func (*Update) Store

func (u *Update) Store() Store

func (*Update) Value

func (u *Update) Value(key any) any

type UpdateSource

type UpdateSource struct {
	Context   Context
	WorkQueue *internal.WorkQueue
}

func (UpdateSource) New

func (s UpdateSource) New(span fixed.Fixed, keyValues ...any) *Update

Directories

Path Synopsis
2d
ebiten
examples
asset-library command
bunnymark command
chat command
crawl command
pong command
punch command
ops
v0
Package store (v0) is a minimal, non-performant implementation store.Store.
Package store (v0) is a minimal, non-performant implementation store.Store.
v1
Package store (v1) is the baseline implementation of store.Store.
Package store (v1) is the baseline implementation of store.Store.

Jump to

Keyboard shortcuts

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