 ### LANGUAGE [RU](./README_RU.md) [EN](./README.md) ___ ### [BENCHMARKS](./Benchmark.md) ### [Unity module](https://github.com/Felid-Force-Studios/StaticEcs-Unity) # Static ECS - C# Entity component system framework - Lightweight - Performance - No allocations - No dependencies - No Unsafe - Based on statics and structures - Type-safe - Free abstractions - Powerful query engine - No boilerplate - Compatible with Unity and other C# engines #### Limitations and Features: > - Not thread safe > - There may be minor API changes ## Table of Contents * [Contacts](#contacts) * [Installation](#installation) * [Quick start](#quick-start) * [Concept](#concept) * [Main types](#main-types) * [Entity](#entity) * [PackedEntity](#packedentity) * [Component](#component) * [StandardComponent](#standardComponent) * [Tag](#tag) * [Mask](#mask) * [WorldType](#WorldType) * [Ecs](#ecs) * [World](#world) * [Systems](#systems) * [Context](#context) * [Query](#query) * [Additional features](#additional-features) * [Component identifiers](#component-identifiers) * [Auto handlers](#auto-handlers) * [Events](#events) * [Relations](#relation) * [Performance](#perfomance) * [Engine integration](#engine-integration) * [Unity](#unity) * [FAQ](#faq) * [License](#license) # Contacts * [Telegram](https://t.me/felid_force_studios) # Installation * ### As source code From the release page or as an archive from the branch. In the `master` branch there is a stable tested version * ### Installation for Unity git module `https://github.com/Felid-Force-Studios/StaticEcs.git` in Unity PackageManager or adding it to `Packages/manifest.json` # Quick start ```csharp using FFS.Libraries.StaticEcs; // Define components public struct Position : IComponent { public Vector3 Val; } public struct Velocity : IComponent { public float Val; } // Define the world type public struct MyWorldType : IWorldType { } // Define type-aliases for easy access to library types public abstract class MyEcs : Ecs { } public abstract class MyWorld : MyEcs.World { } // Define the systems type public struct MySystemsType : ISystemsType { } // Define type-alias for easy access to systems public abstract class MySystems : MyEcs.Systems { } // Define systems public readonly struct VelocitySystem : IUpdateSystem { public void Update() { foreach (var entity in MyWorld.QueryEntities.For>()) { entity.RefMut().Val *= entity.Ref().Val; } } } public class Program { public static void Main() { // Creating world data MyEcs.Create(EcsConfig.Default()); // Registering components MyWorld.RegisterComponentType(); MyWorld.RegisterComponentType(); // Initializing the world MyEcs.Initialize(); // Creating systems MySystems.Create(); MySystems.AddUpdate(new VelocitySystem()); // Initializing systems MySystems.Initialize(); // Creating entity var entity = MyEcs.Entity.New( new Velocity { Val = 1f }, new Position { Val = Vector3.One } ); // Update all systems - called in every frame MySystems.Update(); // Destroying systems MySystems.Destroy(); // Destroying the world and deleting all data MyEcs.Destroy(); } } ```