Welcome back! It’s some time that Svelto ECS 2.8 is actually ready, as it has been used at Freejam for quite a while now (yep, we are developing Robocraft Experiments with it) and as the list of tasks for SECS 2.9 is growing, it was time to write this article (long due in reality). Unluckily the downside is that I am not finding time to complete Svelto Tasks 2.0, but its alpha state has been used, in place of Svelto Tasks 1.5, for several months as well.

Over the next week I will try to write about all the new findings and best practices through the planned series mini-examples articles and the update of the official wiki.

I am not sure if I remember all the changes introduced in Svelto 2.8, so I will focus on the main ones, while the more experimental ones will be explained step by step when I will have the time to write about them.

What’s new in Svelto ECS 2.8

  • SingleEntityViewEngine/MultiEntitiesViewEngine are no more. Now the Add/Remove and Swap Group entity callbacks can be enabled through the implementation of new Engine interfaces: IReactOnAddAndRemove and IReactOnSwap.
  • These new two interfaces complements the new EntityStream feature and together, they are used to design Svelto.ECS reactive engines. Reactive Engines are engines that react to entity changes.
    To know more about them please check this link.
  • In line with a radical change of direction, that includes giving much less importance to EntityViewStructs and Implementors, DispatchOnSet and DispatchOnChange have been redesigned to not be abused as form of event dispatch. They are now exclusively used to let implementors communicate with one single engine. The engine that has the responsibility to handle those specific events. More info about it on this link.
  • QueryEntities now can be used to return an EntityCollection that can be iterated over at the same speed of iterating an array.
  • EntityStructs do not need to hold an EGID field anymore. This allows a better use of the memory layout as now EntityStructs hold only the real data. EGID can be still added optionally, using the INeedEGID interface.
  • The old EntityView (entity views as class) are now removed.
  • Groups cannot be specified with anything else than ExclusiveGroups (all the direct uint options are now gone)
  • A new QueryUniqueEntity method has been added. This method is more a contract to the other developers than something new. It’s a way to communicate that the entity will be unique and it’s by design. Only pure EntityStructs can be used through this function, to avoid Singleton patterns. A bit more about it here.
  • ExecuteOnAllEntities callback operates now on the whole set of entities to iterate on, per group. Before the callback was called once per entity, now it’s called once per group. This method is to iterate all the entities regardless the belonging group.
  • ExclusiveGroups can now be bound to strings. This is useful for GUIs databinding and I will talk about it more with the next SECS miniexamples.

Other minore changes:

  • GenericEntityDescriptorHolder is now marked as abstract to prevent to be used directly
  • QueryEntities now allow querying multiple entity views. This method throws if the count of entities differs, however it doesn’t guarantee that the entity structs are generated by the same entities, so attention must be paid to this as usual.

Leave a Reply