steer

package
v0.0.0-...-20810c9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

The steer package contains steering behaviors for autonomous movement.

Concepts: - Target - Selector

Behaviors - Match velocity = given a query around the subject and all applicable entities, try to match their velocity magnitude - Alignment = given a query around the subject - Cohesion -

Accumulators

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior interface {
	GetForce(subject Subject, dt float32) Force
}

type CustomData

type CustomData struct {
	Definition *CustomDataDefinition
	Ints       []int
	Bools      []bool
	Floats     []float32
	Strings    []string
}

func NewCustomData

func NewCustomData(def *CustomDataDefinition) CustomData

func (*CustomData) Bool

func (cd *CustomData) Bool(name id.Identifier) *bool

func (*CustomData) Float

func (cd *CustomData) Float(name id.Identifier) *float32

func (*CustomData) Int

func (cd *CustomData) Int(name id.Identifier) *int

func (*CustomData) String

func (cd *CustomData) String(name id.Identifier) *string

type CustomDataDefinition

type CustomDataDefinition struct {
	Name       id.Identifier
	Properties id.SparseMap[CustomDataProperty, uint16]
	Counts     []int
}

func NewCustomDataDefinition

func NewCustomDataDefinition(name id.Identifier) *CustomDataDefinition

func (*CustomDataDefinition) Add

func (def *CustomDataDefinition) Add(name id.Identifier, dataType CustomDataType)

func (*CustomDataDefinition) New

func (def *CustomDataDefinition) New() CustomData

type CustomDataProperty

type CustomDataProperty struct {
	Name      id.Identifier
	Type      CustomDataType
	TypeIndex int
}

type CustomDataType

type CustomDataType int
const (
	CustomDataTypeInt CustomDataType = iota
	CustomDataTypeBool
	CustomDataTypeFloat
	CustomDataTypeString
	CustomDataTypeCount
)

type Field

type Field struct {
	Name   id.Identifier
	Params []Param
	Type   Typ
}

type Filter

type Filter func(subject Subject, object Object) bool

type Force

type Force struct {
	Scale    float32
	Velocity []float32
	Weight   float32
}

type ForceGenerator

type ForceGenerator interface {
	GenerateForces(subject Subject, dt float32, gen func(Force))
}

type Object

type Object struct {
}

type ObjectSource

type ObjectSource interface {
	GetObject() Object
}

type Param

type Param struct {
	Name    id.Identifier
	Type    Typ
	Default *Val
}

type Query

type Query struct {
	Position []float32
}

type Subject

type Subject struct {
	Object

	MaximumVelocity float32
}

type SubjectSource

type SubjectSource interface {
	GetSubject() Subject
}

type Typ

type Typ struct {
	Name id.Identifier
}

type Val

type Val struct {
	Type string
	Data *data.Bytes
}

Jump to

Keyboard shortcuts

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