Structure
First off, a starship record has two main parts, a header and a component list. The header has roll-up summary information about the ship. Most of them are:
Each component contains at least the following data:
A component may also contain:
Formats
I permit loading and saving ships in three formats: XML, JSON, and YAML.
Since the header is essentially a hashmap, I use attributes heavily for XML. As a result, the XML header looks more or less like a wrapped JSON element:
...while components look like this:
Compare the above with the JSON snippets:
and
Finally, the YAML. No surprises here either.
and
First off, a starship record has two main parts, a header and a component list. The header has roll-up summary information about the ship. Most of them are:
- hull volume
- hull config
- overall TL
- tons free
- name
- mission
- disposition
- owner's name
- architect's name
- builder's name
- keel laid down date
- first flight date
- total cost
- total crew
- total passengers
- high passengers
- medium passengers
- low passengers
- the number of troop squads
- the jump fuel percentage per parsec
- the power plant fuel percentage per month
- the number of crew shifts
- control stations for: pilots, astrogators, engineers, stewards, gunners, medics, etc.
Each component contains at least the following data:
- a short label
- a descriptive notes field
- a cost
- a volume
- a 'type' (a grouping type, i.e. 'Weapons')
A component may also contain:
- an efficiency rating
- a control rating
- a 'category' (a potentially unique string for searches, i.e. 'bridge')
- various quality ratings
- TL
- a base TL (if the actual is altered)
- a task modifier
- a target number for use in tasks
- a mount type and range, for defenses and sensors
- the "original record" in case the component has been modified
Formats
I permit loading and saving ships in three formats: XML, JSON, and YAML.
Since the header is essentially a hashmap, I use attributes heavily for XML. As a result, the XML header looks more or less like a wrapped JSON element:
XML said:<header numShifts="1" gunner="1" jumpFuelPercentage="0.11111111111111112" totalMcr="14" format="1.0" troop="0" totalCrew="5" tons="200" medic="0" disposition="In Service" tonsFree="0.5" totalMCr="48" passengers="10" config="S" steward="1" builder="Clan Severn" shifts="1" tl="11" pilot="1" staff="0" owner="A. L. Jamison" low="10" mult="1" crew="5" sensop="0" astrogator="1" powerFuelPercentage="0.011111111111111112" medium="2" mission="A" jf="1" shipname="Beowulf" pf="1" qsp="acs-A-211-Beowulf" high="8" demand="-1" crewComfort="-2" troops="0" driver="0" crewLocked="yes" engineer="1" spaciousness="2" freightmaster="0" ></header>
...while components look like this:
XML said:<components name="bridge" mcr="0" type="Ops" eff="1" tons="10" label="Spacious Bridge" category="bridge" ></components>
Compare the above with the JSON snippets:
JSON said:"header":{"numShifts":1,"gunner":1,"jumpFuelPercentage":0.11111111111111112,"totalMcr":14,"format":"1.0","troop":0,"totalCrew":5,"tons":200,"medic":0,"disposition":"In Service","tonsFree":0.5,"totalMCr":48,"name":"","passengers":10,"config":"S","steward":1,"url":"","builder":"Clan Severn","shifts":1,"tl":11,"pilot":1,"staff":0,"owner":"A. L. Jamison","low":10,"mult":1,"keel":"","flight":"","architect":"","crew":5,"sensop":0,"astrogator":1,"powerFuelPercentage":0.011111111111111112,"medium":2,"mission":"A","jf":1,"id":"","shipname":"Beowulf","pf":1,"qsp":"acs-A-211-Beowulf","high":8,"demand":-1,"crewComfort":-2,"troops":0,"driver":0,"crewLocked":"yes","engineer":1,"spaciousness":2,"freightmaster":0}
and
JSON said:{"name":"bridge","mcr":0,"notes":"","type":"Ops","eff":1,"tons":10,"label":"Spacious Bridge","category":"bridge"}
Finally, the YAML. No surprises here either.
Code:
header:
numShifts: 1
gunner: 1
jumpFuelPercentage: 0.11111111111111112
totalMcr: 14
format: '1.0'
totalCrew: 5
tons: 200
medic: 0
disposition: 'In Service'
tonsFree: 0.5
totalMCr: 48
passengers: 10
config: 'S'
steward: 1
builder: 'Clan Severn'
shifts: 1
tl: 11
pilot: 1
staff: 0
owner: 'A. L. Jamison'
low: 10
mult: 1
keel: ''
flight: ''
architect: ''
crew: 5
sensop: 0
astrogator: 1
powerFuelPercentage: 0.011111111111111112
medium: 2
mission: 'A'
id: ''
shipname: 'Beowulf'
qsp: 'acs-A-211-Beowulf'
high: 8
demand: -1
crewComfort: -2
troops: 0
driver: 0
crewLocked: 'yes'
engineer: 1
spaciousness: 2
freightmaster: 0
and
Code:
-
name: 'bridge'
mcr: 0
notes: ''
type: 'Ops'
eff: 1
tons: 10
label: 'Spacious Bridge'
category: 'bridge'