diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-05-04 18:37:00 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-05-04 18:37:00 +0100 |
commit | 35937f1e76402d25fce180c0519bef6ce77769fe (patch) | |
tree | dfbae0532ec2ce4e706fb8ad8fbfe0b1a7ed862d /yage/entity/README.md | |
parent | 09535633913069f4653c270501059c38c2d09a99 (diff) | |
download | YAGE-35937f1e76402d25fce180c0519bef6ce77769fe.tar.gz YAGE-35937f1e76402d25fce180c0519bef6ce77769fe.zip |
Improving ECS and adding documentation.
Diffstat (limited to 'yage/entity/README.md')
-rw-r--r-- | yage/entity/README.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/yage/entity/README.md b/yage/entity/README.md new file mode 100644 index 00000000..ebf539f3 --- /dev/null +++ b/yage/entity/README.md @@ -0,0 +1,36 @@ +# Entity Component System (ECS) + +## Structure + +### Entity + +The `EntityManager` is the class that manages the entities, by allocating and +deleting them as necessary. The `Entity` itself is just a handle, and does not +contain any logic or data. It is just used to refer to the `Entity` when doing +operations on it. + +### Components + +These are just data that is associated with Entities, and it gets processed +by the Systems when these are updated. The systems only process a few components +at once, which separates the logic and makes it easy to develop the Systems and +Components orthogonally. + +### Systems + +These process the Components and update their state. This completely separates +the data from the logic, and means that they can be tested independently. New +systems can be created by inheriting from the `BaseSystem`, which provides an +interface which then enables that system to be added to the main `Engine` +through different types of `Spaces`. + +## Implementation + +The Entity is just an `unsigned int`, which has a `typedef` called `Entity`, +which is also what all the functions return. + +The link between the components are managed by a templated `ComponentMapper` +class, that links every entity with it's component. This way it is also to find +out if an entity is part of a specific component, and that entity will never be +processed in the system that only targets that component, which makes it much +more efficient. |