Friflo.Engine.ECS.md

December 3, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS Namespace

Contains types and methods to query, add, remove or change Entity's in an EntityStore.

Classes
ArchetypeAn Archetype store entities with a specific set of IComponent and ITag types.
See Example.
ArchetypeQueryArchetypeQuery and all its generic implementations are designed to be reused.
By default, a query does not contain Disabled entities. Use WithDisabled() if needed.
See Example.
ArchetypeQuery<T1,T2,T3,T4,T5>A query instance use to retrieve the given component types. See Example.
ArchetypeQuery<T1,T2,T3,T4>A query instance use to retrieve the given component types. See Example.
ArchetypeQuery<T1,T2,T3>A query instance use to retrieve the given component types. See Example.
ArchetypeQuery<T1,T2>A query instance use to retrieve the given component types. See Example.
ArchetypeQuery<T1>A query instance use to retrieve the given component types. See Example.
ArchetypeUtils
BatchAlreadyAppliedExceptionIs thrown if using a batch returned by Batch() after calling Apply().
BatchAlreadyReturnedExceptionIs thrown if using a batch returned by Batch(bool) with autoReturn: true
after calling CreateEntity().
ChunkExtensions
CollectionExtensions
CommandBufferA command buffer recording entity changes and execute these changes when calling Playback().
CommandBuffer is not thread safe. To record changes on arbitrary threads use Synced.
See Example.
CommandBufferSyncedSame functionality as CommandBuffer but thread safe.
Use this command buffer to record entity changes in parallel queries executed via RunParallel().
ComponentKeyAttributeAssign a custom key used for JSON serialization for annotated IComponent and Script types.
If specified key is null The component type is not serialized.
ComponentSymbolAttributeShort symbol for a component, tag or script in UI or console as a name (max 3 chars) and a color.
Prefer using single character names for common used symbols. Consider Unicode characters.
ComponentTypeProvide meta data for an IComponent struct.
CreateEntityBatchA create batch is used to optimize entity creation.
Components and tags are buffered before creating an entity with CreateEntity().
See Example.
EntityBatchAn entity batch is a container of component and tag commands that can be Apply()'ed to an entity.
It can be used on a single entity via Batch() or as a bulk operation an a set of entities.
EntityEqualityComparerUsed to check if two Entity instances are the same entity by comparing their Id's.
EntityExtensionsProvide extension methods to optimize Entity modifications.
Add() and Remove() cause only none or one structural change.
EntityListA list of entities of a specific EntityStore used to apply changes to all entities in the container.
It's recommended to reuse instances of this class to avoid unnecessary allocations.
See Example.
EntityReadOnlyCollection
EntitySchemaProvide type information about all ITag, IComponent and Script types available in the application.
EntityStoreAn EntityStore is a container for Entity's their components, scripts, tags and the tree structure.
See Example.
EntityStoreBaseStore the IComponents and ITag for the Entity's of an EntityStore.
EntityStoreExtensionsProvide generic CreateEntity() overloads to create entities with passed components without any structural change.
EntityUtils
EventFilterUsed to filter structural changes made to an entity like added / removed components / tags using HasEvent(int).
The EventRecorder must be enabled to get add / remove events.
See Example.
EventRecorderUsed to record events of structural changes like add/remove component/tag.
The recorder is required to filter these events using an EventFilter.
GenericInstanceTypeAttributeThe attribute is required to register specific type instances of generic component and tags types. See example in remarks.
IndexExtensionsProvide extension methods to query all or specific component values.
Enables to query all or specific entity links (relationships).
MissingComponentExceptionIs thrown when calling Entity.Set() on an entity missing the specified components.
NativeAOT
ParallelJobRunnerRequired for parallel - multi threaded - query job execution using RunParallel().
See Example.
QueryFilterContains component and tags filters added to an ArchetypeQuery.
Multiple ArchetypeQuery's can share a single QueryFilter instance.
QueryJobA QueryJob enables Parallel query execution using multiple threads to reduce execution time of large queries.
They are created by the ArchetypeQuery.ForEach() methods.
QueryJob<T1,T2,T3,T4,T5>Enables Parallel query execution returning the specified components. See Example.
QueryJob<T1,T2,T3,T4>Enables Parallel query execution returning the specified components. See Example.
QueryJob<T1,T2,T3>Enables Parallel query execution returning the specified components. See Example.
QueryJob<T1,T2>Enables Parallel query execution returning the specified components. See Example.
QueryJob<T1>Enables Parallel query execution returning the specified components. See Example.
RawEntityStoreA RawEntityStore enables using an entity store without using Entity's.
RelationExtensions
SchemaTypeProvide meta data for Script classes and IComponent / ITag structs.
ScriptTo enable adding a script class to an Entity it need to extend Script.
See Example.
ScriptTypeProvide meta data for a Script class.
SignatureA Signature specify the IComponent types used to query entity components
using the EntityStore.Query(Signature) methods.
StoreDispatcherContains methods to dispatch execution of System.Action's or System.Func<>'s to the main thread.
TagNameAttributeAssign a custom tag name used for JSON serialization for annotated structs implementing ITag.
TagTypeProvide meta data for an ITag struct.
Structs
ChildEntitiesReturn the child entities of an Entity.
To iterate all entities with child entities use TreeNode in a Query().
ChildEntitiesChangedIs the event for event handlers added to OnChildEntitiesChanged or OnChildEntitiesChanged.
ChildEnumeratorUse to enumerate the child entities stored in Entity.ChildEntities.
Chunk<T>A Chunk<T> is container of struct components of Type T.
ChunkEntitiesProvide the entity Id's for Chunk<T> components using Ids or this[int].
ChunkEntitiesEnumeratorUsed to enumerate the Entity's of ChunkEntities.
ChunkEnumerator<T1,T2,T3,T4,T5>
ChunkEnumerator<T1,T2,T3,T4>
ChunkEnumerator<T1,T2,T3>
ChunkEnumerator<T1,T2>
ChunkEnumerator<T1>
Chunks<T1,T2,T3,T4,T5>Contains the components returned by a component query. See Example.
Chunks<T1,T2,T3,T4>Contains the components returned by a component query. See Example.
Chunks<T1,T2,T3>Contains the components returned by a component query. See Example.
Chunks<T1,T2>Contains the components returned by a component query. See Example.
Chunks<T1>Contains the components returned by a component query. See Example.
ComponentChangedIs the event for event handlers added to OnComponentChanged, OnComponentAdded or OnComponentRemoved.
ComponentEnumeratorEnumerate the components of an entity by iterating EntityComponents.
ComponentIndex<TIndexedComponent,TValue>The index for IIndexedComponent<TValue> struct's to search entities with a specific component value in O(1).
An instance is returned via ComponentIndex<TIndexedComponent,TValue>(this EntityStore).
ComponentTypesComponentTypes define a set of IComponent's used to list the component System.Type's of an Archetype.
ComponentTypesEnumeratorReturn the IComponent types of ComponentTypes.
DebugEventHandlerUsed as item type in DebugEventHandlers providing the number of handlers for a specific event Type.
DebugEventHandlersProvide the event / signal handlers of an entity using Entity.DebugEventHandlers.
DisabledIf entity Enabled == false it is tagged with Disabled.
Disabled entities are excluded from query results by default. To include use WithDisabled().
EngineDependant
Entities
EntitiesChanged
EntitiesEnumeratorUsed to enumerate the Entities of an ArchetypeQuery.
EntityRepresent an object in an EntityStore - e.g. a cube in a game scene.
It is the main API to deal with entities in the engine.
See Example.
EntityComponentAn item in EntityComponents containing an entity IComponent.
EntityComponentsReturn the IComponent's added to an Entity.
EntityCreateIs the event for event handlers added to OnEntityCreate.
EntityDataAn EntityData is used to optimize access of entity components and tags.
An instance can be returned by Data.
EntityDeleteIs the event for event handlers added to OnEntityDelete.
EntityEnumerator
EntityEventThe information about a structural change recorded by the EventRecorder.
EntityLink
EntityLink<TComponent>
EntityLinkEnumerator
EntityLinkEnumerator<T>
EntityLinks
EntityLinks<T>
EntityListEnumeratorEnumerates the entities of an EntityList.
EntityNameCan be added to an Entity to provide a descriptive name for debugging or in an editor.
EntityNodeUsed by the EntityStore to store Entity components, scripts, tags and child entities internally as an array of nodes.
EntityReadOnlyCollectionEnumerator
EntityRelations<TRelation>Storage for all entity relations of the specified TRelation type.
An instance is returned via EntityRelations<TRelation>(this EntityStore).
EntityScriptsReturn the Script's added to an Entity.
EntityScriptsEnumeratorUsed to enumerate the Script's added to an Entity.
EntityStoreInfo
LinkComponentIndex<TLinkComponent>The index for ILinkComponent struct's to search entities with a specific entity in O(1).
Position
QueryChunks<T1,T2,T3,T4,T5>Contains the component chunks returned by a component query. See Example.
QueryChunks<T1,T2,T3,T4>Contains the component chunks returned by a component query. See Example.
QueryChunks<T1,T2,T3>Contains the component chunks returned by a component query. See Example.
QueryChunks<T1,T2>Contains the component chunks returned by a component query. See Example.
QueryChunks<T1>Contains the component chunks returned by a component query. See Example.
QueryEntitiesProvide the result set of an ArchetypeQuery as a set of Entity's.
QueryFilter.FilterConditionContains component and tag filter conditions added to an ArchetypeQuery.
ReadOnlyList<T>Represents a strongly typed readonly list of objects that can be accessed by index.
ReadOnlyListEnumerator<T>Enumerates the elements of a ReadOnlyList<T>.
Relations<TRelation>Contains the relations of a specific entity returned by GetRelations<TRelation>(this Entity).
RelationsEnumerator<TRelation>
RotationRotation encoded as a Quaternion described by the mathematician W.R. Hamilton.
Scale3
ScriptChangedIs the event for event handlers added to OnScriptChanged, OnScriptAdded or OnScriptRemoved.
ScriptsContains the Script's added to an entity.
ScriptsEnumeratorEnumerator for entity Scripts.
Signal<TEvent>Signal<TEvent>'s are used to emit custom events from an entity to custom Signal<TEvent> handlers.
See Example.
Signature<T1,T2,T3,T4,T5>A Signature used to create a query using Query<T1,T2,T3,T4,T5>(Signature<T1,T2,T3,T4,T5>) with five components.
Signature<T1,T2,T3,T4>A Signature to create a query using Query<T1,T2,T3,T4>(Signature<T1,T2,T3,T4>) with four components.
Signature<T1,T2,T3>A Signature to create a query using Query<T1,T2,T3>(Signature<T1,T2,T3>) with three components.
Signature<T1,T2>A Signature to create a query using Query<T1,T2>(Signature<T1,T2>) with two components.
Signature<T1>A Signature to create a query using Query<T1>(Signature<T1>) with one component.
SymbolColorThe color assigned to a component or tag via ComponentSymbolAttribute for display in a UI or CLI.
TagsTags define a set of ITag's used to query entities in an EntityStoreBase.
TagsChangedIs the event for event handlers added to OnTagsChanged or OnTagsChanged.
TagsEnumeratorUsed to enumerate the ITag's stored in Tags.
Transform
TreeNodeA TreeNode component stores the ChildEntities of an Entity.
It is used to build up an entity hierarchy used for scene graphs.
UniqueEntityA UniqueEntity is used to assign a unique string to an entity within an EntityStore.
UnresolvedUnresolved is a container for unresolved entity components.
UnresolvedComponentIs used as item type for Unresolved.components storing unresolved entity components.
UpdateTickSpecify deltaTime and time for system execution in Update(UpdateTick).
Interfaces
ICommandBuffer
IComponentTo enable adding a struct component to an Entity it need to implement IComponent.
IComponent types are structs which only contains data but no script / methods.
See Example.
IEach<T1,T2,T3,T4,T5>
IEach<T1,T2,T3,T4>
IEach<T1,T2,T3>
IEach<T1,T2>
IEach<T1>
IEachEntity<T1,T2,T3,T4,T5>
IEachEntity<T1,T2,T3,T4>
IEachEntity<T1,T2,T3>
IEachEntity<T1,T2>
IEachEntity<T1>
IIndexedComponent<TValue>Is used to define a component type having a single indexed field / property.
Indexed component values can be queried with HasValue() or ValueInRange() in a Query().
ILinkComponentA link component is a component type used to create a single link from one entity to another entity.
Specific component links can be queried with HasValue() in a Query().
ILinkRelationA link relation is a component type used to create multiple links from one entity to other entities.
IRelation
IRelation<TKey>A relation enables adding multiple components of the same type to an entity.
The components added to a single entity build a set of components using the relation TKey as unique identifier.
IStoreDispatcher
ITagUsed to create entity Tag's by declaring a struct without fields or properties extending ITag.
Note: An ITag should be used to tag a group of multiple entities.
See Example.
Enums
ChildEntitiesChangedActionThe modification type of an ChildEntitiesChanged event: Add or Remove entity.
ComponentChangedActionThe modification type of a ComponentChanged event: Remove, Add or Update component.
DebugEntityEventKindEvent type of a DebugEventHandler: Event or Signal.
EntityEventActionThe type of an entity change in EntityEvent.
JobExecutionSpecify the way how ChunkEntities are provided by either a foreach loop, Run() or RunParallel().
NodeFlagsFlags assigned to EntityNode's internally stored in an EntityStore.
PidTypeSpecify the way how an EntityStore generates entity Pid's.
SchemaTypeKindDeclares the Kind of a SchemaType
ScriptChangedActionThe modification type of a ScriptChanged event: Remove, Add or Replace script.
StoreOwnershipDescribe the ownership state of an Entity
TreeMembershipDescribe the membership of an Entity to the EntityStore tree graph.
Delegates
ForEachEntity<T1,T2,T3,T4,T5>(T1, T2, T3, T4, T5, Entity)Provide the state of an entity within ForEachEntity(ForEachEntity<T1,T2,T3,T4,T5>).
ForEachEntity<T1,T2,T3,T4>(T1, T2, T3, T4, Entity)Provide the state of an entity within ForEachEntity(ForEachEntity<T1,T2,T3,T4>).
ForEachEntity<T1,T2,T3>(T1, T2, T3, Entity)Provide the state of an entity within ForEachEntity(ForEachEntity<T1,T2,T3>).
ForEachEntity<T1,T2>(T1, T2, Entity)Provide the state of an entity within ForEachEntity(ForEachEntity<T1,T2>).
ForEachEntity<T1>(T1, Entity)Provide the state of an entity within ForEachEntity(ForEachEntity<T1>).