RELOAD: Difference between revisions

From OHRRPGCE-Wiki
Jump to navigation Jump to search
m adding more data types
m adding a single byte
Line 40: Line 40:
The data chunk can be any of the following types.
The data chunk can be any of the following types.


====Element Type 0 (16-bit integer)====
====Element Type 0 (8-bit integer)====
{| border="1" cellpadding="1"
! Data || Meaning
|-
|BYTE || The integer to be stored.
|}
 
====Element Type 1 (16-bit integer)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 47: Line 54:
|}
|}


====Element Type 1 (32-bit integer)====
====Element Type 2 (32-bit integer)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 54: Line 61:
|}
|}


====Element Type 2 (64-bit integer)====
====Element Type 3 (64-bit integer)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 61: Line 68:
|}
|}


====Element Type 3 (double precision float)====
====Element Type 4 (double precision float)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 68: Line 75:
|}
|}


====Element Type 4 (string, inline)====
====Element Type 5 (string, inline)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 77: Line 84:
|}
|}


====Element Type 5 (string, table)====
====Element Type 6 (string, table)====
{| border="1" cellpadding="1"
{| border="1" cellpadding="1"
! Data || Meaning
! Data || Meaning
Line 84: Line 91:
|}
|}


====Element Type 6 (children)====
====Element Type 7 (children)====
Children are whole elements said to be "contained" by this one.
Children are whole elements said to be "contained" by this one.



Revision as of 00:20, 6 November 2008

The current lump format is, in many cases, a kludge. RELOAD is a proposed format to replace existing data lumps with marked up data, enabling backwards compatibility without the need for a data upgrade procedure, and allowing semantic access to data.

Several formats were considered, and I (Mike C.) decided that none were satisfactory for this purpose. So, I came up with the idea of RELOAD.

Really Efficient List Of Arbitrary Data (an alternative

The format is that of a hierarchal tree. The file format is essentially a root node that contains everything in the file. Children can be nested to an arbitrary degree, similar to other formats such as XML or JSON, without some of the overhead of a text-based language.

To be sure, there is overhead, but the benefit of being able to ask for, say, the "text box's text" instead of "the data at offset 32" makes this solution superior to a flat data file.

RELOAD format

A RELOAD file consists of two parts: A header, and the body.

File Header

About Formal Specs

Data Meaning
BYTE * 4 Magic word "RELD"
INT Version number (currently 1)
INT Header size (altogether, should be 12)

Body

The body is composed of a single element, known as the "root" element. The root contains all the data in the file, as children. Theoretically, the root could be a string element, with a simple payload, but in practise, it will always be a "container" element.

An Element

Data Meaning
SHORT Tag name, stored in the string table
BYTE Type of element. See below for a list.
??? Data. This data is wholly dependent on the Type INT. See below for more details.

The data chunk can be any of the following types.

Element Type 0 (8-bit integer)

Data Meaning
BYTE The integer to be stored.

Element Type 1 (16-bit integer)

Data Meaning
SHORT The integer to be stored.

Element Type 2 (32-bit integer)

Data Meaning
INT The integer to be stored.

Element Type 3 (64-bit integer)

Data Meaning
INT * 2 The integer to be stored.

Element Type 4 (double precision float)

Data Meaning
DOUBLE The float to be stored.

Element Type 5 (string, inline)

Data Meaning
INT Size of string
BYTE * size The string data

Element Type 6 (string, table)

Data Meaning
SHORT The string number in the string table

Element Type 7 (children)

Children are whole elements said to be "contained" by this one.

Data Meaning
INT Size of data (not including this INT)
INT Number of children
??? each child element, back to back