A fast entity component system (ECS) for C & C++

Overview

flecs

CI build codecov Discord Chat Try online Documentation

Flecs is a fast and lightweight Entity Component System with a focus on high performance game development (join the Discord!). Highlights of the framework are:

  • Fast to compile & integrate in any project with zero-dependency core that is written entirely in C99
  • Provides (SoA) access to raw component arrays for optimal cache efficiency and vectorization
  • Archetype-storage with unique graph-based design enables high performance entity mutations
  • Flexible API primitives allow for efficient implementation of prefabs, runtime tags and entity graphs
  • Supports advanced queries that are entirely evaluated offline to eliminate searching from the main loop
  • Lockless threading design allows for efficient execution of systems on multiple threads
  • A dashboard module for tracking application metrics (see below for repository link):

Screen Shot 2020-12-02 at 1 28 04 AM

What is an Entity Component System?

ECS (Entity Component System) is a design pattern used in games and simulations that produces fast and reusable code. Dynamic composition is a first-class citizen in ECS, and there is a strict separation between data and behavior. A framework is an Entity Component System if it:

  • Has entities that are unique identifiers
  • Has components that are plain data types
  • Has systems which are behavior matched with entities based on their components

Documentation

See Docsforge for a more readable version of the documentation.

Example

This is a simple flecs example in the C99 API:

typedef struct {
  float x;
  float y;
} Position, Velocity;

void Move(ecs_iter_t *it) {
  Position *p = ecs_column(it, Position, 1);
  Velocity *v = ecs_column(it, Velocity, 2);
  
  for (int i = 0; i < it.count; i ++) {
    p[i].x += v[i].x * it->delta_time;
    p[i].y += v[i].y * it->delta_time;
    printf("Entity %s moved!\n", ecs_get_name(it->world, it->entities[i]));
  }
}

int main(int argc, char *argv[]) {
  ecs_world_t *ecs = ecs_init();
    
  ECS_COMPONENT(ecs, Position);
  ECS_COMPONENT(ecs, Velocity);
    
  ECS_SYSTEM(ecs, Move, EcsOnUpdate, Position, [in] Velocity);
    
  ecs_entity_t e = ecs_set(ecs, 0, EcsName, {"MyEntity"});
  ecs_set(ecs, e, Position, {0, 0});
  ecs_set(ecs, e, Velocity, {1, 1});

  while (ecs_progress(ecs, 0)) { }
}

Here is the same example but in the C++11 API:

struct Position {
  float x;
  float y;
};

struct Velocity {
  float x;
  float y;
};

int main(int argc, char *argv[]) {
  flecs::world ecs;

  ecs.system<Position, const Velocity>()
    .each([](flecs::entity e, Position& p, const Velocity& v) {
      p.x += v.x * e.delta_time();
      p.y += v.y * e.delta_time();
      std::cout << "Entity " << e.name() << " moved!" << std::endl;
    });

  ecs.entity("MyEntity")
    .set<Position>({0, 0})
    .set<Velocity>({1, 1});

  while (ecs.progress()) { }
}

Building

The easiest way to add Flecs to a project is to add flecs.c and flecs.h to your source code. These files can be added to both C and C++ projects (the C++ API is embedded in flecs.h). Alternatively you can also build Flecs as a library by using the cmake, meson, bazel or bake buildfiles.

Custom builds

The Flecs source has a modular design which makes it easy to strip out code you don't need. At its core, Flecs is a minimalistic ECS library with a lot of optional features that you can choose to include or not. This section of the manual describes how to customize which features to include.

Software Quality

To ensure stability of Flecs, the code is thoroughly tested on every commit:

  • 40.000 lines of test code, for 18.000 lines of framework code
  • More than 1600 testcases
  • Over 90% code coverage

The code is validated on the following platforms/compilers:

  • Windows
    • msvc
  • Ubuntu
    • gcc 7, 8, 9, 10
    • clang 8, 9
  • MacOS
    • gcc 10
    • clang 9

The framework code and example code is compiled warning free on all platforms with the strictest warning settings. A sanitized build is ran on each commit to test for memory corruption and undefined behavior.

Performance is tracked on a per-release basis, with the results for the latest release published here: https://github.com/SanderMertens/ecs_benchmark

API stability

API (programming interface) stability is guaranteed between minor releases, except in the rare case when an API is found to be an obvious source of confusion or bugs. When breaking changes do happen, the release notes will mention it with potential workarounds.

ABI (binary interface) stability is not guaranteed inbetween versions, as non-opaque types and signatures may change at any point in time, as long as they don't break compilation of code that uses the public API. Headers under include/private are not part of the public API, and may introduce breaking changes at any point.

It is generally safe to use the master branch, which contains the latest version of the code. New features that are on master but are not yet part of a release may still see changes in their API. Once a feature is part of a release, its API will not change until at least the next major release.

Modules

The following modules are available in flecs-hub. Note that modules are mostly intended as example code, and their APIs may change at any point in time.

Module Description
flecs.meta Reflection for Flecs components
flecs.json JSON serializer for Flecs components
flecs.rest A REST interface for introspecting & editing entities
flecs.player Play, stop and pause simulations
flecs.monitor Web-based monitoring of statistics
flecs.dash Web-based dashboard for remote monitoring and debugging of Flecs apps
flecs.components.input Components that describe keyboard and mouse input
flecs.components.transform Components that describe position, rotation and scale
flecs.components.physics Components that describe physics and movement
flecs.components.geometry Components that describe geometry
flecs.components.graphics Components used for computer graphics
flecs.components.gui Components used to describe GUI components
flecs.components.http Components describing an HTTP server
flecs.systems.transform Hierarchical transforms for scene graphs
flecs.systems.sdl2 SDL window creation & input management
flecs.systems.sokol Sokol-based renderer
flecs.systems.civetweb A civetweb-based implementation of flecs.components.http

Useful Links

Supporting Flecs

Supporting Flecs goes a long way towards keeping the project going and the community alive! If you like the project, consider:

Thanks in advance!

