Update 'docs/entity/entity.md'
Removed references to packed arrays
This commit is contained in:
parent
8c7993e0fb
commit
2f644c2f0a
@ -11,13 +11,8 @@
|
|||||||
## About
|
## About
|
||||||
An 'entity' is a unique ID.
|
An 'entity' is a unique ID.
|
||||||
|
|
||||||
For most implementations, it makes sense to use a simple integer value - usually in a packed array (*reuses the most minimal value it can*)
|
For most implementations, it makes sense to use a simple integer value to represent an entity. As each entity must have a unique
|
||||||
|
ID/number, we can use a First-In-First-Out (FIFO) data structure, such as a Queue, to efficiently retrieve the next unassigned ID.
|
||||||
E.g.: The ID 101 would be the next selected value for a new entity.
|
|
||||||
|
|
||||||
>100 | 101 | 102| 103| 104| ...|
|
|
||||||
>:----:|:-----:|:----:|:----:|:----:|:----|
|
|
||||||
><span style="color:gray">used|<span style="color:white">unused|<span style="color:gray">used|<span style="color:gray">used|<span style="color:white">unused| <span style="color:gray">....|
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -30,7 +25,7 @@ ___An entity contains no further data.___
|
|||||||
In order to be useful, its identifier must be registered to one or more [components](../component/component.md).
|
In order to be useful, its identifier must be registered to one or more [components](../component/component.md).
|
||||||
|
|
||||||
|
|
||||||
Entities are also initialised with a Java [BitSet](). Each bit represents the index of a component, to determine which component an entity is registered to
|
Entities are also initialised with a Java [BitSet](https://docs.oracle.com/javase/7/docs/api/java/util/BitSet.html). Each bit represents the index of a component, to determine which component an entity is registered to.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
*some specific usage info here*
|
*some specific usage info here*
|
||||||
@ -39,6 +34,6 @@ void todo();
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
* The only requirement for a Entity is that it has a unique ID. An [entity manager](../manager/entity_manager.md) could implement a more complex ID system such as using a packed array for only a small region of IDs, or using named IDs by use of a dictionary or ordered hash-map
|
* The only requirement for a Entity is that it has a unique ID. A more advanced [entity manager](../manager/entity_manager.md) could implement an ID system with ID regions, or using named IDs.
|
||||||
|
Another approach could be to use the first byte as a grouping, in a similar way to how Bethesda Softworks' Skyrim utilises the first byte as a mod index
|
||||||
* The maximum number of entities is limited by the size of the container used to store it. E.g., for a 32-bit unsigned integer, there are ~4.3 billion ID's available. But keep in mind that such a large amount of IDs will take significant time for each system to consider.
|
* The maximum number of entities is limited by the size of the container used to store it. E.g., for a 32-bit unsigned integer, there are ~4.3 billion ID's available. But keep in mind that such a large amount of IDs will take significant time for each system to consider.
|
||||||
* LinkedList is used to initialise the arrays, as a linked list is not limited to a maximum size: (https://stackoverflow.com/questions/3767979/how-much-data-can-a-list-can-hold-at-the-maximum)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user