tag

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tag is the tags an entity carries: a family's Tags, a component of up to MaxTagsPerFamily bits, each a Tag its owner defines by name and the store saves by name. Tags are the owners' technique, not a user's vocabulary: a user says roles, names, groups and commands. Any stands for whatever an entity carries, for a host matching pairs.

Tags and markers

A family's bits serve two ways. Tags are groups: what an entity is (a role, its owners); its template gives them (comp.Tagged) and they seldom change. Markers are states an entity switches on and off, often or for a single step: an owner has every entity carry its family of markers for good (comp.Marks) and switches one by writing its bit.

Putting a component on an entity or taking it off moves the entity to another place in memory, some 200 ns each time, against a nanosecond or two for a bit. So a state that changes often, or lasts a step, is a marker; a state that lasts, on few entities, which a pass wants to walk alone, is a component of its own.

Index

Constants

View Source
const MaxTagsPerFamily = 64

MaxTagsPerFamily is how many tags one family holds, bounded by Tags.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anything

type Anything struct{}

Anything is the family of Any, the tag every entity carries.

type Tag

type Tag[F any] uint8

Tag is one bit of a family: what world.Kinds.DefineTag hands out.

var Any Tag[Anything]

Any stands for "whatever it is" on a side of a pair rule.

func (Tag[F]) In

func (t Tag[F]) In(s Tags[F]) bool

In reports whether s carries t: t.In is a condition of the entities carrying it, for a render.Rule.

type Tags

type Tags[F any] uint64

Tags is one family of tags on an entity: a component holding up to 64 bits, one per tag of the family F, an empty type the family is named by. Giving or taking a tag inside the family is a value write, seen the same tick.

func (Tags[F]) Has

func (s Tags[F]) Has(t Tag[F]) bool

Has reports whether t is set.

func (Tags[F]) With

func (s Tags[F]) With(tags ...Tag[F]) Tags[F]

With returns s with every tag set.

func (Tags[F]) Without

func (s Tags[F]) Without(tags ...Tag[F]) Tags[F]

Without returns s with every tag cleared.

Jump to

Keyboard shortcuts

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