INTRODUCTION
I use a Traveller-aware, machine-friendly but human-readable format for Adventure-Class Ships.
Data typically takes up around 2K bytes, but there are some free text fields that can make the file larger. However, even with explanatory text, these files don't seem to get above 20 KB.
Anyway.
This format has a dual nature.
First, it is not difficult to write a simple parser for it: you need to be able to read line by line, and you need to be able to split on the colon or the space character. If you can do that, then it should be easy to know where you are and what do to.
Second, it's also a strict subset of YAML, so a YAML parser should be able to parse it in one operation.
STRUCTURE
It has three sections.
Header
This comes first. It is a set of key-value pairs that identify the format version, creation date, and general ship information.
Generally, this section begins with a line containing only three dashes. This can be omitted; if it's present, then everything in front of it should be considered free text and skipped.
Component Array
This section begins with a line containing only "Components:". It is followed by a list of components with the following format:
Each component line begins with a space, then a dash, then another space.
Each component then follows with a set of six space-delimited configuration strings, then a descriptive text label of arbitrary length.
The configuration strings are required, even if they're just a dash, because that makes them easy to split up.
The six configuration strings are interpreted as follows:
Footer
This optional section has a single line, starting with "ref: " and ending with a reference label. It may be a URL.
EXAMPLE
Here's a worked example using the Judges Guild subsidized liner.
I use a Traveller-aware, machine-friendly but human-readable format for Adventure-Class Ships.
Data typically takes up around 2K bytes, but there are some free text fields that can make the file larger. However, even with explanatory text, these files don't seem to get above 20 KB.
Anyway.
This format has a dual nature.
First, it is not difficult to write a simple parser for it: you need to be able to read line by line, and you need to be able to split on the colon or the space character. If you can do that, then it should be easy to know where you are and what do to.
Second, it's also a strict subset of YAML, so a YAML parser should be able to parse it in one operation.
STRUCTURE
It has three sections.
Header
This comes first. It is a set of key-value pairs that identify the format version, creation date, and general ship information.
Generally, this section begins with a line containing only three dashes. This can be omitted; if it's present, then everything in front of it should be considered free text and skipped.
Component Array
This section begins with a line containing only "Components:". It is followed by a list of components with the following format:
Each component line begins with a space, then a dash, then another space.
Each component then follows with a set of six space-delimited configuration strings, then a descriptive text label of arbitrary length.
The configuration strings are required, even if they're just a dash, because that makes them easy to split up.
The six configuration strings are interpreted as follows:
- A 3-character operational identifier indicating what class of component this is. More on this later.
- The code (or value) of the component itself.
- The quantity of this component.
- QREBS for the component. All zeros is default.
- The tonnage of the component.
- The decimal cost, in MCr, of the component.
Footer
This optional section has a single line, starting with "ref: " and ending with a reference label. It may be a URL.
EXAMPLE
Here's a worked example using the Judges Guild subsidized liner.
Code:
---
ACS1.0: Wed Apr 13 17:18:53 2022
Mission: Subsidized Liner
QSP: MK-FB13
TL: 12
Name: Glimmerdrift
Tons: 600
Actual Tons: 600
MCr: 144.9
Builder: Ling Standard
Owner: Judges Guild
Disposition: In Service
Allegiance: ImJG
Crew comfort: 0
Passenger demand: 0
Cargo: 124
FuelPercentage: 12
Components:
# CODE R # QREBS TONS MCR LABEL
- HH0 B 1 00000 600 18 Braced Hull
- HL1 n/ 1 00000 -3 0 No Landers
- AA1 12 1 00000 0 0 AV=12. 1 Kinetic Plate
- DF0 - 1 00000 180 0 Jump Fuel (3 parsecs)
- DF0 - 1 00000 24.3 0 Plant Fuel (1.5 months)
- DJ2 J 1 00000 50 50 Jump Drive-3 (J)
- DM1 C 1 00000 5 10 Maneuver Drive-1 (C)
- DP1 1 1 93CC2 28 28 Imp PowerPlant J (R3)
- OC1 3 1 00000 3 10.5 Computer Model/3 std
- OL0 L 1 00000 2 2 Life Support Long Term
- OL0 X 1 00000 1 1 Life Support Luxury
- OB0 - 1 00000 6 0.6 Standard Bridge
- SS1 1 1 00000 2 2.5 LR Ant Communicator
- SS1 4 1 00000 6 4 LR Ext Radar
- SS1 1 1 00000 2 2.5 LR Ant Scope
- WW1 -2 3 00000 1 0.2 AR T1 Empty
- CS0 1 9 00000 2 0.1 Crew Stateroom
- CC0 - 1 00000 18 0 Crew Lounge
- CF0 2 1 00000 1 1 Crew Common Fresher
- PL0 - 80 00000 0.5 0.1 Low Berth
- PC0 - 1 00000 124 0 Cargo Hold Basic
- PO1 - 1 00000 2 0 Cargo Lock
- PO1 - 2 00000 0.5 0.1 Air Lock
- PS0 1 21 00000 2 0.1 Standard Stateroom
- PC0 - 1 00000 42 0 Passenger Lounge
- PF0 2 3 00000 1 1 Common Fresher
ref: [<a href='http://www.farfuture.net/'>Far Future Enterprises</a>]
Attachments
Last edited: