Deepscorn / Entitas.Generic

Entitas Generic Entities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Entitas Generic Entities

Implementation of generic entities for entitas without need for code generator. It enables using of code refactoring tools provided by IDE, ease refactoring. As well it’s possible to create libraries of components/systems which can be compiled into separate modules and reused between projects. At the same time library provides nice API and same performance as generated solution (benchmark shows difference about 0.001 ms between code generator version and generic one).

What library provides?

Library provides:

  • API to register scopes at runtime.

  • API register components at runtime, autoscan capability is provided too.

  • Create/Add/Replace generic API.

  • Generic Matchers API.

How it’s different from Entitas?

Library uses slightly different approaches to work with component data: - every component is containter for data of given type (ComponentData), - data can be reference (class) or value type (struct, enum).

Reference types as component data is useful for immutable data like unit characteristics (max velocity, max health, configuration of steering behaviour, etc.) and can be shared between entities of same type. Value types are good for data which is updated separatelly for every entity, structs are good in terms of performance and usability. To set values of struct fields you have to create appropriate constructor or field initializer can be used, it keeps API clean and simple.

Examples?

Provided sample contains complete example how to define components and setup system.

About

Entitas Generic Entities


Languages

Language:C# 100.0%