Update Design Doc: `level` tool
parent
9f4d33530a
commit
da6445873f
|
@ -87,33 +87,22 @@ The collision map is just an array of 8-bit unsigned integers laid out with the
|
|||
### .ecs Format (Entity-Component System)
|
||||
This file contains the entity-component system defined by the [attributes](#entity-component-system) set in Tiled Map Editor's object layer(s).
|
||||
|
||||
#### Header
|
||||
Holds information on the sizes of various large segments in the file.
|
||||
```
|
||||
2 bytes: Object Table Size
|
||||
* The object table is a sparse array of active entities you memcpy into RAM.
|
||||
* Normally this is 512 but future versions of level may permit customisation.
|
||||
2 bytes: Component Attribute Union Size
|
||||
* This is the size in bytes of the largest type
|
||||
* i.e. the one requiring the most bytes for its component attributes (2 bytes each).
|
||||
2 bytes: Number of systems
|
||||
* This is the number of systems in the total Entity-Component System.
|
||||
```
|
||||
|
||||
#### Type Table
|
||||
Holds the registry of types and which set of components is associated with each type.
|
||||
```
|
||||
2 bytes: Number of Types (A Type is a predetermined combination of components.)
|
||||
For (Number of types):
|
||||
1 byte: Type ID (1-255)
|
||||
1 byte: Number of components attached to this type
|
||||
For (Number of components attached to this type):
|
||||
1 byte: ID of the component
|
||||
2 bytes: Type Definition Union Size
|
||||
* This is the size in bytes of the largest combo of components for a type.
|
||||
For (Number of Types * Type Definition Union Size):
|
||||
1 byte: ID of the component (00 = No component in this slot, supposed to be at end)
|
||||
```
|
||||
|
||||
#### Object Table
|
||||
Holds the list of active entities (or Objects). Normally you memcpy this into your RAM and work on it after its initial state defined here.
|
||||
```
|
||||
2 bytes: Object Table Size
|
||||
* The object table is a sparse array of active entities you memcpy into RAM.
|
||||
* Normally this is 512 but future versions of level may permit customisation.
|
||||
For (Object Table Size):
|
||||
1 byte: ID of the type. (00 = No entity defined in this slot)
|
||||
```
|
||||
|
@ -121,6 +110,9 @@ For (Object Table Size):
|
|||
#### Component Attribute Table
|
||||
Holds the list of active component attributes for each entity. Is a tagged union where the tag is the entity Type defined in the respective Object Table index, which you can get by dividing an index into this table by Component Attribute Union Size.
|
||||
```
|
||||
2 bytes: Component Attribute Union Size
|
||||
* This is the size in bytes of the largest type
|
||||
* i.e. the one requiring the most bytes for its component attributes (2 bytes each).
|
||||
For (Object Table Size * Component Attribute Union Size):
|
||||
(Component Attribute Union Size) bytes:
|
||||
```
|
||||
|
@ -128,6 +120,8 @@ For (Object Table Size * Component Attribute Union Size):
|
|||
#### System Table
|
||||
For each unique system ID, a length of the array, then a list of indices into the Object Table pointing to active objects that are relevant to this system (by virtue of their Types containing components used by this system).
|
||||
```
|
||||
2 bytes: Number of systems
|
||||
* This is the number of systems in the total Entity-Component System.
|
||||
For (Number of systems):
|
||||
1 byte: Number of attached components
|
||||
For (Number of attached components):
|
||||
|
|
Loading…
Reference in New Issue