| |
Starshatter "def" files are plain-text files that
all use the same C-like syntax.
Each def file begins with a file type
identifier, usually appearing by itself on the first
line, that indicates what type of data are contained
in the file. For mod purposes, the most important file
types are:
Following the file type ID is a list of name-value
attribute pairs that encode the information contained
in the file. Name-value pairs are written like this:
name : value
The name is a symbolic identifier that consists
of letters, numbers, and underscores. Names must not start
with a number. Each type of def file uses a different
set of names to identify the attributes of the object
being modeled.
The value side of the declaration contains
the value of the attribute identified by the name.
Values may be of the following data types:
| boolean |
boolean logic values |
true or false |
| numeric |
integral or floating-point constants written in scientific notation |
1 -2.5e3 |
| string |
double-quote delimited string of characters |
"hello world" |
| vector |
three numeric values, surrounded by parentheses and separated by commas |
(1, 2, 3) |
| struct |
curly brace delimited list of name:value pairs |
see below |
Note that string values may be written without
double quotes IF the string contains only letters,
numbers, and underscores. Strings, quoted or otherwise,
may not contain newlines or carriage returns. Adjacent
quoted strings are automatically concatenated. This
allows you to create large strings without using
long unreadable lines of text:
"This is all just "
"one big old string."
Complex data types are represented in def files
by structures. A structure is a curly-brace
delimited list of name:value pairs that is treated
as a single value. Within a structure, the name:value
pairs must be separated by commas. A single trailing
comma is permitted after the last name:value pair in
a structure, and is ignored.
Since structures contain name:value
pairs, they can be nested (although this is not used
very often).
Starshatter def files may include C++ style comments.
Comments either begin with two slashes "//" and extend
to the end of line, or they begin with "/*" and extend
to the next occurrance of "*/".
EXAMPLES:
SHIP /* File Type ID */
name: Orion // unquoted string
detail_0: "model.mag" // quoted string because of dot
feature_0: 1000 // integral numeric
mass: 517e3 // scientific notation
drag: 1.0e-7
chase: (0, -1800, 170) // vector
bridge: (0, 600, 100)
power: { // structure
type: Fusion,
design: "Fusion Reactor",
max_output: 90e3,
loc: (0, -48, -180),
size: 48,
hull_factor: 0.3,
explosion: 7
}
|
|
|