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
  • Fix clang compilation error

    Fix clang compilation error

    Fix compilation error with the latest emscripten em++:

    ../subprojects/flecs/include/flecs/private/../addons/cpp/utils/enum.hpp:23:30: error: integer value 128 is outside the valid range of values [0, 7] for this enumeration type [-Wenum-constexpr-conversion]
      static constexpr E value = static_cast<E>(Value);
    

    Searching around in github I found the solution in the magic_enum project and adapted it.

    opened by gorilux 0
  • Memory leak assert in `ecs_fini` when using a system with a custom run action

    Memory leak assert in `ecs_fini` when using a system with a custom run action

    Describe the bug After creating a system with a custom run action and calling ecs_progress an assert gets triggered inside ecs_fini claiming there was a memory leak.

    To Reproduce Consider the following example:

    #include "flecs/flecs.h"
    #include <stdio.h>
    
    void run(ecs_iter_t* iter) {
        printf("run()\n");
    }
    
    int main(void) {
        ecs_world_t* w = ecs_init();
    
        ecs_system(w, {
            .entity = ecs_entity(w, {
                .name = "SomeSystem",
                .add = { ecs_dependson(EcsOnUpdate) },
            }),
            .query.filter.expr = "",
            .run = run,
        });
    
        ecs_progress(w, 0.0f);
    
        return ecs_fini(w);
    }
    

    This is the assert

    fatal: flecs.c: 15487: assert: stack->cur->sp == 0 LEAK_DETECTED
    

    And here is the backtrace from gdb

    #0  0x00007ffff7c8ec0c in __pthread_kill_implementation () from /lib64/libc.so.6
    #1  0x00007ffff7c3e986 in raise () from /lib64/libc.so.6
    #2  0x00007ffff7c287f4 in abort () from /lib64/libc.so.6
    #3  0x000000000042baa0 in flecs_stack_fini (stack=0x4d3048) at flecs/flecs.c:15487
    #4  0x000000000041c887 in flecs_stage_fini (world=0x4d02a0, stage=0x4d2f70)
        at flecs/flecs.c:10256
    #5  0x000000000041cb6b in ecs_set_stage_count (world=0x4d02a0, stage_count=0)
        at flecs/flecs.c:10293
    #6  0x0000000000477828 in ecs_fini (world=0x4d02a0) at flecs/flecs.c:41685
    #7  0x00000000004026c2 in main () at system_custom_run.c:22
    

    Expected behavior Should print "run()" and terminate successfully.

    Additional context I am on Fedora 36 using gcc (12.2.1) with default options to compile. I am using the master branch of flecs on the latest commit (c02479b8).

    bug 
    opened by sro5h 0
  • Documentation comments and style suggestions

    Documentation comments and style suggestions

    These are a couple of things that I came across while digging through comments.

    • Removing trailing whitespace seems like a good idea. In some cases in the code is used to indent a line with the next one that has code or comments on it, but it's pretty inconsistent. There are also plenty of places where additional spacing was left in accidentally. (This is done for the entire repository, not just source files.)
    • Some comments were documentation comments where it did not make sense. Maybe they could be converted to group / header comments for doxygen - unsure how that works - but I just turned them into regular comments for now.
    • In a couple of places have comments where it seems like it would make sense for them to be documentation comments instead.
    • I took the liberty to also make some minor cosmetic changes to align comments where it made sense or moved them around a little to match the surrounding comments better.
    • I did not touch the flecs.c / flecs.h in the root folder, I figure the changes will make it in when you update them the next time around, so I'll leave that up to you.
    • When it comes to comments, I focused on the C header files, since that'll end up in the documentation. I found one likely incorrect comment in a .hpp file through search, but I haven't gone through any of the C++ files.
    • Finally, I included a commit for an .editorconfig file. It's editor-agnostic, supported by some IDEs, to inform them which settings to use. One of the settings should have trailing whitespace trimmed automatically on saving, for example.

    I split the suggested changes into multiple commits for easier review, potential changes to be made or entire commits to be left out - I wasn't sure about the last one for example. You may want to squash these before merging.

    I can make additional changes or remove commits on request.

    opened by copygirl 0
  • 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
