Skip to content

v0.8.2

Compare
Choose a tag to compare
@richardbiely richardbiely released this 16 Dec 06:10
· 393 commits to main since this release
9df49b3

This is a maintenance release with a few small new features at the top.

Most of fixes and tweaks are related to CMake and Docker.

Iteration benchmark was rewritten so it does not generate thousands of various compile-time recursive operations to improve compilation times and ease of use (80s along with linking down to insignificant amount of time).

Also, starting with this release, sponsorship has became available:
https://github.com/sponsors/richardbiely
Therefore, if you like the project and want to support it, give it a star or became a sponsor. Thank you everyone, you rock!

Entity dependencies

Defining dependencies among entities is made possible via the (DependsOn, target) relationship.

When adding an entity with a dependency to some source it is guaranteed the dependency will always be present on the source as well. It will also be impossible to delete it.

ecs::World w;
ecs::Entity rabbit = w.add();
ecs::Entity animal = w.add();
ecs::Entity herbivore = w.add();
ecs::Entity carrot = w.add();
w.add(carrot, ecs::Pair(ecs::DependsOn, herbivore));
w.add(herbivore, ecs::Pair(ecs::DependsOn, animal));

// carrot depends on herbivore so the later is added as well.
// At the same time, herbivore depends on animal so animal is added, too.
w.add(rabbit, carrot);
const bool isHerbivore = w.has(rabbit, herbivore)); // true
const bool isAnimal = w.has(rabbit, animal); // true

// Animal will not be removed from rabbit because of the dependency chain.
// Carrot depends on herbivore which depends on animal.
w.del(rabbit, animal); // does nothing
// Herbivore will not be removed from rabbit because of the dependency chain.
// Carrot depends on herbivore.
w.del(rabbit, herbivore); // does nothing

// Carrot can be deleted. It requires herbivore is present which is true.
w.del(rabbit, carrot); // removes carrot from rabbit

Entity constraints

Entity constrains are used to define what entities cannot be combined with others. Constraints are defined via the (DependsOn, target) relationship.

ecs::World w;
ecs::Entity weak = w.add();
ecs::Entity strong = w.add();
w.add(weak, ecs::Pair(ecs::CantCombine, strong));

ecs::Entity e = w.add();
w.add(e, strong);
// This is an invalid operation.
w.add(e, weak);

GAIA_DEVMODE

Developer mode is a macro that enables more integrity checks for various internal operations. Some of them are expensive and almost redundant but keep the code safe from regressions and various hard-to-locate bugs. However, they are not really useful for anyone but library maintainers. Therefore, they are now enabled only when GAIA_DEVMODE macro is on:

#define GAIA_DEVMODE 1
#include <gaia.h>

Release notes

Fixed:

  • World::relation(s) not returning proper entities 826043d

  • wildcard relationship deletion - 30af94d

  • certain CMake settings not reflected in generate_compile_commands target dcf6c58

  • crash when accessing EntityDesc of a pair (only regular entities have it) 30af94d

  • crash when copying an entity with entities attached to it 12757c7

  • crash when using diagnostics with an entity without the EntityDesc 5b145e0

  • asserts handling with GAIA_DISABLE_ASSERTS 5a2aef1

  • uninitialized variables on Archetype 8e938db

  • darr_ext move constructor ed99fd6

  • non-Xcode build workaround for MacOS with Xcode 15 or later installed 83a1a33

  • benchmark CMake configuration 689cabb

  • string argument expansion for Docker builds 689cabb

  • the correct compiler is used always for Docker builds 79717d3

Changed:

  • OnDeleteTarget behavior changed fbe6e10
  • "optional" for string queries uses ? instead of + now 2dc3b8e
  • IteratorXYZ renamed to IterXYZ 63a53af
  • handle serialization asserts at compile-time to avoid issues with older compilers 7075135
  • picobench for benchmarking made an external CMake dependency 26687dd
  • Catch2 updated to 3.5.0 10564cf
  • iIteration benchmark updated ccb8bf0 d9ab565

Tweaked:

  • improved query matching performance for simple queries 930e86f
  • one less hash combination when calculating the query hash 59b6a11
  • QOL improvement for IterAll 539d000

Added:

  • support for Pair(DependsOn, X) 27ff060
  • support for Pair(CantCombine, X) 28128a7 5a2aef1
  • GAIA_DEVMODE for library maintainers 63d7226
  • more configuration options to CMake 689cabb

Full Changelog: v0.8.1...v0.8.2