bubel.ecs.core

This module contain main helper templates for user. There are three structure templates (mixins) which can be added on top of structure:

  • System: make system structure
  • Component: make component structure
  • Event: make event structure

This mixins are optional and are used to adding some additional capabilities, e.g. ECS.System is used to configuring default number of jobs for system.

Struct System1
{
	mixin!ECS.System;
}

Struct System2
{
	mixin!ECS.System(16);//set number of jobs generated for system by multithreaded update
}

Struct Component1
{
	mixin!ECS.Component;
}

Struct Event1
{
	mixin!ECS.Event;
}

There is also template for generating list of excluded components "ExcludedComponets(T...)". This template takes component structure types and making list of excluded components used in "registerSystem" function.

Struct System1
{
	mixin!ECS.System;

	struct EntitiesData
	{
		... //used components
	}

	ExcludedComponets!(Comp1, Comp2);
}

Templates ReadOnlyDependencies nad WritableDependencies are used to create list of dependencies for System. Writable dependencies are bloking parallel execution of system which has same dependency (as writable or readonly). This dependencies works same as Component dependencies but can be used for creating external dependencies (e.g. dependency on spatial partitioning tree access).

enum ExternalDependency1 = "ExternalDependency1";

Struct System1
{
	mixin!ECS.System;

	struct EntitiesData
	{
		... //used components
	}

	ReadOnlyDependencies!(ExternalDependency1);
}

Public Imports

bubel.ecs.manager
public import bubel.ecs.manager;
Undocumented in source.
bubel.ecs.entity
public import bubel.ecs.entity;
Undocumented in source.

Members

Functions

becsID (from bubel.ecs.traits)
ushort becsID(T obj) via public import bubel.ecs.traits : becsID;

Return Component/System/Event unique ID

Structs

ECS
struct ECS

Main struct used as namespace for templates.

Meta

License

BSD 3-clause, see LICENSE file in project root folder.