Skip to content

Flecs v4.0.4

Latest
Compare
Choose a tag to compare
@SanderMertens SanderMertens released this 08 Jan 01:33
· 5 commits to master since this release
8a1e9ab

Happy new year! πŸ₯‚ πŸŽ‰

Highlights

  • Component ids no longer need to match between worlds, which means Flecs worlds are now truly independent!
  • Enums with custom underlying types are now properly supported by the core and meta addon
  • The script and query implementations have been fuzzed, which lead to lots of gnarly bugs being found πŸ›
  • A big flecs script refactor improved performance 50x (!) over 4.0.3, and 6x over 3.2.12
  • Many, many new flecs script features which means much more complex scenes can now be built:

buildings
Procedural scene constructed from primitive shapes with flecs script

Release notes

This version includes the following bugfixes:

  • [cpp] Fix ubsan error in free_obj<T> (thanks @jspohr!)
  • [cpp] Fix issue with registering hooks after component registration (thanks @jpeletier!)
  • [cpp] Fix issue where calling set_group/set_var on const query objects was not possible
  • [cpp] Fix crash when iterating components of entity with an empty type
  • [cpp] Fix issue with nested observers and implicit namespaced component registration
  • [cpp] Fix issue with reregistering component symbol after deletion
  • [cpp] Fix issue where shared fields could not be accessed with field/field_at in each callback
  • [cpp] Fix issue with enum_data::index_by_value
  • [cpp] Fix crash in C++ addon logging
  • [cpp] Fix issue in C++ API when iterating a large number of sparse components
  • [core] Fix issue where batched commands for implicitly registered component could crash
  • [core] Fix issue with registration of traits for builtin entities
  • [core] Fix issue with using ecs_entity_desc_t::set while deferring is suspended
  • [core] Fix illegal memory access in ecs_add_path_w_sep
  • [core] Fix write to invalid memory in flecs_path_append
  • [core] Fix issue with name lookups that have multiple consecutive separator characters
  • [core] Fix issue with attempting to lookup #id's with value larger than UINT32_MAX
  • [core] Fix leaks when using FLECS_USE_OS_ALLOC
  • [core] Fix issues where code was accessing world flags on stage object
  • [core] Fix access to uninitialized ecs_cmd_t::id field
  • [core] Fix leak when deferring a batched set for a large non-trivial component
  • [core] Fix issue where second element of pair could not be a sparse component
  • [core] Fix command batching issue where component is added in two stages
  • [observers] Fix issue where observers could be triggered multiple times for the same event
  • [observers] Fix issue where event was incorrectly propagated for masked component
  • [observers] Fix issue where observer with multiple up() terms could get duplicate events
  • [observers] Fix issue where OnTableCreate observer did not trigger in deferred mode
  • [queries] Fix crash when sorted query with MatchEmptyTables only matches empty tables
  • [queries] Fix issue where up traversal with inheritance could return duplicate results
  • [queries] Fix issue where IsA was incorrectly traversed for non-inheritable components
  • [queries] Fix issue with using query.find(flecs::entity, ...) and EcsQueryMatchEmptyTables
  • [queries] Fix issue where queries would return inconsistent component id for *From operator fields
  • [queries] Fix assert that happens while reporting a query error
  • [queries] Fix assert when query has unbalanced {} scopes
  • [queries] Fix issue where query incorrectly treated this entity reference as variable
  • [queries] Fix issue with queries that have mixed cached fields and shared fields
  • [queries] Fix issue with queries created in stage, change detection and shared fields
  • [meta] Fix memory leaks in cursor string conversions
  • [json] Fix issue where override components would show up as inheritable in serialized JSON
  • [script] Fix issue where script AST would incorrectly cache ids of entities created by template
  • [script] Fix issue with parsing opaque primitive components
  • [script] Fix issue with using pair components in templates
  • [rest] Fix issue with reporting errors that contain formatting characters
  • [misc] Fix file handle leak when file fails to load (thanks @peter15914!)

