Skip to content

1.0.16

Compare
Choose a tag to compare
@genaray genaray released this 04 Dec 16:55
· 356 commits to master since this release
82e73ed

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 commands
  • ModificationBuffer - A Buffer which records set operations
  • StructuralBuffer - A buffer which records structural operations
  • DestructionBuffer - 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 ) => {});
...