# Set format information

`*.set` files seem to act as a palette of objects for a [`.map`](maps.md) file.
The map file loads a set, and can then reference objects by a small number.

Since a maximally-filled map file seems to be able to reference 91,000 * 4
objects, this is a necessary optimization for 1998-era hardware.

Complete parser implementation [here](../../internal/sets.md).

## Structure

These files are plain-text. A `template.set` is handily included:

```
set template

Defs

40 40 40 80


dirt
h_dirt
rocks
blank
blank
blank
blank
blank
blank
blank #
blank
blank
blank
blank
blank
blank
blank
blank
blank
# ...
```

The files are of varying lengths. `template.set` is 220 lines, `map10.set` only
83.

Whitespace and comments (`#`) are ignored. We have the following lines:

* Set description (informational only)
* `Defs` literal
* 4 space-separated numbers - count of entries in each of four subsections:
    * Surface
    * Left
    * Right
    * Center
* A list of sum(counts) .asn/.obj filename prefixes, sometimes with comments
* They all seem to end with a comment of some sort, e.g. `# meaningless comment`

The groups in the `Defs` section are equivalent to the four types of object
referenced in each map cell.

The `.MAP` files reference these tiles as palette entries. Each cell in the map
has an object index and frame number. I *suspect* the object index is relative
to the correct section of the palette. TODO: check this.

## Remaining questions

Do positions in the palette have special meaning? e.g. is a particular range
always reserved for walls?

Are there any special values that don't appear as files in the `Obj/` directory?
`blank.obj` exists, so I expect not.

Once the map format is fleshed out a little more, can investigate by creating a
map with a single object from the set in it and seeing what line that works out
to be.
