1.0.16
New Features
Several new features were added in this release, especially gameplay relevant features to ease development.
Exclusive Queries
With the previous query API you could not target exclusive entity architectures.
This now has changed.
var exclusiveGroup = new[] { typeof(Transform), typeof(Rotation) };
var query = new QueryDescription { Exclusive = exclusiveGroup }; // Only targets entities with EXACTLY those components.
world.Query(in query, (in Entity en) => {}); // Only queries entities with "Transform" and "Rotation", no entities with other components.
Huge thanks to @MindSwipe for the contribution of the exclusive queries ! :)
Command Buffers
Due to the iteration mechanism it was not possible to the world or the entity itself during queries. Now theres a way for exactly those purposes, called "Buffers". They "buffer" operations to play them back after a query.
There 4 specialised buffers, one for each operation :
CreationBuffer
- A buffer which records creation commandsModificationBuffer
- A Buffer which records set operationsStructuralBuffer
- A buffer which records structural operationsDestructionBuffer
- A buffer which records destroy operations
A small example :
var creationBuffer = new CreationBuffer(world, 1024); <- Initial capacity, not total capacity
world.ParallelQuery(in desc, (in Entity en) => {
var entity = creationBuffer.Create(group);
entity.Set<Explosion>(...);
entity.Set<Position>(...);
});
creationBuffer.Playback(); // Must happen after a queries on the mainthread.
They are all thread safe and can be used with parallel queries.
More Parallel methods
The parallel queries were extended by a few methods like...
world.ParallelQuery(in desc, (in Entity en ) => {});
...