This version includes the following improvements:

  • [cpp] Prevent recycled entity ids when reparenting C++ module
  • [cpp] Add to_json() method to flecs::query_base
  • [cpp] Allow for X_TO_JSON_INIT macros to be used in C++
  • [cpp] Fix warning for incorrect type in static_cast for inout & operator kinds
  • [cpp] Implement world local component ids
  • [cpp] Enums with custom underlying types are now supported
  • [core] Reduce overhead of monitors by not creating observers for optional terms
  • [core] Add assert to prevent entity ids from overflowing the 32 bit range (thanks @Ukendio!)
  • [core] Implement type info flags for detecting invalid component lifecycle (thanks @jpeletier!)
  • [core] Reduce page size of non-entity sparse sets (Reduce memory footprint)
  • [core] Use map instead of sparse set for type_info (Reduce memory footprint)
  • [core] Remove unnecessary observer sparse set (Reduce memory footprint)
  • [core] Reduce size of low id record array (reduces RAM)
  • [core] Change flecs.core.Disabled to (OnInstantiate, Override) (from Inherit)
  • [core] Allow for infinitely nested observer calls
  • [core] Add cycle detection in observer code to prevent stack overflows
  • [core] Add error message when invalid path is passed to ecs_add_path_w_sep
  • [core] Remove propagation of empty state for tables
  • [core] Change ecs_delete_empty_tables API by changing its parameters to a desc struct
  • [queries] Add ecs_query_get to get ecs_query_t* object from entity
  • [queries] Add more validator tests for !(ChildOf, _) queries
  • [systems] Add system disabling test
  • [script] Flecs script expression refactor
  • [script] Add support for function arguments to flecs script
  • [script] Add math functions to flecs script in a new FLECS_SCRIPT_MATH addon
  • [script] Add ability to specify variables when running a script
  • [script] Add support for multiple template instances per entity
  • [script] Improve detection of invalid statements in with scopes
  • [script] Add ability to define world-scoped script variables (like PI)
  • [script] Add support for string interpolation to expression parser
  • [script] Add support for entity name expressions (like"e_$i" { })
  • [script] Implement support for for var in x..y loops
  • [script] Add divide by zero checks so runtime doesn't crash but reports error
  • [script] Add more builtin script functions for doc addon and testing for components
  • [script] Implement random number generator for flecs script
  • [script] Bulk-add components in entity scope to improve script performance
  • [script] Add support for else if
  • [script] Add support for match expressions
  • [script] Add support for using add assign and multiply assign in initializers
  • [script] Empty scopes now create an anonymous entity
  • [script] Allow referring to variables without $
  • [script] Variables now need to use const x: value notation when using implicit type
  • [script] Props can now have implicit types
  • [http] Allow HTTP server to be created without threading support (thanks @basicer!)
  • [http] Allow for script code to be provided in body of /script request
  • [http] Increase size of HTTP receive buffer, throw warning if request exceeds it
  • [http] Add body parameter to ecs_http_server_request
  • [docs] Add system & query examples for each and run callback variants
  • [docs] Add example that shows how to iterate multiple queries in a system
  • [docs] Add Unreal-Flecs link to documentation page
  • [docs] Fix issue with query_to_custom_json example
  • [docs] Fix ecs/world typo in system manual (thanks @iHR4K!)
  • [docs] Add Resistance is Brutal to README
  • [docs] Improvements to migration guide (thanks @999pingGG!)
  • [docs] Add flecs tutorial links to documentation page
  • [ci] Fix warnings in tests (thanks @jpeletier!)
  • [ci] Silence clang warning about missing default case
  • [ci] Fix CI bazel job to work with new bazel version

Breaking changes

  • Flecs script API functions have been renamed: #466 (comment)
  • flecs::reset() no longer exists: #466 (comment)
  • Events for communicating empty table state no longer exist: #466 (comment)
  • The signature of ecs_http_server_request has changed: #466 (comment)
  • The const var = value script syntax has been deprecated: #466 (comment)
  • Empty script scopes now create anonymous entities: #466 (comment)
  • Not strictly a breaking change, but the order in which nested observers are evaluated has changed, which may break code that relied on observer ordering (which is undefined).

New Contributors

Full Changelog: v4.0.3...v4.0.4