Demos #10
1 changed files with 23 additions and 25 deletions
48
README.md
48
README.md
|
|
@ -2,10 +2,9 @@
|
||||||
[](https://gitlab.com/Mergul/bubel-ecs/-/commits/master)
|
[](https://gitlab.com/Mergul/bubel-ecs/-/commits/master)
|
||||||
[](https://codecov.io/gl/Mergul/bubel-ecs)
|
[](https://codecov.io/gl/Mergul/bubel-ecs)
|
||||||
|
|
||||||
BubelECS is Entity-Component-System architecture implementation in D language.
|
BubelECS is Entity-Component-System architectural pattern implementation in D language.
|
||||||
Library aims to delivery fast and flexible architecture for developing games. Library is @nogc and betterC compatible. Even Emscripten build works very well.
|
Library aims to delivery fast and flexible architecture for developing games. Library is **@nogc** and **betterC** compatible. WASM is supported thorugh Emscripten.
|
||||||
Important goal is to keep code without any external dependencies, i. eg. multithreading support don't contain any parallel execution
|
Project haven't any external dependencies.
|
||||||
but emit jobs with delegate and array of dependencies.
|
|
||||||
|
|
||||||
BubelECS was tested on Linux, Windows, Android and WASM.
|
BubelECS was tested on Linux, Windows, Android and WASM.
|
||||||
|
|
||||||
|
|
@ -13,40 +12,38 @@ BubelECS was tested on Linux, Windows, Android and WASM.
|
||||||
|
|
||||||
## Design
|
## Design
|
||||||
|
|
||||||
For core information about Entity-Component-System architectural pattern I recommend to read definition described at [Wikipedia](https://en.wikipedia.org/wiki/Entity_component_system).
|
For core information about Entity-Component-System architectural pattern please read definition described at [Wikipedia](https://en.wikipedia.org/wiki/Entity_component_system).
|
||||||
|
|
||||||
Main design principles are:
|
Main design principles are:
|
||||||
|
|
||||||
* **Data oriented design** - components memory is packed into tight block so iterating over entity components is cache friendly
|
* **Data oriented design** - components memory is packed into tight block so iterating over entity components is cache friendly
|
||||||
* **Fast and safe EntityID** - every entity is referenced by its unique ID. If entity was destroyed EntityManager will return null pointer for given EntityID. Access to entity from ID is linear operation.
|
* **Fast and safe EntityID** - every entity is referenced by its unique ID. Accessing by ID is safe even if entity don'y exist. Access by ID is constant time operation.
|
||||||
* **Multithreading support** - whole library was developed with multithreading in mind. Adding components is thread-friendly so you get usable EntityID as early as possible. Operations like adding or removing components are deferred to end of frame. Dependencies between systems update are generated automatically.
|
* **Multithreading support** - whole library was developed with multithreading in mind. Adding components is thread-friendly so you get usable EntityID as early as possible. Operations like adding or removing components are deferred to end of frame. Dependencies between systems parallel execution are generated automatically.
|
||||||
* **Good logic separation** - system needs information only about components which it's use, there is no relation between systems. Systems can be compiled as multiple separate libraries and used together.
|
* **Good logic separation** - system needs information only about components which it's use, there is no relation between systems. Systems can be compiled as multiple separate libraries and used together.
|
||||||
* **Easy systems ordering** - systems are ordered by single priority value. Order of execution of systems with same priority is undefined but order for different priorites are always preserved.
|
* **Flexible execution model** - system iterate over entities which meet specified conditions. Components can be marked as required, optional or excluded. Systems are exectued in specific order determined by system priority.
|
||||||
* **Flexible entity to system assignment** - system iterate over any entity that has chosen components. Components can be marked as optional so isn't required but can be used by system. Additionaly system can contain list of components which makes entity excluded from calculation.
|
* **Builtin events handling** - library has builtin support for event handlig to makes easier communication between different entities.
|
||||||
* **Builtin events handling** - along with EntityManager library contain EventsManager which makes easier to communicate between multiple entities.
|
* **Hot-reload** - hot-reloading for systems should be as easy as possible. In other words library should give functionality to support hot-reload of systems and components with minimal work. **(WIP!)**.
|
||||||
* **Hot-reload** - hot-reloading for systems should be as easy as possible. **Currently not achived yet (WIP!)**.
|
|
||||||
|
|
||||||
Currently library is incredibly fast to iterate over entities and fast enought in direct access to entity component if it's needed. \
|
|
||||||
There are some assumptions that should be considered when developing application:
|
There are some assumptions that should be considered when developing application:
|
||||||
|
|
||||||
* Iterating over same components is incredibly fast so it's should be main way of making calculations.
|
* Iterating over components is fastest way of access data so it's should be main way of making calculations.
|
||||||
* Using of direct access and events should be used very wisely and not too much.
|
* Using of direct access and events should be used very wisely and minimized.
|
||||||
* Direct component access is faster than events, because events must buffer memory and call multiple system handler callbacks.
|
* Direct component access is faster than events, because events must buffer memory and call multiple system handler callbacks.
|
||||||
* Components can be used to marking entities, assingment to systems and changing logic of entity in runtime. But due to memory fragmentation there sould by many of entities with same type. In other words, sometimes making to many components can lead to performence drop even if adding or removing components is fast enough.
|
* Components can be used to marking entities, assingment to systems and changing logic of entity in runtime. Using too much component based marking can lead to memory fragmentation and performence drop.
|
||||||
* Systems give great opporunity to separate game logic. Systems can be enabled and disabled easly in runtime. It's can be used to enabling some debug systems if needed. Additionaly this concept makes game logic changes easier to deal with. If you develop your appliactiona wisely it should be trivial to change some core logic by changing only one system, or adding new system. Every entity can easily takes some behaviour from different entity type by adding several components.
|
* Systems give great opporunity to separate game logic. Systems can be enabled and disabled easly in runtime. It's can be used to enabling some debug systems if needed. Additionaly this concept makes game logic changes easier to deal with. If you develop your application wisely it should be trivial to change some core logic by changing only several systems or adding some new systems. Every entity can easily takes some behaviour from different entity type by adding several components.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* ECS architectural pattern
|
* ECS architectural pattern
|
||||||
* Data oriented design
|
* Data oriented design
|
||||||
* Safe identifiers (EntityID)
|
* Safe identifiers (EntityID)
|
||||||
* EntityTemplates - used to add entities, contain list of components and it's data
|
* EntityTemplates
|
||||||
* Basic events handling
|
* Basic events handling
|
||||||
* Easy systems ordering
|
* Easy systems ordering
|
||||||
* Automatic multithreaded jobs generating
|
* Automatic multithreaded jobs generating
|
||||||
* Runtime and fast components adding and removing
|
* Runtime and fast components adding and removing
|
||||||
* Listeners for adding and removing entity components inside systems
|
* Listeners for adding and removing entity components inside systems
|
||||||
* Passes - systems are grouped to passes. Pass update call update callback of assigned systems.
|
* Update passes
|
||||||
* Calling custom callbacks for system entity groups
|
* Calling custom callbacks for system entity groups
|
||||||
* betterC compatibility
|
* betterC compatibility
|
||||||
* Emscripten compatibility
|
* Emscripten compatibility
|
||||||
|
|
@ -54,15 +51,16 @@ There are some assumptions that should be considered when developing application
|
||||||
### Planned
|
### Planned
|
||||||
|
|
||||||
* Worlds - every world works as separate environment. Entities don't with entities from different world. Systems and components should be registered for every world separately.
|
* Worlds - every world works as separate environment. Entities don't with entities from different world. Systems and components should be registered for every world separately.
|
||||||
* Hot-reload support - currently only reloading systems (their functions) works and only if code changes apperas only inside functions. There is possibility to serialize every entity and system, but it's should be provided by library itself with special callbacks and helpers. Additionaly planned is system which helps with taking new EntityID from serialized identifiers.
|
* Hot-reload support - currently only reloading systems (their functions) works. There is possibility to serialize every entity and system, but it's should be provided by library itself with special callbacks and helpers. Additionaly planned is system which helps with taking new EntityID from serialized identifiers.
|
||||||
* External dependencies - ability to provide dependencies between system which isn't related to components.
|
* External dependencies - ability to provide dependencies between system which isn't related to components.
|
||||||
* Static components - this components will have different memory model and can be accessed only directly. It will be slower with access but don't trigger memory copy when component is added or some different entity was destroyed. It should fix problem with big components which isn't needed by systems iteration callbacks or is required rarely.
|
* Static components - this components will have different memory model and can be accessed only directly. It will be slower to access but won't trigger memory copy when component is added. It should fix problem with big components which isn't needed by systems iteration callbacks or is required rarely.
|
||||||
* Better EventManager - currently implementy event handling system isn't it what I wanted. I'm not sure exacly what I can improve but multithreaded event execution is one of things which I considered and it probably will work.
|
* Better EventManager - there are several optimization and improvements that can be added in the future.
|
||||||
* More demos and examples - demo appliaction is very basic now, but in future I planned more minigames and sanbox mode (opportunity to mix many components and systems). I planed some examples to show how to use basic functionality.
|
* More demos and examples - demo appliaction is very basic now, but in future more minigames and sanbox mode (opportunity to mix many components and systems) are planned.
|
||||||
* C API - this is currenly in consideration. Everything is dependent on my free time and amount of work required to create good C API.
|
* C API - in highly depends on amount of work required. Makes possible to use library from different languages.
|
||||||
* More smaller improvement in draft stage...
|
* GPU compute - idea in draft stage. Special components and systems whose data wolud be on GPU memory.
|
||||||
|
* More smaller improvements...
|
||||||
|
|
||||||
For more information about design and usage I recommend to read [documentation](https://mergul.gitlab.io/bubel-ecs/ecs.html)**(WIP)**.
|
For more information about design and usage feel free to read [documentation](https://mergul.gitlab.io/bubel-ecs/ecs.html)**(WIP)** and [WIKI](https://gitlab.com/Mergul/bubel-ecs/-/wikis/home).
|
||||||
|
|
||||||
## Build Instructions
|
## Build Instructions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue