Flecs v2.2
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. Useiter
instead. EcsSingleton
andflecs::Singleton
are deprecated. Use new singleton API instead- The
is_shared
function in theflecs::iter
class is deprecated. Useis_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++) orecs_is_readonly
to return a different value (in C). To fix issues caused by this change, addconst
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 toaction()
- 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 areNULL
ecs_os_api_strdup
incorrectly usedecs_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