Skip to content

friflo/Friflo.Engine-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo        SPLASH

Github Repo Demos Wiki

Friflo.Engine.ECS  ·  API Reference

This project contains the C# API reference of Friflo Engine ECS - GitHub.

Namespace Description
Friflo.Engine.ECS Contains types and methods to query, add, remove or change Entity's in an EntityStore.
Friflo.Engine.ECS.Collections Contains types to enable data binding for common .NET applications.
Friflo.Engine.ECS.Index Enables search for indexed component values in O(1) for types: string, int, enum, float, Guid, DateTime, ....
Support efficient entity relationships like entity links (foreign keys) and back links (JOIN's).
Friflo.Engine.ECS.Serialize Contains types and methods to serialize / deserialize Entity's as JSON.
Friflo.Engine.ECS.Systems Used to organize and execute a set of systems within a SystemRoot.
Friflo.Engine.ECS.Utils Utility types and methods typically used by generic libraries.

Common used structs and classes.

Type Description
EntityStore class Container of entities. Typically called World in other implementations.
Entity struct An object in an EntityStore. Contains components, tags, scripts and child entities.
IComponent interface Attribute structs as component types.
ITag interface Attribute structs as tags.
Script class Base class of scripts that can be added to entities.
ArchetypeQuery class Used to return components and entities matching the assigned query filter.
QueryJob class Enables parallel query execution.
ParallelJobRunner class Required for parallel (multi threaded) query execution.
CommandBuffer class Record entity changes on arbitrary threads and Playback() them on the main thread.
EventFilter class Used to filter structural changes made to entities like added/removed components/tags.
EventRecorder class Record entity changes like adding/removing commands/tags. Required for EventFilter's.
EntityBatch class Used to optimize adding/removing components/tags to entities via a fluent API.
CreateEntityBatch class Used to optimize entity creation via a fluent API.
EntitySerializer class Enables serialization of entities to / from JSON.

Hello World

The hello world examples demonstrates the creation of some entities
and their movement using a simple ForEachEntity() call.

Much more examples at Friflo.Engine.ECS · Examples

public struct Velocity : IComponent { public Vector3 value; }

public static void HelloWorld()
{
    var store = new EntityStore();
    for (int n = 0; n < 10; n++) {
        store.CreateEntity(new Position(n, 0, 0), new Velocity{ value = new Vector3(0, n, 0)});
    }
    var query = store.Query<Position, Velocity>();
    query.ForEachEntity((ref Position position, ref Velocity velocity, Entity entity) => {
        position.value += velocity.value;
    });
}

Interactive Browser Demo showing MonoGame WebAssembly integration. Try out Demo.
Note: WebGL rendering performance cannot compete with Desktop build.

Releases

No releases published

Packages

No packages published