Update Design Doc: `level` tool
parent
c5fd8ed9c8
commit
b555e57202
|
@ -81,44 +81,12 @@ For (Number of Sprites):
|
|||
2 byte: Animation speed (in 1/60 of a second)
|
||||
```
|
||||
|
||||
### .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).
|
||||
|
||||
This file format is optimised for use on-console and as such uses sparse arrays and unions to represent most data. An index into each of these sparse arrays constitutes the ID of a given kind of data. This allows your game engine to find types, component attributes, etc without having to iterate through arrays in hot loops.
|
||||
|
||||
#### Type Table
|
||||
Holds the registry of types and which set of components is associated with each type. An index into this table is the ID of the type. If there are no components in the type, that type ID is unused. Maximum of 254 types per level.
|
||||
### .obs file (Objects)
|
||||
This file contains a large array of object structs as defined by the `--fields` option.
|
||||
```
|
||||
2 bytes: Number of Types (A Type is a predetermined combination of components.)
|
||||
2 bytes: Type Definition Union Size
|
||||
* This is the size in bytes of the largest combo of components for a type.
|
||||
* Remember each component ID is 1 byte.
|
||||
For (Number of Types):
|
||||
(Type Definition Union Size) bytes: List of Component IDs
|
||||
* FF = No component in this slot
|
||||
```
|
||||
|
||||
#### 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 (or Objects) 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.
|
||||
* FF = No object active in this slot
|
||||
* To dereference Type:
|
||||
* Multiply this ID by (Type Definition Union Size)
|
||||
* Add that to address of Type Table - 4 bytes
|
||||
```
|
||||
|
||||
#### Component Attribute Table
|
||||
Holds the list of active component attributes for each object.
|
||||
```
|
||||
2 bytes: Component Attribute Union Size
|
||||
* Size is the most bytes required by any particular Type to store component attributes
|
||||
* Remember each Component Attribute is 2 bytes.
|
||||
For (Object Table Size):
|
||||
(Component Attribute Union Size) bytes: Component attribute settings
|
||||
* FF FF = unused slot in this union
|
||||
2 bytes: Number of objects
|
||||
2 bytes: Size of object struct (number of 16-bit fields)
|
||||
For (number of objects):
|
||||
For (number of 16-bit fields):
|
||||
2 bytes: Field in order defined by --fields option
|
||||
```
|
Loading…
Reference in New Issue