Comments
  • Faster table sorting for queries.

    Faster table sorting for queries.

    This PR implements #731

    Heavily work in progress, the implementation is going to take some time so this PR is for additional discussions and tracking progress.

    I will squash commits later if needed.

    opened by bazhenovc 18
  • Entities do not get deleted when registering OnRemove system

    Entities do not get deleted when registering OnRemove system

    By @teksoc-1:

    When doing some test cases of deleting entities and having OnRemove systems registered with components of the deleted entities, the entities seem to not get deleted, and will see them again next iteration. If I do not register OnRemove systems, the entities get deleted as expected, however, when the OnRemove Systems are applied ( and respectively called as expected ), the entities do not get deleted.

    bug 
    opened by SanderMertens 16
  • Undo destruction of entity

    Undo destruction of entity

    Is there any way to revive dead entity? Including its original id?

    I'm making an editor with undo/redo feature, every action is a Command that can be executed or undo its previous execution:

    class Command
    {
    public:
    	virtual ~Command() = default;
    	virtual void execute() = 0;
    	virtual void undo() = 0;
    	virtual bool merge(std::shared_ptr<Command> cmd);
    };
    

    I also have CommandHistory with a buffer of commands:

    class CommandHistory final
    {
    private:
    	const int CAPACITY = 256;
    	std::deque<std::shared_ptr<Command>> buffer;
    	int32_t current = 0;
    public:
    	void add_command(std::shared_ptr<Command> cmd, bool execute = true);
    	void undo();
    	void redo();
    };
    

    Naive CreateEntityCommand like this, ofc, won't work:

    void CreateEntityCommand::execute()
    {
    	auto w = parent.world();
    	created_entity = w.entity().child_of(parent).add<Transform>().set(Name{});
    }
    
    void CreateEntityCommand::undo()
    {
    	created_entity.destruct();
    }
    

    Because every ::execute() will make entity with different id. I tried to store "killed id" after every undo and then use it on every redo ("execute after undo"), but it didn't work well

    Please help, I have a feeling that this can be implemented easily and I'm missing something important...

    question 
    opened by NukeBird 15
  • Enum relation assert on windows with clang

    Enum relation assert on windows with clang

    Describe the bug Adding an enum relation, e.g flecs example, assert on windows when building with clang (tested only with version 13.0) :

    Here is the assert : fatal: entity.c: 2027: assert: name_assigned == ecs_has_pair( world, result, ecs_id(EcsIdentifier), EcsName) INTERNAL_ERROR

    To Reproduce A minimal repo is available here : github repo.

    Or, here is the code :

    #include <flecs.h>
    #include <iostream>
    
    enum class TileStatus {
        Free,
        Occupied
    };
    
    int main(int, char* [])
    {
        flecs::world ecs;
    
        ecs.component<TileStatus>(); //1
        auto tile = ecs.entity().add(TileStatus::Free); // 2 Also assert;
        std::cout << "Tile : " << tile.has<TileStatus>() << "\n";
    }
    

    Expected behavior For the above code to not assert during line 1 or 2.

    Additional context Tested on master

    The above code works on other configurations :

    • windows - msvc
    • linux - clang or gcc

    In release mode, there seem to be no problem, the above code works. However, it seems in more complex configuration, (if we added reflection for example), the code crash (access error).

    Also, here are the logs with flecs::log::set_level(3) :

    info: component TileStatus created
    info: id TileStatus created
    info: id (TileStatus,*) created
    info: id (*,TileStatus) created
    info: table [Component, (Identifier,Name), (Identifier,Symbol), (OnDelete,Panic)] created with id 258
    info: | table [Component, Exclusive, (Identifier,Name), (Identifier,Symbol), (OnDelete,Panic)] created with id 259
    info: | table [Component, Exclusive, OneOf, (Identifier,Name), (Identifier,Symbol), (OnDelete,Panic)] created with id 260
    info: | table [Component, Tag, Exclusive, OneOf, (Identifier,Name), (Identifier,Symbol), (OnDelete,Panic)] created with id 261
    fatal: entity.c: 1933: assert: name_assigned == ecs_has_pair( world, result, ecs_id(EcsIdentifier), EcsName) INTERNAL_ERROR
    
    bug 
    opened by TBlauwe 15
  • Improve cmake quality

    Improve cmake quality

    • added cmake compile options
    • added cmake compile warnings
    • raised cmake version to 3.5
    • rewritten cmake code to be more idiomatic
    • added files manually to improve IDE functionalities
    opened by rawbby 15
  • V2 wishlist (post your requests / ideas!)

    V2 wishlist (post your requests / ideas!)

    Flecs v2 will be released in the near future, and I wanted to do a give everyone an opportunity to share ideas / improvements that they would like to see. V2 is a breaking change, which lets me fix some things I can't do in a minor release.

    The v2 branch: https://github.com/SanderMertens/flecs/tree/v2_in_progress

    Also consider joining Discord where a lot of the discussion is taking place: https://discord.gg/MRSAZqb

    opened by SanderMertens 12
  • Multi Thread Crash

    Multi Thread Crash

    @SanderMertens Can you please confirm this - when applying multi thread execution via ecs_set_threads(), seeing a crash in ecs_schedule_jobs() from a null dereference of 'table' in line 182.

    Note - not using bake, but rather using ecs_os_set_api() per documentation if not using bake; previously this was working with my set up - thinking this may have been recently introduced in one of the recent fixes? Using the same test code as was previously used for creation/deletion of multiple entities.

    bug 
    opened by teksoc-1 12
  • Improve documentation

    Improve documentation

    Topics to cover:

    • Design goals
    • Naming conventions
    • Error handling
    • Memory management
    • Debugging
    • Common patterns
    • Good practices
    • System signatures
    • System stages
    • System ordering
    • Automatic system invocation
    • Manual system invocation
    • Periodic systems
    • Reactive systems
    • Manual systems
    • Tasks
    • System API
    • Modules
    • Shared components
      • Prefab
      • Singleton
      • Container
      • System
    • Builtin components
    • Initializing entities
    • Data structures
    • Internals
    • Staging
    • Threading
    opened by SanderMertens 11
  • An error is reported when compiling CPP example using vs2015

    An error is reported when compiling CPP example using vs2015

    An error is reported when compiling CPP example using vs2015, such as: flecs-2.4.4\include\flecs/cpp/iter.hpp(61): error C2512: “std::is_empty<_Ty>”: No suitable default constructor is available

    bug 
    opened by Zachary9079 10
  • Event Based Systems Design Approach

    Event Based Systems Design Approach

    Describe the problem you are trying to solve. @SanderMertens The while ( ecs_progress() ) construct works well when you continuously are wanting to perform work (i.e. animation/simulation), however in the event that an iteration does not match any systems, subsequent calls to ecs_progress will not (ever) introduce any changes into the environment (unless you introduce a change outside of the ecs_progress() pipeline). Conceptually the goal is to leverage the ecs_progress() pipeline as long as work is being performed (systems matched), and throttle back when systems are no longer matched, yet provide a way for N Event Based Systems to asynchronously fire an event and trigger the ecs_progresss() pipeline again (which may introduce new Event Based Systems).

    Describe the solution you'd like Looking for a solution that will spin ecs_progess() until work is no longer being performed (no systems matched), or ecs_quit() called ... and then perhaps an ecs_wait_for_event() like call that blocks until some Event Based System that is asynchronously running fires an event (new entity for example) and subsequently spins ecs_progress() as long as work is being performed. This of course requires some sort of registration of Event Based Systems that can be run asynchronously outside of the periodic ecs_progress() pipeline.

    enhancement 
    opened by teksoc-1 10
  • Question/Thoughts?: Module Unload - Systems Unregister

    Question/Thoughts?: Module Unload - Systems Unregister

    @SanderMertens In the context of dynamically loading a module, when unloading the module from memory, would like to unregister the associated systems that were previously registered by the respective module. One example use case that this would facilitate, is dynamically 'upgrading' a module ( unloading the old one, and importing the new one ). Understood there is probably some hefty business logic in supporting this, but perhaps a System Unregister like API or leveraging ecs_delete() to take the appropriate actions if the entity is a system? Thoughts?

    enhancement will take a while 
    opened by teksoc-1 10
  • Multi-threaded stats

    Multi-threaded stats

    Describe the problem you are trying to solve. The stats addon and explorer is not MT aware, the values stop making sense with multiple threads.

    Describe the solution you'd like Add support for per-thread stats, thread-specific stats (could indicate how well work is distributed, etc), and proper sums for time spent in systems (wall clock vs cpu time). And then support for it in explorer, of course.

    enhancement 
    opened by randy408 0
  • Fix missing include

    Fix missing include

    Fix missing include. I use a very strict build environment, which is probably why this was caught. I suspect most users would not even be able to observe this.

    opened by logankaser 1
  • Support setting $This in queries

    Support setting $This in queries

    Describe the problem you are trying to solve. I'm trying to create a system that uses ecs_iter_set_var(it, 0, ent) before iterating to set the (implied?) $This variable, thus specifying which entity the system's query should run for. However, it appears this is currently not supported for queries, only filters and rules.

    enhancement 
    opened by copygirl 1
  • ecs_query_changed to be useable in multithread!

    ecs_query_changed to be useable in multithread!

    Describe the problem you are trying to solve.

    I found a good way to trigger system functions when changes occur in the components with ecs_query_changed and inserted filters. I have workable code for that. However it only runs in single threaded system. Primarily with ecs_query_changed(NULL, it). Apparently it works with ecs_query_changed(changeQuery, NULL).

    The error that spits out is:

    fatal: flecs.c: fatalfatalfatal: flecs.c: 48290: fatalfatalfatal: flecs.c: 48290: assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal: fatal: flecs.cfatal: flecs.c: fatalfatal: flecs.c: : 48290: fatalfatal: flecs.c: 48290: assert: it->next == ecs_query_next INVALID_PARAMETER48290: assert: it->next == ecs_query_next INVALID_PARAMETER: flecs.c: fatal: flecs.c: assert: it->next == ecs_query_next INVALID_PARAMETER48290: assert: it->next == ecs_query_next INVALID_PARAMETER
    assert: it->next == ecs_query_next INVALID_PARAMETER
    

    Also ecs_query_skip(it) does not work in multi-threading. The error it spits out is:

    fatal: flecs.c: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal: flecs.cfatal: flecs.c: : fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: fatal: flecs.c: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    48335: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal: flecs.c: fatal: flecs.c: assert: it->next == ecs_query_next INVALID_PARAMETER48335: 48335: fatalassert: it->next == ecs_query_next INVALID_PARAMETER48335: 48335: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    48335: 48335: fatal: flecs.c: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal: flecs.c: assert: it->next == ecs_query_next INVALID_PARAMETER
    48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    assert: it->next == ecs_query_next INVALID_PARAMETER
    : flecs.c: assert: it->next == ecs_query_next INVALID_PARAMETER
    48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal
    48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    fatalfatalfatal: flecs.c: 48335: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    : flecs.c: : flecs.c48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    : flecs.c: 48335: assert: it->next == ecs_query_next INVALID_PARAMETER
    assert: it->next == ecs_query_next INVALID_PARAMETER
    assert: it->next == ecs_query_next INVALID_PARAMETER
    fatal: flecs.c: : 48335: fatalassert: it->next == ecs_query_next INVALID_PARAMETER48335: assert: it->next == ecs_query_next INVALID_PARAMETERfatal: 
    
    : 
    flecs.c: 48335: flecs.cassert: it->next == ecs_query_next INVALID_PARAMETER./zoxel-dev.x86(+0x32917) [0x55a4bf6fe917]
    

    Describe the solution you'd like

    I would like to run this function ecs_query_changed and ecs_query_skip in multi-thread so when I scale up my systems they can take full advantage of my 24 core cpu, or my 6 core cpu on my linux phone.

    enhancement 
    opened by deus369 0
  • Restoring a snapshot doesn't seem to restore singletons.

    Restoring a snapshot doesn't seem to restore singletons.

    I have the following code https://gist.github.com/wackoisgod/6f93589a4ac38338bbce2d7a23237ba7 I would expect the printf to show 1,1 but it in fact shows 2,2

    bug 
    opened by wackoisgod 0
  • Union Relationship Ref to Wildcard (Edge Case)

    Union Relationship Ref to Wildcard (Edge Case)

    Describe the bug Creating this as a bug so that it doesn't get forgotten. There is an issue with queries and union relationship enums. See chat for details...

    To Reproduce See discord discussion

    bug 
    opened by Epsola 1
