Skip to content

Command buffers. #6459

@moonheart08

Description

@moonheart08

A command buffer is an optimized collection of enqueued changes to later apply to the ECS (within a tick). This includes operations like entity creation, deletion, component add/remove, and other ECS-mutating operations.

Command buffers gain us a few useful utilities:

  • You will be able to queue an entity spawn, while getting its final ID in the interim without needing to dirty state unnecessarily. This can be nested arbitrarily (i.e. queue the creation of an entire tree of entities.)
  • A common pattern throughout the codebase of "work lists" (queueing up entities to do mutating operations on, then doing it after the query is up) will be given a concrete form instead of implemented on the spot where necessary.
  • Mutating operations on a single entity can be automatically aggregated for improved performance (and it would be good to offer an aggregate change API outside of command buffers as well.)
  • Command buffers improve support for parallelism in systems, as all command buffer operations (except applying them) will be thread-safe given each thread has a distinct command buffer.
  • Command buffers necessitate an "entity builder", which will allow more efficient construction of entities with a bunch of modified components.

Blocked on

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions