• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

Traveller Trader - a simple ship data structure

robject

SOC-14 10K
Admin Award
Marquis
So here I go again.

Hardware: My game runs on a W65C02S at 8 Mhz, with about 39K of main memory, and generous RAM banks. Because.
Software: I'm writing in C using the cc65 cross assembler.

Starships.

I've been iterating over the ship data structure lately. I've moved from structured data, to very painfully bit-packed data.

Now I'm reconsidering a plain array of "ship components".
  • Locating a ship component is easy: an index is a trivial lookup mechanism.
  • Tracking usage is easy: a parallel array to hold current state.
  • Tracking damage is easy: a parallel array to hold damage.

Header.

There's always invariant header data. Things that don't get "damaged" per se. The ship's name, its allegiance / owner, its type code, its volume, and its TL. Cost. Perhaps armor layers. Hull configuration (perhaps).

Components.

This is the array of "things" the ship has, typically with a single value representing a rating.

Battery components are different than the rest, each requiring an emplacement code and a weapon code. That's OK.

Note that I'm not going the High Guard route with weapons.
  1. Maneuver
  2. Jump
  3. Bridge
  4. Computer
  5. Cargo hold %
  6. Fuel tankage %
  7. Passenger staterooms
  8. Low berths
  9. Space sensors
  10. World sensors
  11. Scoops
  12. Collector
  13. Stealth
  14. Nuke damper
  15. Meson screen
  16. Globe
  17. Battery 1
  18. Battery 2
  19. Battery 3
  20. Battery 4
  21. Battery 5
  22. Battery 6
  23. Battery 7
  24. Battery 8
 
Last edited:
  • Cargo hold %
  • Fuel tankage %
Percentages are a bad idea. They only work "nicely" when tonnages are in multiples of 10 or 100. Pick any other tonnages and things can start getting weird/wonky very quickly. There's also the fact that you can wind up with cargo tonnages that don't align perfectly with integer percentages of the hull displacement (61 ton cargo bay on a 200 ton Far Trader, for example).

For fuel, the % is merely a starting point. Some designs are going to want to add extra fuel (often times to round off numbers when dealing with hull displacements that are not divisible by 10 or 100). Having something telling you that X many tons is Y percentage of the hull displacement is useful, but that's only a first order approximation for the minimum fuel necessary since a starship design could add more for extended endurance/range. Also, fuel damage hits are -% or 10 tons, whichever is larger under LBB5.80.

I also don't see an entry for Hull Armor.
Stealth, yes ... armor, no.

No fuel purification plants? (which, I know, are not the subject of damage results under LBB5.80)
No crew, just passengers? No frozen watch? No ship's troops/marines?

Bare minimum, every critical hit result from LBB5.80 ought to have an entry in your list (so it can be damaged/destroyed, somehow).
That implies that you're missing a flight deck/carried craft/vehicles result.
 
The first most important question is: How many starships are you tracking? < 10? <100?

There's nothing wrong with percentages, just round stuff up. Sorry, your 1000 ton hold has to buy things in units of 10 tons.

Everything on that list, save the cargo and fuel %, can be represented at 3 bits or less. Do you really have more than 8 weapons? Do you really NEED more than 8 weapons? Are the 8 weapons really that different from each other in performance? Because they all should have a different game play impact and represent a particular choice. For example, make all the turrets double missile, double beam, double sand -- and that's it.

Or you can use 5 bits: 3 for one of 8 weapon types, 2 for "0-3" "factors" (whatever it is).

If you're not using HG and it's battery factors, then you're pretty much down to individual weapons.

Finally, don't forget you need to track damage against all of those systems, which can effectively double the storage if you're knocking "factors" off of things vs just "hit or not hit".
 
Percentages are a bad idea.

Percentages are fantastic. The loss of granularity is actually very tolerable, and the value fits into one byte along with all the other component values.

I even apply percentage to cost (in MCr), which is somewhat ridiculous except that it works.
 
Do you really have more than 8 weapons? Do you really NEED more than 8 weapons? Are the 8 weapons really that different from each other in performance? Because they all should have a different game play impact and represent a particular choice. For example, make all the turrets double missile, double beam, double sand -- and that's it.
Yeah, this is for ACS up to 2400 tons. This means to a certain degree I'm actually shorting the larger hulls by only allowing 8 "hardpoints". The upside is that if they've installed, say, 8 large bays, then they have that... something even a Mercenary Cruiser cannot match.

Or you can use 5 bits: 3 for one of 8 weapon types, 2 for "0-3" "factors" (whatever it is).
Yep, I'm using 3 bits for the emplacement, and 5 bits (just barely) for the weapon type.

Emplacements: T1, T2, T3, B1, B2, Bay, Large Bay, Main Gun.
Weapons: mining laser, pulse laser, beam laser, plasma gun, fusion gun, salvo rack, missile, KK missile, AM missile, jump damper, tractor/pressor, jump inducer, disruptor, stasis gun, sandcaster, hybrid L-S-M, particle accelerator, and meson gun.

I can drop several weapons and fit the list into 4 bits. If there's a reason to do it. Frankly some of them have little or no differentiation. For example, I may fold the salvo rack and KK missile into the regular missile launcher. I can get rid of the plasma and fusion guns. And so on.