Releases(v3.1.1)
  • v3.1.1(Dec 1, 2022)

    Highlights

    • Observer refactor with new hierarchy cache that can improve event propagation performance up to 200x
    • Systems are now excluded from a schedule when their module or phase is disabled
    • Single threaded systems are now guaranteed to run on main thread
    • New journaling addon

    Release notes

    This version includes the following bugfixes:

    • Fixed issue with page/worker iterators and InOutNone
    • Fixed issue with invoking on_add hooks when using ecs_bulk_init
    • Fixed issue with searching for union relationships
    • Fixed C++ enum relationships on Apple Clang 14
    • Fixed issue with batched deferred emplace and remove
    • Fixed issue where ctx/binding_ctx was not set for multithreaded systems
    • Fixed race condition with no_readonly systems in multithreaded apps
    • Fixed issue where pipeline would resume at incorrect point in schedule after merge
    • Fixed issue with batched clear commands
    • Fixed issue where auto-overriding components would write to wrong component
    • Fixed issue with parsing template name in module
    • Fixed assert during deferred component registration in multithreaded app
    • Fixed leak in pipeline cleanup
    • Fixed issues with sending valid preflight response in HTTP server
    • Prevent sending response to invalid socket
    • Don't call send on socket when reply has no data
    • Fixed issue with setting symbol on entity with IsA relationship
    • Fixed issue with observer that has multiple fixed sources
    • Fixed escaping issue in doc strings in JSON serializer
    • Fixed issue where serialized path of core entity was not relative to root
    • Fixed HTTP socket leak, add timeout to connection socket
    • Replaced incorrect cast to float to ecs_ftime_t in system addon
    • Fixed issue with flecs::filter move assignment

    This version includes the following improvements:

    • [c++] Add support for run callback to C++ observers
    • [c++] Add typed method for getting iterator ctx in C++ API
    • [c++] Add support for run callback to C++ systems
    • [c++] Add .term<R>(string) and .term(R, string) overloads to filter builder
    • [c++] Add shorthand with/without methods to filter builder API
    • [c++] Add pair support to emplace
    • [c++] Add pair support for flecs::ref
    • [c++] Ensure set, set_override use move for pairs where possible
    • [journal] Implement journaling addin
    • [queries] Improve performance of query rematching
    • [filters] Allow for creation of named filters/rules
    • [filters] Cache id record on filter terms for faster matching
    • [rules] Enable overriding transitive behavior with self flag
    • [observers] Refactor observer code for improved event propagation performance
    • [observers] Implement reachable id cache to improve event performance of adding relationships
    • [pipeline] Add doc name to pipeline schedule tracing
    • [pipeline] Exclude systems from pipeline with disabled phase/disabled module
    • [pipeline] Run single threaded systems on main thread
    • [iterator] Add ecs_iter_first function
    • [query DSL] Add query DSL support for specifying flags for (r, t) notation
    • [commands] Reduce lookups during command batching (performance improvement)
    • [storage] Reduce overhead of table graph edges, improve table creation speed
    • [stats] Always use double for metric types to avoid precision issues
    • [stats] Add REST and HTTP statistics
    • [units] Add frequency units
    • [rest] Add endpoint for requesting results of existing query
    • [rest] Add endpoint for enabling/disabling entities
    • [rest] Add caching for named query requests
    • [rest] Start/stop HTTP servers when enabling/disabling REST module
    • [http] Send HTTP headers in send thread
    • [http] Improve response times and handling of HTTP preflight requests
    • [http] Always use double precision for time values in HTTP server
    • [doc] Add system examples
    • [doc] Update C++ examples with simplified query variable syntax
    • [doc] Add example to show how to forward declare component/tag variables
    • [doc] Fix typos in manuals
    • [doc] Add custom phase example that does not use builtin phases
    • [doc] Remove outdated reference to ecs_scope_iter
    • [doc] Replace flecs::entity with flecs::entity_t in C++ order_by example
    • [doc] Improve pipeline section of manual
    • [doc] Add observer examples for C/C++
    • [ux] Improve error message for conflicting symbols during implicit component registration
    • [build] Improve directory structure of cmake build to match visual studio
    • [build] Improve bazel build to support .inl files
    • [internals] Don't free chunks in flecs_sparse_clear (performance improvement)
    • [internals] Use faster sparse set function in table event batching admin
    • [internals] Replace map with faster sparse set in generic allocator
    • [internals] Use faster storage for id records in low id range
    • [internals] Inline type_info sparse set

    Known issues: https://github.com/SanderMertens/flecs/issues/844 https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Oct 15, 2022)

    Release announcement

    Flecs 3.1 is out!

    Release notes

    This version includes the following bugfixes:

    • Fixed issue with terms that had Not operator in combination with relationship traversal
    • Fixed issues in C++ API where component hooks could get reregistered across DLLs
    • Fixed issue in queries with shared components and change detection
    • Fixed issue in queries with fixed source terms and change detection
    • Fixed issue in sparse set with bulk id generation and recycling
    • Fixed issues with using emplace and commands
    • Fixed issue in group_by example so it always returns alive entity identifier
    • Fixed issue in pipeline with no_staging system after inactive system
    • Fixed issue with instanced queries and nested iter calls
    • Fixed issue where using observer with multiple components would crash when setting ctx and ctx_free
    • Fixed issue where ecs_ref_t would do more lookups than necessary
    • Fixed C++ issue with overriding a prefab child that was associated with a type
    • Fixed missing call to move hook when moving entity in table
    • Fixed double free for moved-away from component
    • Fixed leak where world was not destroyed when using app::run
    • Fixed table lock assert when adding component in observer during merge
    • Fixed crash when OnRemove observer adds component to deleted entity
    • Fixed issue with using ecs_add_path when path is root
    • Fixed issue with assigning the same name to an entity after reparenting
    • Fixed JSON crash on union pair with invalid target
    • Fixed crash where no_staging system activated at end of schedule
    • Fixed leak when multithreaded pipeline rebuilt after running the last system
    • Fixed issue where HTTP server would write to memory of purged connection
    • Fixed issue where observer would not restore iterator state for next observer
    • Fixed issues with redefining addon macro's
    • Fixed issues with parsing identifiers that start with _ in ECS_STRUCT
    • Fixed issues with parsing pointer types in ECS_STRUCT

    This version includes the following improvements:

    • [c] Added ecs_children / ecs_children_next functions for iterating an entity's children
    • [c++] Added entity_view::parent function (shorthand for target(flecs::ChildOf)
    • [c++] Made calling world::module in module constructor optional
    • [c++] Added each/iter overloads that accept a stage
    • [c++] Allow module entity to be retrieved using world::entity / world::component
    • [threading] Allowed using the world (vs. stage) in single threaded system running in multi threaded apps
    • [commands] Command batching, which reduces archetype moves for entities when doing deferred operations
    • [entity DSL] Improved syntax
    • [entity DSL] Added entity DSL examples
    • [entity DSL] Added support for multiline strings
    • [entity DSL] Added support for anonymous entities
    • [entity DSL] Added variable support (reusable values)
    • [entity DSL] Added support for using simple arithmetic expressions
    • [entity DSL] Implemented a vscode extension for DSL syntax highlighting
    • [os api] Added function to get OS API struct (for easier support in language bindings)
    • [queries] Added ability to add user-defined context to query groups
    • [queries] Added assert on invalid usage of Filter in combination with queries
    • [queries] Added ecs_query_next_table for fast iteration where only tables are needed
    • [queries] Improved performance/cleanup technical debt of query change detection
    • [queries] Added ecs_query_get_group_info function
    • [observers] Added EcsFilter/flecs::Filter term flag for terms only for filtering, not receiving events
    • [observers] Added level 3 trace that shows which observers are invoked
    • [pipeline] Improved detection of sync points, correctly handle wildcard queries
    • [pipeline] Always insert sync point after no_staging system to ensure schedule consistency
    • [stats] Added FLECS_ACCURATE_COUNTERS for tracking allocation counters in multithreaded apps
    • [stats] Added new statistics for allocators, events and performance tracking
    • [stats] Organized statistics into categories
    • [stats] Improved system time measurement so it no longer includes merge time
    • [stats] Fixed issue where measuring system time for last part of schedule could be skipped
    • [stats] Use 64bit counters to reduce occurrences of stat overflows
    • [stats] Ensure counter metrics are monotonically increasing in case of overflow
    • [rest] Added brief descriptions to stats endpoints for improved visualization in explorer
    • [http] Don't enqueue requests for connections that are no longer alive
    • [http] Don't keep HTTP connection open longer than timeout
    • [http] Set timeout on connection receive socket
    • [http] Set SO_KEEPALIVE on connection socket so server is notified when client drops connection
    • [http] Implement send queue to prevent blocking on main thread when sending reply
    • [http] Fixed issue with sending replies without payload
    • [ux] Throw assert when component id overlaps with reserved bits for id flags
    • [ux] Added typename to invalid ctor/dtor error messages
    • [ux] Added assert when attempting to use ecs_bulk_init on stage
    • [internals] Reduced number of heap allocations with internals now mostly using custom allocators
    • [internals] Allow for overriding of ECS_HI_COMPONENT_ID macro
    • [internals] Allow for overriding of ECS_ID_CACHE_SIZE macro
    • [internals] Reduced bits reserved for id flags from 8 to 4
    • [internals] Improved detection of platforms where execinfo/backtrace is not available
    • [internals] Improved strbuf API so it relies less on strlen
    • [internals] Improved performance of flecs_sparse_clear

    Known issues: https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.4(Aug 31, 2022)

    This version includes the following bugfixes:

    • Fixed issue where system created with each was not automatically instanced
    • Fixed copy/paste error in term::read function that set the wrong inout kind
    • Fixed issue that prevented deferring an emplace with types that had no default ctor
    • Fixed issue that prevented on_add hook to be called for emplace
    • Fixed issue where move_ctor wasn't called when merging deferred emplace
    • Fixed issue where fps or thread count was overwritten when calling ecs_app_run
    • Fixed issue where name prefix wasn't reset after bootstrap
    • Fixed issue where union relationship wasn't properly initialized for prefab child
    • Fixed various issues with using mingw
    • Fixed wrong escaping of pipe symbol in documentation
    • Fixed issues with enum reflection on clang and Windows
    • Fixed issue with instantiating prefab children that are associated with root type
    • Fixed issue where name lookup would fail after resetting name to NULL

    This version includes the following improvements:

    • Added constructor to flecs::query for creating named queries
    • Rewrote outdated parts of "designing with flecs"
    • Improved performance of ecs_count_id
    • Improved performance of queries/observers that do relationship traversal
    • Added query section to relationship manual
    • Stats addon types now use customizable float type (ecs_float_t)
    • Improved error message when using union relationship in C++ query signature
    • Added overload for set_override where 1st element of pair is a tag
    • Improved conversion logic of meta cursor API
    • Improved documentation of ecs_new_id / ecs_new_low_id
    • Updated outdated JSON examples
    • Added entity::get_mut_second
    • Improved performance of ecs_set

    Known issues: https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.3(Aug 16, 2022)

    This version includes the following bugfixes:

    • Fixed bug where constructor was not called for explicitly registered component in multi world C++ application
    • Fixed bug with change detection and queries with OR terms

    This version includes the following improvements:

    • Fixed broken links and typos in documentation
    • Added links to demos and blogs to README
    • Remove redundant includes
    • Remove redundant assignment in sparse set code
    • New group_by example

    This version includes the following new features:

    • Group iterators (https://github.com/SanderMertens/flecs/tree/master/examples/cpp/queries/group_iter)

    Breaking changes:

    • Fixed inconsistencies in naming between fields and terms: https://github.com/SanderMertens/flecs/discussions/466#discussioncomment-3381060

    Known issues: https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/716 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.2(Aug 8, 2022)

    This version includes the following bugfixes:

    • Fixed symbol export issues when using reflection convenience macro's like ECS_STRUCT
    • Fixed bug that prevented inheriting from entities with a symbol identifier
    • Fixed issue that could cause crash when creating tables with OVERRIDE or TOGGLE

    This version includes the following improvements:

    • Improved error messages when using stage outside of readonly context
    • Several improvements that enable interop between C modules and C++
    • Added more prefab examples
    • DontInherit property is now respected when instantiating prefab children
    • Transfer ownership of world to app framework in C++ so it can be used in webasm builds

    This version includes the following new features:

    • Added support for prefab slots (see https://github.com/SanderMertens/flecs/tree/master/examples/cpp/prefabs/slots)

    Known issues: https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/716 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.1(Aug 4, 2022)

    This version includes the following bugfixes:

    • Fixed issue where calling set with a new pair in a multithreaded app could assert
    • Fixed issue where linking Flecs as static library would cause unresolved symbol errors
    • Fixed issues in cmake files for examples

    This version includes the following improvements:

    • Union relationships are now serialized as regular relationships by the JSON serializer
    • Added README on how to run examples

    Known issues: https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/716 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Aug 2, 2022)

    Flecs 3 is out! 🎉

    This is a major release with many new features, improvements, bugfixes and breaking changes. Enjoy!

    Release Notes

    See the release announcement: https://ajmmertens.medium.com/flecs-3-0-is-out-5ca1ac92e8a4

    Upgrading to v3

    If you are upgrading from v2.4.8, see this discussion for a list of breaking changes: https://github.com/SanderMertens/flecs/discussions/466

    If you are upgrading from a later version, look for the date of your last commit, and use that as starting point in the discussion.

    Known issues

    https://github.com/SanderMertens/flecs/issues/776 https://github.com/SanderMertens/flecs/issues/765 https://github.com/SanderMertens/flecs/issues/716 https://github.com/SanderMertens/flecs/issues/714 https://github.com/SanderMertens/flecs/issues/620 https://github.com/SanderMertens/flecs/issues/478 https://github.com/SanderMertens/flecs/issues/314

    Source code(tar.gz)
    Source code(zip)
  • v3.0.2-beta(Jul 2, 2022)

    This release will be almost functionally equivalent to the initial Flecs v3 release, but is tagged before v3 renaming (see https://github.com/SanderMertens/flecs/discussions/728).

    Use this release if you want to use v3 features, but want to hold off on fixing breaking changes as a result of renaming.

    If you are upgrading from an older (v2) release, see this discussion for a list of breaking changes when upgrading: https://github.com/SanderMertens/flecs/discussions/466

    Source code(tar.gz)
    Source code(zip)
  • v2.4.8(Nov 19, 2021)

    This version includes the following bugfixes:

    • Fix index in query table cache when table is unmatched
    • Fixed group_by signature

    This version includes the following improvements:

    • Add const variants to flecs::ref

    Known issues: https://github.com/SanderMertens/flecs/issues/569 https://github.com/SanderMertens/flecs/issues/701

    Source code(tar.gz)
    Source code(zip)
  • v2.4.7(Sep 18, 2021)

    This version includes the following bugfixes:

    • fixed issue where OnSet system would trigger for the wrong wildcard pair
    • fixed issue where observer would trigger for the wrong wildcard pair
    • fixed issue where observer would trigger for the wrong entity

    Known issues:

    • UnSet systems with wildcards only trigger for one matching component (addressed in v3)

    Note that this is a v2 release that is behind master! Only use this if you cannot migrate to v3 or need API stability

    Source code(tar.gz)
    Source code(zip)
  • v3.0.1-alpha(Aug 27, 2021)

    This is the first v3.0 alpha release. This release gets rid of deprecated features, simplifies the API and code structure, and has a number of internal improvements. For a list of changes, see: https://github.com/SanderMertens/flecs/discussions

    This is the first of a number of v3.0 alpha releases that may have breaking API changes. If you need a stable API, use the last stable 2.4 release: https://github.com/SanderMertens/flecs/releases/tag/v2.4.6

    Known issues:

    • cmake file for examples needs to be updated
    Source code(tar.gz)
    Source code(zip)
  • v2.4.6(Aug 27, 2021)

  • v2.4.5(Aug 27, 2021)

    This version includes the following improvements:

    • Added comment to amalgamated file to remove flecs_STATIC when using as DLL

    This version includes the following bugfixes:

    • Fix issue with moving filters in C++ API
    • Fix issue with creating snapshots from stage
    • Fixed std::is_empty() typo in C++ iterator code
    Source code(tar.gz)
    Source code(zip)
  • v2.4.4(Aug 20, 2021)

    This version includes the following improvements:

    • Added overview diagram to quickstart

    This version includes the following bugfixes:

    • Fix issue with using term() after arg() in filter builder
    • Fix memory leak when registering entity twice for the same alias with ecs_use
    Source code(tar.gz)
    Source code(zip)
  • v2.4.3(Aug 18, 2021)

    This version includes the following improvements:

    • Include tracing level 1 by default in release builds
    • Added function (ecs_tracing_color_enable) to disable colors in tracing

    This version includes the following bugfixes:

    • Fixed issue with queries and large numbers of terms
    • Fixed issue with registering namespaced components with explicit ids (entity::component<T>)
    • Fixed issue with emplace on entities with non-trivial component destructors
    • Fixed issue that prevented enabling tracing in release mode
    Source code(tar.gz)
    Source code(zip)
  • v2.4.2(Aug 16, 2021)

    This version includes the following improvements:

    • Enabled filter builder to create filters with any number of terms

    This version includes the following bugfixes:

    • Fixed issue with creating filters with more than 8 terms
    • Fixed issue with creating filter & term iterators from a stage
    • Fixed issue with using ecs_get_object (and ecs_get_parent) from stage
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Aug 15, 2021)

    This version includes the following bugfixes:

    • Fixed issue with resolving shared component entity when entity has more than one base
    • Fixed issue with getting switch case when in staged mode
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Aug 13, 2021)

    Finally! 🎉

    The highlights of the release are:

    • The first feature-complete implementation of entity relationships in any ECS framework
    • Removal of dependency on STL data structures, improving compile times & reducing API footprint
    • New sokol-style creation functions in C API for entities, components, queries, systems and more
    • New fluent-style builder classes in C++ for creation of queries, systems and more
    • A new and improved query DSL (domain specific language) with full support for custom relationships
    • Improved features for responding to events with triggers & observers
    • A novel search data structure for archetypes & relations which speeds up things across the board:
      • Filters evaluate much faster, even though they can be much more complex than before
      • Improved speed of matching tables to queries
      • Operations like ecs_get, ecs_has and get_object are now constant time
      • Improved performance of scope iterators
      • Improved performance of fetching components from base entities & instantiating from base entities
      • Improved performance of ecs_lookup family of functions

    Breaking changes: This release introduces a number of minor breaking changes when compared with the last 2.3.2 release. A non-exhaustive lists of breaking changes is provided here and may be extended later:

    • The EcsName component is changed to an EcsIdentifier relation which is instantiated with EcsName and EcsSymbol tags
    • Component destructors are now called on the source component after moving between archetypes
    • The ecs_get_object function no longer accepts a component to find an object for a relation, but an index to find the nth object for a relation
    • The group_by callback signature have been modified to allow for a context
    • The system/query APIs have been updated to a fluent-style builder pattern
    • The C++ API no longer uses STL data structures, which in practice means that code that relied on functions returning an std::string may have to be updated.
    • Most legacy syntax constructs of the query DSL have been removed
    • Removal of CHILDOF and INSTANCEOF roles (use the builtin ChildOf and IsA relations instead)
    • include and exclude filter fields are no longer supported (use new filter API)
    • entity::each(Func&&) now expects a function that accepts a flecs::id instead of a flecs::entity

    This was a large release! A few random facts:

    • Flecs met its first sponsorship goal! ❤️
    • 380 commits since the last release
    • Over 2200 commits since the beginning of the project
    • The Discord server grew to almost 600 users 🎉
    • Close to 400 new stars were added to the project ⭐
    • A little more than a year has passed since the first v2.0 release
    • Almost a 100 closed PRs and issues in this release alone:
      • PRs contributed by @randy408, @aganm, @mason-bially, @ikrima, @SpaceIm, @Hexlord, @shanehyde, @Zalron, @nasso and @Wesxdz
      • Issues opened by @SpaceIm, @JonSnowbd, @randy408, @artgreen, @mjjq, @Hexlord, @codylico, @BHolman-LBI, @jtferson, @shanehyde, @cshenton, @Josid88, @jon-turney, @Jarodwr, @HenryFalconerIO, @tedajax, @Zalron, @domdom, @KenthJohan and @zaklaus
      • Thanks everyone! 🙏

    I'm skipping the full list of features/improvements/bugs for now as it's a lot, may add it later.

    For the next 2 - 3 months the master branch will be used to migrate to the v3 APIs. If you need API stability, stay on the last v2 release until the official v3 release. There will be intermediate releases that allow for a more gradual upgrade path to the new v3 APIs.

    Source code(tar.gz)
    Source code(zip)
  • v2.3.2(Feb 23, 2021)

    This release introduces a breaking change to fix C++ component registration. The symbol member of the EcsName (or flecs::Name) component now requires an allocation. If you explicitly assign members to the EcsName component (using get_mut, not using set) you will have to update your code.

    Another change that was introduced to fix component registration is that the symbol member of the EcsName component for a module now always contains the fully qualified path to the entity. Previously this value contained the C or C++ typename, but this caused issues with module interop between C and C++. If your code relied on looking up modules by their C typename and not the fully qualified name, code will have to be updated.

    This release contains the following improvements:

    • replace iostream with initializer_list (C++ API, thanks @ikrima!)
    • ensure entity::m_id is initialized to 0 (C++ API, thanks @ikrima!)
    • use ecs_os_malloc instead of new (C++ API, thanks @ikrima!)
    • remove superfluous copies of lambda functions (C++ API, thanks @ikrima!)
    • add CHANGELOG (thanks @ikrima!)

    This release contains the following bugfixes:

    • fix matching for queries with shared componnents when base entity is deleted
    • fix various issues with component registration in C++
    • fix issue with setting target FPS on Apple M1 (thanks @prime31!)
    • fix issues with CMake file (thanks @SpaceIm!)
    • fix crash when creating & deleting queries
    • guarantee that id returned by new_component_id is unused
    Source code(tar.gz)
    Source code(zip)
  • v2.3.1(Feb 3, 2021)

    This version contains the following improvements:

    • Improved lerp example
    • Added OS API example C++ (thanks @mcmlevi!)
    • Upgraded cmake buildfiles (thanks @rawbby!)
    • Clarified text in README describing API/ABI stability

    This version contains the following bugfixes:

    • Fix crash when using overlapping UnSet systems
    • Fix issue with passing incorrect row to UnSet systems
    • Added .hpp files to cmake install
    • Fixed issue with using get_mut with traits
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Jan 18, 2021)

    Highlights:

    • Big performance improvements & reduced memory usage for applications with lots of tables, such as when using hierarchies
    • Component enabling/disabling allows for quick component mutations without moving entities between archetypes
    • New statistics addon for retrieving metrics from running world (replaces stats module)

    Thanks to @randy408, @sh-dave, @kevinresol, @jasonliang-dev and @Alexandre-P-J for submitting PRs! 🎉

    Thanks to @ikrima and @jtferson for writing two awesome testimonials on using Flecs with Unreal Engine 4 🙏 :

    • https://bebylon.dev/blog/ecs-flecs-ue4/
    • https://jtferson.github.io/blog/flecs_and_unreal/

    Thanks to the new Flecs sponsors ❤️ :

    • @Zifkan
    • @TFlippy
    • @Hexlord

    Breaking changes:

    • calling ecs_get for a tag will no longer return NULL, but will assert
    • statistics module is removed in favor of easier to use statistics addon
    • unused table_offset member is removed from iterator

    Deprecated features:

    • ecs_entity() macro is now deprecated, use ecs_typeid()

    This version includes the following features:

    • Direct access addon, which provides fast access to underlying storage
    • Added singleton API to C++ world class
    • Added orphaning for subqueries, which allows an application to check if a parent query still exists
    • Added ecs_get_typeid function to get the component id for traits
    • The type used for time keeping is now customizable
    • New statistics addon for retrieving metrics from running world
    • Added get_parent function that accepts entity/tag
    • Added component enabling/disabling
    • Added support for sorting on shared components

    This version includes the following improvements:

    • Improved ecs_delete performance (reduced entity index accesses from 2 to 1)
    • C & C++ code compiles warning-free with more warning flags, for more compiler versions & more platforms
    • Improved error messages when application passes invalid entity id
    • Made include paths relative so source code is easier to integrate with bazel
    • Fixed typos in documentation
    • Improve error message when trying to add 0 as base entity (using ECS_INSTANCEOF)
    • Add check for conflicting source modifier in OR expressions
    • Extended documentation, added new examples and fixed typos
    • Removed dead/redundant code
    • Improved performance of ecs_get
    • Add sanitizer & custom builds to CI, remove Travis CI builds
    • Don't add Name component when provided name for entity is NULL
    • Allow flecs::system instances to be (re)created from entity id
    • Added godbolt "try online" badge to README
    • Improve allocation strategy of vector datastructure
    • Improved performance for checking if entity id is a number
    • Added missing query functions to C++ API for sorting
    • Improved performance of table creation by two orders of magnitude
    • Reduced memory footprint of table graph by a factor 60
    • Added example to demonstrate world merging with direct access API
    • Added more inline documentation for datastructures
    • Added assert when trying to instantiate child as instance
    • Improve errors when invalid operation is invoked on iterator
    • Throw assert when invoking ecs_modified on entity that does not have the component
    • Allow for type lookups in systems, as long as the type already exists
    • Add return types to ecs_defer_begin and ecs_defer_end to obtain defer status of world
    • Remove redundant table_offset member from ecs_iter_t
    • Improved portability of POSIX OS API example

    This version includes the following bugfixes:

    • Fixed issues with subqueries and query rematching
    • Corrected wrong return type of ecs_column_size (was ecs_entity_t, is now size_t)
    • Add missing \0 when appending to application buffer with strbuf datastructure
    • Fixed crash when instantiating an empty prefab
    • Fixed issue with shared tags and queries using each() in the C++ API
    • Fixed issue with instantiating empty child table
    • Fixed issue with ecs_bulk_new and traits
    • Fixed issue when using ecs_entity_str with small buffers
    • Fixed bug when adding trait to entity with switch
    • Fixed name conflicts in amalgamated source
    • Fixed path lookup in ecs_import
    • Fixed EXPORT macro's in OS API examples
    • Fixed issue with restoring worlds that have recycled ids
    • Added missing EXPORT macro's to API functions
    • Fixed assert after deleting entities from restored world
    • Removed obsolete assert from ecs_modified
    • Added missing statement to finalize system in C++
    • Fixed issues with removing case values
    • Fixed issues in C++ API with implicit component registration
    • Fixed assert when removing from switch list
    • Fixed bug where obtaining type from entity would generate a new entity id
    • Fixed incorrect description of ecs_delete in manual
    • Fixed issues with custom builds
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Oct 12, 2020)

    Highlights:

    • Big performance improvement for operations called from systems
    • Entity liveliness tracking (entities are now annotated with a generation)
    • New APIs for deferring operations, singletons and simpler system callbacks (C++)

    Deprecated features:

    • The action method in C++ should no longer be used for systems. Use iter instead.
    • EcsSingleton and flecs::Singleton are deprecated. Use new singleton API instead
    • The is_shared function in the flecs::iter class is deprecated. Use is_owned instead.

    Breaking changes

    • Query columns that are not owned are now [in] by default. This may cause the API to throw an assert (in C++) or ecs_is_readonly to return a different value (in C). To fix issues caused by this change, add const to the column type, or annotate the column with [inout] or [out].
    • Doing an operation on a deleted entity id may now throw an assert.

    Thanks to @ikrima, @randy408 and @nbrk for submitting PRs! 🎉

    This version includes the following features:

    • Add ecs_clear API which removes all components without deleting the entity
    • Keep track of entity lifecycle with generation counting
    • New type role that enables automatic overriding of components for base/prefab entities
    • Create an alias for entity/component names to shorten string-based queries
    • New API for deferring actions
    • New staging implementation that uses deferred actions for better performance
    • Added ecs_is_alive which tests if an entity has been deleted
    • Added ecs_exists which tests if an entity id is currently in use (ignoring generation)
    • Add new singleton API
    • Add macro's for defining global component variables in C

    This version includes the following improvements:

    • Recursively delete child entities when deleting a parent
    • Add function to enable tracing to C++
    • Add time_scale function to C++
    • Disallow overwriting component lifecycle actions
    • Improved checks for invoking operations on non-initialized classes
    • Improvements to C++ flecs::vector wrapper
    • Introduces iter() which is an easier to use alternative to action()
    • Added simplified FOR syntax for trait queries
    • Add is_owned to iterator class in C++
    • Treat empty structs in C++ as tags
    • Allow dereferencing shared column with [0] in C++
    • Add enabled() function to entity class
    • Queries now prefetch column types so there is no accidental table creation when iterating
    • Make [in] default for columns that are not owned
    • Add function to get column by name
    • Detect registering component with a different name in C++

    This version includes the following bugfixes:

    • Fix issues when application includes stdbool
    • Don't crash if system is redefined with NULL signature
    • Fix issues with registering builtin components in C++
    • Fix issues with re-registering entities with the same name
    • Fix bug where child would sometimes be created for the wrong parent
    • Add missing ANY modifier to C examples
    • Fixed issue with registering components across translation units
    • Add assert when ecs_merge is called when world is progressing
    • Fixed issue where moving world could cause double destruction in C++
    • entity::set no longer takes const rvalue which prevented moves
    • Fixed bug where moving an entity would sometimes call destruct on the wrong component
    • Don't automatically add ctor if other lifecycle actions are NULL
    • ecs_os_api_strdup incorrectly used ecs_os_api_malloc instead of overrided malloc
    • Only resolve entity as numeric id if the entire string is a number
    • Fix including alloca header in FreeBSD
    • Fixed incorrect parsing of trait expression with SHARED modifier in signature
    • Fixed bug with obtaining shared trait columns
    • Fixed bug with querying for component trait
    • Ensure that owned component is never passed to shared column and vice versa
    • Fixed bug with rematching queries that have optional fields
    • If a prefab was an instance from a base prefab, the children of the base would not be created as prefabs
    • Deleting a table in the table graph did not update edges of connected tables
    • Queries were sometimes registered twice with the same table
    • Fixed crash when attempting to delete empty child table
    • Remove query from table administration when unmatching
    • Parent entity was not deleted from child tables administration when deleted
    • Removed assert when attempting to remove a key from an empty map
    • Fix bug where is_monitored bit would not be transferred when moving / swapping an entity
    • Fixed component names memory leak in C++ API
    Source code(tar.gz)
    Source code(zip)
  • v2.1.2(Sep 5, 2020)

    This version includes the following features:

    • No new features

    This version includes the following improvements:

    • Queries can now select for components to which a trait has been applied (TRAIT | MyTrait > *)
    • Add unsafe_column to C++ API for accessing component data of unknown type at compile time
    • Add [] operator to flecs::vector
    • Add more functions to C++ iterator to access underlying fields
    • Add fast paths to table functions (improves performance)
    • Add support for global component/tag/entity handles in C
    • Add flecs::type_id<T>() for getting the identifier of a type

    This version includes the following bugfixes:

    • OnSet systems registered themselves with components in expression vs. matched components
    • Fix issues related to component lifecycle actions & traits
    • Invoke move when moving entity between tables
    • Invoke move when reallocating table columns
    • Invoke move when deleting an entity (move last entity into deleted index)
    • Component actions were not registered for implicitly registered components
    • Fix bug with redefining namespaced components in a different world
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Sep 1, 2020)

  • v2.1.0(Aug 31, 2020)

    Highlights:

    • Big usability improvements to the C++ API
    • Improved performance when compared to 2.0 (~18%)
    • Switchable tags which allow for easy implementation of state machines
    • Subqueries

    Breaking changes This release introduces a breaking change to the ecs_bulk_new* APIs which was necessary to fix a memory leak. The new API now returns a pointer to an array of entity ids, vs. the entity id of the first created entity.

    This version includes the following features:

    • Implicit component registration in C++ API
    • Switchable tags (allows for building fast state machines)
    • Subqueries (queries that are matched against the tables of their parent queries)

    This version includes the following improvements:

    • Add type agnostic get/get_mut/modified/has functions to C++ API
    • Add trait functions to C++ API
    • Allow for specifying the signature in the flesc::query constructor
    • Increased addressing space for type roles
    • Add convenience functions to flecs::entity class for working with roles
    • Allow querying for individual traits
    • Add has_childof and has_instanceof to C++ API
    • Moved private classes in C++ API to separate namespace
    • Removed all bake code from flecs core
    • Added OS API examples
    • Added support for triggers to C++ API
    • Moved change tracking from systems to queries
    • Add ecs_query_next_w_filter
    • Added a FAQ (https://github.com/SanderMertens/flecs/blob/master/docs/FAQ.md)
    • New sparse set implementation
    • Add fast path to table operations, improving performance
    • Fixed name clashes with other libraries in OS API struct
    • Added more sections and diagram to the manual
    • Added support for AND & OR type flags in signatures
    • Improved exporting types from a module
    • Improved C++ API where world can be used as factory

    This version includes the following bugfixes:

    • Fixed issue with get_mut in C++ API
    • Fixed issue with correctly registering components when using pointer types in queries
    • Fixed issue where a cached pointer in a reference could become invalid
    • Fixed uninitialized value in query sorting function
    • Fixed issue where record_ptrs array would not be allocated with correct size in writer API
    • Fixed uninitialized value during cleanup
    • Fixed numerous memory leaks
    • Fixed duplicate entries in stage
    • Fixed issue where query would not detect a change in the data
    • Fixed issue with optional components in C++ API
    • Fixed C++ snapshot examples
    • Fix issue where system name would not be copied in C++ API
    • Fixed namespacing issue with nested modules in C++
    • Fix issue with ECS_ALIGN macro and signed integers
    • Fix issue with registering components across multiple worlds in C++
    • Fixed issue where repeated bulk operation could cause out of memory errors
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Aug 3, 2020)

    This is the first Flecs v2.0 release. This release contains many new features, performance improvements and bug fixes. For a full overview of the changes, see the migration guide: https://github.com/SanderMertens/flecs/blob/master/docs/MigrationGuide.md

    To get up to speed on the v2.0 features, see the quickstart: https://github.com/SanderMertens/flecs/blob/master/docs/Quickstart.md

    For a more in-depth description of the features, see the manual: https://github.com/SanderMertens/flecs/blob/master/docs/Manual.md

    Source code(tar.gz)
    Source code(zip)
  • v2.0.4-beta(Jun 25, 2020)

    This is a pre-release of v2.0. Do not use this release for production code. Bugs are to be expected. The purpose of this release is to help existing users migrate from v1.0 to v2.0.

    This is a beta release, indicating that the public API for v2.0 is stable, unless indicated otherwise. Any headers under include/flecs/private are not part of the public API, and may be changed by patch & minor releases. Behavior changes may still occur as bugs are fixed and features are completed.

    This release has the following new features:

    • Add ability to iterate scope with filter
    • Add ecs_get_child_count function
    • Allow for creating filtered snapshots & blobs by providing an iterator
    • Add ecs_set_time_scale function

    This release implements the following improvements:

    • Allow parsing type expressions without asserting on error
    • Rename query sorting functions to sort_by and group_by
    • Improve test coverage
    • Remove inconsistencies in signatures between os API malloc, calloc and alloca
    • Remove variable masking warnings
    • Cleanup unused system declarations
    • Reorganize headers and source files to make it clearer which parts of the code are required, optional and part of the public API
    • improve file organization
    • fix cmake build

    This release addresses the following issues:

    • Fix issue that could cause crash in map implementation
    • Fix issue where OnSet system could trigger on columns that are not owned
    • Remove references to UT_ macro's from bake.util
    • Replace TRUE and FALSE with true and false
    • Fix issue where new_from_path would add CHILDOF | 0 for entity in root

    For a list of changes between v1 and v2 see the migration guide

    Known issues:

    • OnSet systems are not invoked for tables created while staged
    • OnSet systems are not invoked when an overridden component is removed
    Source code(tar.gz)
    Source code(zip)
  • 2.0.3-alpha(Jun 17, 2020)

    This is a pre-release of v2.0. Do not use this release for production code. Bugs are to be expected. The purpose of this release is to help existing users migrate from v1.0 to v2.0.

    This code has not been as rigorously tested as a normal release, and documentation is not up to date.

    This release addresses the following issues, amongst others:

    • Implement namespacing
    • Split core up into separate modules and utilities
    • Add header documentation
    • Fix issue with ecs_deactivate_systems
    • Fix issues with multithreading

    For a list of changes between v1 and v2 see the migration guide

    For a list of changes between v1 and v2 see the migration guide

    Known issues:

    • OnSet systems are not invoked for tables created while staged
    • OnSet systems are not invoked when an overridden component is removed
    Source code(tar.gz)
    Source code(zip)
  • v1.3(Jun 23, 2020)

    This is the last v1 release. New applications should start with Flecs v2.

    This version includes the following features:

    • Port several functions from C to C++ API
    • Add overloads for world::add & world::remove
    • Add function to count inactive systems

    This version includes the following improvements:

    • Add periodic system example for C API
    • Enforce that 'action' is last method called when constructing system in C++
    • Enable staging when invoking ecs_run
    • Store table_count in ecs_rows_t
    • Added task examples
    • Added target_include_directories to cmake file

    This version includes the following bugfixes:

    • Fix duplicate type definitions
    • Fix bug where column count of 0 caused out of memory
    • Fix sources list for meson build file
    • Fix mismatching return types for get/set_target_fps
    • Fix alignment issue with ecs_vector_t
    • Fix bug with passing CONTAINER column into reactive system
    • Remove invalid assert from ecs_import_from_library
    • Fix issue with using OWNED / SHARED in a reactive system
    • Fix issue where a disabled system could become enabled again
    • Fix dangling pointer to world in entity::type()
    • Fix issue where merge could happen twice
    • Don't merge manual system when auto_merge is false
    • Fix crash when deleting parent
    • Fix issue where ecs_run would use filter where it shouldn't
    Source code(tar.gz)
    Source code(zip)
  • v1.2(Jan 6, 2020)

    This version includes the following features:

    • A C++11 API (#115)
    • Snapshots (#7)
    • Blob serialization & deserialization (#114)
    • On demand systems (#82)
    • System on enable/activate callbacks (#83)
    • Filter-based iteration over entities (#117)
    • An introspection API for improved debugging . (#100)
    • A new statistics module (replaces old stats API, #88)
    • A command-line debug console (https://github.com/flecs-hub/flecs-systems-console)
    • A new prometheus module for server-side monitoring (https://github.com/flecs-hub/flecs-systems-prometheus)

    This version includes the following improvements:

    • Improved error messages when system signature parsing fails (#90)
    • Many new examples (#55)
    • Cleanup of flecs header, moved supporting functions to api_support.h (#116)
    • Work with older versions of CMake (#87)

    This version includes the following bugfixes:

    • Fix issue with using singleton as parent entity (#81)
    • Fix issue where manual systems are not correctly activated (#86)
    • Fix issue with NOT operator in combination with FromEntity columns (#89)
    • Fixed memory leak in ecs_chunked_t datastructure (#95)
    • Fix issue where ECS_MODULE would take address of temporary variable (#98)
    • Fix issue when get_parent is called while iterating (#97)
    • Fix leak in on demand administration (#104)
    • Fix leaking system signatures (#103)
    • Add strdup to OS API, remove uses of strdup in code (#106)
    • World time now starts counting when application starts vs. 0

    This version adds the following functions:

    • ecs_add_entity
    • ecs_remove_entity
    • ecs_has_entity_owned
    • ecs_count_w_filter
    • ecs_is_readonly
    • ecs_table_type
    • ecs_table_column
    • ecs_filter_iter
    • ecs_snapshot_filter_iter
    • ecs_filter_next
    • ecs_set_system_status_action
    • ecs_snapshot_take
    • ecs_snapshot_restore
    • ecs_snapshot_copy
    • ecs_snapshot_free
    • ecs_reader_init
    • ecs_snapshot_reader_init
    • ecs_reader_read
    • ecs_writer_init
    • ecs_writer_write
    • ecs_type_remove
    • ecs_type_match_w_filter
    • ecs_type_index_of
    • ecs_enable_console
    Source code(tar.gz)
    Source code(zip)
Owner
Sander Mertens
Sander Mertens
Gaming meets modern C++ - a fast and reliable entity-component system (ECS) and much more

EnTT is a header-only, tiny and easy to use entity-component system (and much more) written in modern C++. Among others, it's also used in Minecraft by Mojang and The Forge by Confetti.

Sean Middleditch 8 Feb 16, 2021
Simple tower defense game using C++ with Entity Component System (ECS)

CubbyTower CubbyTower is a simple tower defense game using C++ with Entity Component System (ECS). The code is built on C++17 and can be compiled with

Chris Ohk 35 Nov 18, 2022
A C++14 Entity Component System

NOTICE: This project is currently in the progress of being rewritten for C++17. Check out this issue if you have any suggestions/know a good way to tr

Elnar Dakeshov 187 Nov 9, 2022
An open source C++ entity system.

anax ARCHIVED: as I haven't maintained this library for at least a couple of years. I don't have the time or interest to work on this. Please use anot

Miguel Martin 457 Nov 16, 2022
Yet another component system

Yet another component system Header-only c++11 entity component system Depends on Parallel hashmap for fast pointer container Compile time type name a

Devil Devilson 11 Jul 30, 2022
Godex is a Godot Engine ECS library.

Godex Godex is a Godot Engine ecs library. Disclaimer: this module is still in development, open an issues to report any problem or a new discussion i

GodotECS 745 Nov 27, 2022
This is an ECS archetecture in Game implemented by C++

ECS This is an implement of the ECS archetecture in Game by C++17 ⭐ Star us on GitHub — it helps! ECS Sun Entity-Component-System Compiler compatibili

yao tang 40 Nov 16, 2022
A lightweight but complete ECS implementation for modern C++.

ECS A lightweight but complete ECS implementation for modern C++. Features Cache friendly design implemented on top of an EnTT-like sparse set. Clean,

null 7 Sep 3, 2022
Replace Minecraft entity with MMD model.

KAIMyEntity Replace Minecraft entity with MMD model. KAIMyEntitySaba 将Github项目 benikabocha/saba (https://github.com/benikabocha/saba) 魔改成一个以JNI形式Expor

null 30 Oct 16, 2022
A foobar2000 component which allows you to load and play ncm files directly.

Play NCM files directly with our favourite How to setup and build project Download foobar2000 SDK and extract into vendor/sdk Download WTL from source

null 37 Nov 25, 2022
Simple, fast, easy to get started mid-level game engine written in Zig

Alka Game engine written in zig, compatible with master branch. This engine does provide a toolset for you but generally you have to implement how the

Kiakra 22 Oct 23, 2022
A simple localization framework that can re-localize in built maps based on FAST-LIO.

Realtime 3D global localization in a pre-built point cloud map. By fusing low-frequency global localization (about 0.5~0.2Hz), and high-frequency odometry from FAST-LIO, the entire system is computationally efficient.

KINO 238 Dec 3, 2022
A Tiny 2D OpenGL based C++ Game Engine that is fast, lightweight and comes with a level editor.

A Tiny 2D OpenGL based C++ Game Engine that is fast, lightweight and comes with a level editor.

Samuel Rasquinha 56 Nov 28, 2022
MotorMC is a blazing fast, multi threaded, asynchronous Minecraft server software

MotorMC is a blazing fast, multi threaded, asynchronous Minecraft server software that aims to handle many players (1000+) on a single world while still providing an experience as close to vanilla Minecraft as possible.

Garet Halliday 73 Nov 9, 2022
Real-time Water - Fast Water Simulation for Games Using Height Fields

In this project a water-simulation was implemented based on the approach suggested in the presentation "Fast Water Simulation for Game

Henrik Patjens 137 Jun 4, 2022
A fast, practical GPU rasterizer for fonts and vector graphics

Pathfinder 3 Pathfinder 3 is a fast, practical, GPU-based rasterizer for fonts and vector graphics using OpenGL 3.0+, OpenGL ES 3.0+, WebGL 2, and Met

Servo 3k Dec 2, 2022
Ultralight is an ultra-fast, ultra-light, standards-compliant HTML renderer for applications and games.

Ultralight is an ultra-fast, ultra-light, standards-compliant HTML renderer for applications and games. It supports most modern HTML5, CSS, and JavaScript features while still remaining light in binary size and memory usage.

Ultralight 4.1k Nov 27, 2022
Simple CSV localization system for Unreal Engine 4

BYG Localization We wanted to support fan localization for Industries of Titan and found that Unreal's built-in localization system was not exactly wh

Brace Yourself Games 55 Nov 24, 2022
GammaGo is an interactive go game system that integrates image recognition with robot arm control.

Introduction GammaGo is an interactive go game system that integrates image recognition with robot arm control. This repository contains all the neces

Jin Zihang 5 Jul 31, 2022