Releases(v3.1.3)
  • v3.1.3(Dec 28, 2022)

    Highlights

    Release notes

    This version includes the following bugfixes:

    • Fix issues with looking up numerical ids from scope (e.g. foo::bar::100)
    • Fix issue where reachable cache invalidation would not iterate all ids
    • Fix issue with parsing entity path that can't fit in 32bit int
    • Fix issue where filter with self term is created before id
    • Fix issue where id records were incorrectly deleted for ecs_remove_all/ecs_delete_with
    • Fix issue with adding ChildOf pair and deferred ecs_entity_init
    • Fix issues with updating EcTableHasObserved flag (fixes reachable cache asserts)
    • Fix issue where id record could not get cleaned up correctly (fixes reachable cache asserts)
    • Add move hook to Pipeline component (fixes segfault when using multiple pipelines)

    This version includes the following improvements:

    • [entities] Use empty separator string to prevent tokenization of name in ecs_entity_init
    • [cpp] Add const to query class methods
    • [cpp] Add const to iterable class methods
    • [cpp] Add emplace_override for pairs
    • [queries] Prevent query rematching from happening more than once per query/frame
    • [pipelines] Prevent adding empty operation at end of schedule
    • [table] Support calling ecs_table_get from stage
    • [units] Add units for hyperlinks, images and files
    • [units] Add Length::Pixel unit
    • [docs] Add doxygen headers to source and include files
    • [docs] Add edcs_get_depth, entity_view::depth, ecs_table_get_depth, table::depth functions
    • [docs] Add doxygen documentation
    • [docs] Replace old flecs.dev site with doxygen generated one
    • [docs] Remove dead links to docsforge pages
    • [docs] Add instructions for how to fix compilation errors related to time/socket functions
    • [ux] Improved C/C++ APIs for working with tables
    • [ux] Remove redundant tracing when component is reregistered
    • [ux] Throw assert when trying to delete entity/component that is still queried for
    • [internals] Move code out of query iterator in preparation of union/bitset support for filters
    • [internals] Remove redundant relationship traversal call from table edge creation code

    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.2(Dec 14, 2022)

    Highlights

    • The Flecs explorer can now edit component values!
    • Systems can now be registered with an OnStart phase which is ran only in the first frame

    Release notes

    This version includes the following bugfixes:

    • Fix issue with C++ bitmask binding (type must now inherit from flecs::bitmask)
    • Fix issue where use_low_id was not set by ECS_COMPONENT
    • Fix issues with invoking ctor/move/dtor when merging tables
    • Fix issue where observer could be invoked for wrong table
    • Fix invalid read in multithreaded app after pipeline rebuild
    • Fix race condition between pipeline worker and no_readonly system
    • Fix issue where term with wildcard pair & self flag would not iterate all permutations
    • Fix issue where get_mut<First, Second> would always return First*

    This version includes the following improvements:

    • [cpp] Add missing const to flecs::world methods
    • [cpp] Add missing const to flecs::entity_view methods
    • [cpp] Change argument type of run_pipeline to flecs::entity_t
    • [cpp] Add observer::query method
    • [pipeline] Refactor of pipeline code
    • [pipeline] Add OnStart phase for systems that are ran only at startup
    • [rest] Add set endpoint for remotely setting component values
    • [rest] Add delete endpoint for remotely deleting an entity
    • [internals] Add debugging instrumentation to allocator
    • [internals] Remove redundant code
    • [internals] Add missing tests for get pair operations
    • [internals] Split off entity filter code (union relationships/bitsets) from query iterator code

    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.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)
Owner
Sander Mertens
Sander Mertens
Fast C++ implementation with JSI binding of MD5 for React Native

react-native-quick-md5 Brazingly fast C++ implementation with JSI binding of MD5 for React Native. Confirmed that it's 10x faster than using spark-md5

Takuya Matsuyama 81 Nov 22, 2022
This is a fast module to probing an area in a 2d plane for physic objects

Godot AreaProber 2D Checking for neighbour colliders made easy AreaProber allows you to probe for colliders anywhere in your 2D game's world, no need

Strauji 8 Feb 14, 2022
A C++ implementation of Fast Simulation of Mass-Spring Systems

Fast Mass-Spring System Simulator A C++ implementation of Fast Simulation of Mass-Spring Systems [1], rendered with OpenGL. The dynamic inverse proced

Samer Itani 163 Dec 27, 2022
RGL - 3D visualization device system for R using OpenGL

RGL - 3D visualization device system for R using OpenGL INTRODUCTION The RGL package is a visualization device system for R, using OpenGL or WebGL as

null 68 Dec 27, 2022
3D Solar System Scene

This was my Computer Graphics' project. In this i used OpenGL and Glut to create a 3D Solar System Scene. Its without textures and wrapping. Just the most basic functionalities.

Hassan Shahzad 7 Jun 20, 2022
runcat system tray on Linux (using libappindicator)

runcat-tray Is a runcat port for Linux using libappindicator

Yongsheng Xu 19 Dec 20, 2022
Implementation of light baking system for ray tracing based on Activision's UberBake

Vulkan Light Bakery MSU Graphics Group Student's Diploma Project Treefonov Andrey [GitHub] [LinkedIn] EARLY STAGES OF DEVELOPMENT Project Goal The goa

Andrei Treefonov 7 Dec 27, 2022
A modern, feature-rich single header C++ interface system for GLFW

A modern, feature-rich single header C++ interface system for GLFW

Vortex 3 Dec 27, 2021
Simple console tool to get all the information from DXGI and Direct3D 12 on current system

D3d12info Simple console tool to get all the information from DXGI and Direct3D 12 (D3D12) on current system. Built and tested on Windows 10 64-bit us

Adam Sawicki 40 Dec 8, 2022
A fast entity component system (ECS) for C & C++

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

Sander Mertens 3.5k Jan 8, 2023
A fast entity component system (ECS) for C & C++

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

Sander Mertens 3.4k Dec 31, 2022
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 library for game programming and much more written in modern C++. Among others, it's used in Minecraft by

Michele Caini 7.6k Dec 30, 2022
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 39 Dec 20, 2022
Entity-Component-System (ECS) with a focus on ease-of-use, runtime extensibility and compile-time type safety and clarity.

Kengine The Koala engine is a type-safe and self-documenting implementation of an Entity-Component-System (ECS), with a focus on runtime extensibility

Nicolas Phister 466 Dec 26, 2022
EntityX - A fast, type-safe C++ Entity-Component system

EntityX - A fast, type-safe C++ Entity Component System NOTE: The current stable release 1.0.0 breaks backward compatibility with < 1.0.0. See the cha

Alec Thomas 2k Dec 29, 2022
apecs: A Petite Entity Component System

apecs: A Petite Entity Component System A header-only, very small entity component system with no external dependencies.

Matt Cummins 17 Jun 1, 2022
Small implementation of c++ entity component system inspired by Unity

EntityComponentSystem About This is small implementation of entity component system with C++. The API is heavily inspired by Unity ECS framework, but

Lukas Chodoseviฤius 2 Oct 13, 2021
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
[WIP] Experimental C++14 multithreaded compile-time entity-component-system library.

ecst Experimental & work-in-progress C++14 multithreaded compile-time Entity-Component-System header-only library. Overview Successful development of

Vittorio Romeo 450 Dec 17, 2022