Finally, don't forget you need to track damage against all of those systems, which can effectively double the storage if you're knocking "factors" off of things vs just "hit or not hit".
Yep, easily done when all the components are stored in an array. A parallel array can carry damage "level", which I use as the probability that it will fail to work when used.

That preserves the "original" record, which can be read-only.
 
Last edited:
Lossy Conversion but Plenty of Ships

I have an 8K bank where I can store the ship data, and it won't take up program RAM space.
I run scripts which analyze ACS designs and generate a file containing the 48 byte ship records.
This draft list of 80-something ships fill just over 4K.

Code:
A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
A A-DS12 Eakhau               +2       2    0:0    160    48   9:16    92 
A E-BU72 Stayow               +2       5    6:0      2    34   0:0    122 T3 m B2 pa
A E-HU44 Ekawsykua            +1       5    5:2     24   112   0:0    416 T3 s T3 l T3 m
A G-DL71 Khosaa               +2       5    6:0      0    68   0:0    276 Bay pa Bay sr
A J-BS22 Kteiroa              +2       3    4:5     78    22   0:4     74 
A L-DL14 Hkiyrerao            +0       5    5:8      0    48  10:10   224 
A R-FB22 Khtukhao             +2       3    0:0    138    72  24:1    162 
A S-BL43 Ktiyhui              +2       4    5:0     16    26   0:0    114 T3 m T3 hy
A T-KL33 Aositaoh             +2       5    6:1     80   110   0:0    470 T3 s Bay pa Bay sr T3 l
A V-BS44 Hkauiya              +2       4    5:0     16    28   0:0    104 

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
B R-TB43 Leviathan            +2       4    6:3     54   252   4:4    630 T3 m B2 pa T3 l
D A-BL11 Miymosa              +1       1    0:0     88    22   8:0     60 T1 m
D A-CA22 Loskay               +1       2    3:1     60    36  12:0    102 T2 m T2 pl T2 s
D E-CA62 Escort               +2       4    6:0     18    39   2:0    183 B1 pa T3 m T4 l
D S-AS22 Syunutstryak         +1       1    4:6      6    12   0:0     82 
D T-KU33 Bretremoy            +2       3    0:0      0   130   4:0    330 B1 pa
H F-BU41 YT Packet            +2       4    5:0     50    20   0:0    210 B1 m B1 l
I A-BS11 Maada                +2       1    0:0     60    24   8:4     40 T3 hy
I A-CS11 Lishda               +1       1    0:0     90    36  17:12    63 T3 hy
I U-CA33 Armed Packet         +2       3    0:0      3    36  10:4    114 T1 m

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
I Y-BB11 Yacht                +1       1    1:0     12    22   9:0     72 
J A-BA11 MC&S Alpha           +1       1    0:0     82    22   6:20    44 
J A-DA12 MC&S-Beta            +1       2    0:0    136    48   8:14   100 
J C-HB33 MC&S Gamma           +2       5    6:6     80   104   0:0    304 
J M-FB13 MC&S-Mu              +1       3    3:0    120    72  21:63   144 
J R-DA11 MC&S Rho             +2       1    3:0    200    44   8:9     84 
J S-AA22 MC&S-Sigma           +2       1    4:3      3    12   0:0     46 
J Y-BB11 MC&S-Ypsilon         +1       1    3:0     12    18  10:0     56 
L A-BA22 Avian                +2       2    0:0     68    24   6:2     70 T3 hy
L S-AA22 Serpent              +2       3    5:7      5    12   0:0     60 T3 hy

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
L S-BA22 Wind                 +2       2    0:0      2    24   0:0     68 T3 hy
M E-DU44 Route Protector      +2       4    0:0      8    56   0:0    168 B1 pa T3 m T3 s T3 l
M F-ZC14 Risek                +2       4    0:0    888   288  16:16   528 T1 m T1 s T1 l
R A-DA11 Grendel              +2       1    0:0     88    44   0:8    108 T3 l T3 s T3 m
R N-DS23 Kurgulash            +1       3    4:3     20    40   0:20   172 T2 s T2 l
S C-FS22 Tulgan               +0       2    6:0      6    72   0:0    168 Bay pa Bay sr T3 l T3 s
S C-VB22 Jarl                 +2       2    5:0     80   240   0:0    460 Bay sr Bay kk Bay m B2 m T3 s T3 m T3 l
S G-EB32 Surtr                +2       2    5:0     15    65   0:0    155 Bay kk B2 m T3 hy
S P-AS42 Derjus               +1       2    4:0      0    14   0:0     54 B1 m
T M-KU14 Tukera RT            +1       4    0:0    130   130  36:14   250 T3 hy

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
U A-BS11 Beowulf              +2       1    0:0     82    22   6:20    40 
U A-BS12 Empress Marava       +1       1    0:0     64    24   7:4     52 
U A-CL22 Fat Cat              +2       1    0:0     99    36   8:0     93 
U A-HS23 Flat Trader          +1       3    6:0    144   104   4:0    312 T3 l T2 s
U C-HU33 Broadsword           +2       5    3:0     80   104   0:0    264 T3 l T3 m T3 m
U E-DU55 Gazelle              +2       6    6:0      0    60   0:0    272 T3 l B2 pa
U E-EA53 Kilaalum             +2       3    6:6      5    65   0:0    305 B1 m B1 l
U F-KS13 Susa                 +1       3    0:0    410   130  12:10   220 
U F-TS13 Dakaar               +1       3    1:0    918   234   0:0    324 T2 m T2 pl T2 s
U G-AL52 Hoshisame            +0       3    5:0      1    13   0:0     83 

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
U G-HB53 Avenger              +2       3    6:0     56   112   0:0    296 T3 s B2 m B2 pa T2 l
U K-BA12 Tarkine Centaur      +2       1    0:2      6    22   0:0     86 T2 l
U L-DC12 Laknir               +1       2    5:4     48    36   0:0    136 
U L-DC22 Lab Ship-TL16        +2       4    6:6     48    36  20:0    148 
U M-BS11 Tramp Liner          +1       1    0:0     50    24  20:8     36 
U M-FB13 Enkidu               +2       3    0:0    120    78  21:20   132 
U M-FU13 Liner                +2       2    0:0    120    78  21:20   132 
U M-HS14 Brilliance           +1       3    0:0      0   104  28:0    248 
U N-DU23 Donosev              +2       5    5:9     20    40   0:0    188 
U P-DA42 Kforgzue             +1       2    5:0    128    44   0:12   156 T3 l T3 m

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
U R-DA11 March                +2       1    0:0    200    44   8:9     92 
U R-DA11 Merchant             +1       1    0:0    212    44   8:9     96 
U R-DA11 Sheshar              +2       1    0:0    148    44  20:10   108 
U R-EU12 Maru                 +1       2    0:0    195    60  14:14   110 T1 l
U S-AL22 Murphy               +2       1    3:0      3    12   0:0     52 T2 l
U T-MA50 Orca                 +2       6    4:5    492   156   9:0    516 T3 tp B1 fg
U W-AS21 Shumshuga            +0       1    0:0     20    12   0:0     32 
U X-AB04 Xboat prototype      +0       7    1:0      0    14   0:0    127 
U Y-EU42 Sunflower            +2       3    5:1     20    55   0:0    195 
V G-HS44 Se Koez              +1       5    6:1     24   112   0:0    320 T3 l Bay pa B2 m

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
V J-BC11 Zukseg               +2       1    0:3     64    22   0:0     58 
V M-FU13 Dhaztuen             +2       2    0:0     30    78  24:10   150 T1 l T1 m T1 s
V P-CU42 Fang                 +2       2    7:0     45    42   0:0    126 T2 m T3 l
V P-DA41 Aedokhaz             +1       2    6:2     72    52   0:12   184 T3 m T3 jd T3 l
V P-DA62 Az Alrrak            +2       2    5:1     12    68   0:12   384 T3 l T3 m T3 s
V S-AS42 Kanllaz              +2       4    2:0      0    14   0:0     66 T3 hy
V S-BA33 Tathoe               +2       5    3:0      8    26   0:0    124 T1 l T1 l
X E-HA76 Warlock              +2       6    0:0     24   152   0:0    1016 Bay sr B2 pa B2 m B2 s T4 l
X K-FC03 ANNIC NOVA           +2       3    3:2      0    66   0:0    210 T1 l
Z C-VS42 Vlezhdatl            +2       5    6:0     80   280   0:0    1060 Bay kk B1 l

A QSP    Name               Bridge  Comp  SS:WS  Cargo  Fuel  SR:LB   MCr Weapons
- ------ ------------------ ------  ----  -----  -----  ----  -- --  ---- ------------
Z C-VS44 Council Cruiser      +2       5    6:0     40   240   0:0    940 B2 m B2 pa B1 pa B1 m
Z E-DS64 Zhdits               +2       5    6:0      0    64   0:0    256 T3 l
Z E-FS41 Sesavetl             +2       5    6:0     24    72   0:0    318 Bay m B1 s B1 l B2 pa
Z G-FU21 Shivva               +2       4    6:0      0    78   0:0    318 B1 pa B1 m T4 l T4 s
Z M-HB14 Chtabl               +1       4    0:0     56   104  36:34   224 
Z X-BS24 Qliaf                +1       3    5:0     16    24   5:0     94
 
Last edited:
I'm always juggling the list of ships. I prefer to use commonly-known designs over personalized ones, but I have a bit of everything in there.

Of course I have the standard dozen-odd designs from GDW.
I ported over Aslan, Droyne, Vargr, and Zhodani designs from CT.
I ported in Judges' Guild ("MC&S") and Paranoia Press ships.
The Leviathan is there.

But I also have some custom ships that I thought were fun to have.

The Orca is there.
The Hoshisame is there.
The Shumshuga Barge is there.
The "Fat Cat" and "Flat Trader" are there.
The Maada is there.
Humbolt Systems' Packet is there.

But there's some ships that won't make the cut.

I don't think I'm going to keep the Xboats.
 
Last edited:
Back
Top