Spaceship component stats

dom111

Chieftain
Joined
Jan 23, 2016
Messages
51
Hey all, not sure if this is of any value to anyone (or if it's been posted before, but I couldn't find it if that's the case!), but I've been looking into the various values associated with the spaceship components and thought I'd share. Also, if any of this is incorrect, please let me know!

Mass

SS Structural100
SS Fuel400
SS Propulsion400
SS Habitation1600
SS Life Support1600
SS Solar Panel400

This isn't technically correct as there are also 500 extra tons added to the overall weight over the first four and one further SS Structural pieces (I haven't yet ascertained if this is SS Structural pieces in specific locations or after a certain number are in situ...)

Flight Time

This looks to be a calculation of Mass / Propulsion.
Propulsion (p)Mass (m)Flight Time
020010
07100355
1340015.4
1380017.2
1750034
2440010.4
2600014.2
2680016.1
2690016.4
2790018.8
3830013.3
4870010.6
591008.8
695007.7
799006.9
8103006.3
8135008.3
8139008.5
8155009.5
81710010.5
81750010.8
81910011.7
82070012.7
82110013
82270014
82430015
82470015.2

Currently the following appears to fit the values:

(m / 20) / (1 + (p * 10))

Chance of success

I currently assume this is the product of something like
Code:
energy provided (ep) / energy required (er) * life support provided (lp) / life support required (lr)
but I think there's a bit more to it.

I've got a basic version in the works, but if this is something anyone knows, I'd love to hear about it. I wonder if I need to look into the debugging tutorials elsewhere in the forum...
 
I've been digging into the spaceship recently. Some of the things I've learned:

Mass
The table for mass is correct, and you are correct that 5 of the structural pieces are assigned extra mass. This is because of the way the ship is defined internally. The spaceship is laid out on a 15x12 grid, and the ship has a blueprint which describes both the placement of each part and the order in which parts are placed. The OpenCiv1 source has the blueprint in source form. The format is a list of (x, y, part type). The x and y represent the column and row of the top-left corner of each part. Types 0/1/2 represent the 3 forms of structural part. The first part in the list is a structural element at 11,5. Next is a structural part at 11,4, and then a third one at 11,6. And so on. In the blueprint, 5 of the structural elements are represented twice. These parts are double-counted when calculating the weight of the ship. It's not clear to me why this was done; maybe the extra weight is for the cockpit, which is otherwise weightless. 🤷

Flight Time
The flight time is a function of mass, propulsion, and fuel:
(m / 20) / (1 + median(0, 10 * propulsion, 10 * fuel))

For example a ship of 13,000 tons with 2 propulsion and 5 fuel will take 30.9 years:
(13,000 / 20) / (1 + median(0, 20, 50)) = 650 / (1 + 20) = 30.9.

When the computer does division it throws away the remainder, so internally the # of years is actually stored as tenths of years. For example 30.9 years is stored internally as 309. Internally the mass is stored as 100s of tons, so the actual calculation performed is (m * 50) / (1 + median(0, 10 * propulsion, 10 * fuel)).

Probability of Success
The probability of success is a multi-step calculation that includes a penalty for flight times > 15 years:
  1. Calculate % life support * % energy as the base success percentage
  2. Subtract 1% for each year of flight time >15 years
  3. Clamp the result to the range (1,100)
The system throws away fractions in its intermediate calculations. For example if life support is 50% and energy is 66%, the intermediate value is 33% instead of 33.33%. Intermediate values are also clamped to the range (0,100). For example if a ship has 200% life support, this value is clamped to 100% before being multiplied by energy.

Some examples:
A ship with 12 structural, 2 propulsion, 2 fuel, 2 hab, 1 life support, and 1 solar panel weighs 8500 tons
  • Flight time is 20.2 years (represented internally as 202): (8500 / 20) / (1 + median(0, 20, 20)) = 20.2
  • Life support = 50%
  • Energy = 66%
  • Base probability of success is 50% * 66% = 33%
  • Flight time is 20.2 years, so there is a 5 year penalty. Internally this is calculated as (202 - 150) / 10 = 5
  • The final probability of success is 33% - 5% = 28%
A ship with 24 structural, 7 propulsion, 8 fuel, 1 hab, 2 life support, and 1 solar panel weighs 14,100 tons
  • Flight time is 9.9 years (represented internally as 99): (14100 / 20) / (1 + median(0, 70, 80)) = 9.9
  • Life support = 200%
  • Energy = 66%
  • Base probability of success is 100% * 66% = 66%
  • Flight time is 9.9 years, so there is no penalty.
  • The final probability of success is 66%
Here's a Google Sheet that implements these calculations.

This info was derived from examining a disassembled version of the Mac binary, but I believe the formulas apply to all versions.
 
Last edited:
I say 'famous', I just mean it's been on the civfanatics 'cheats' page forever


If you build a spaceship with one habitation unit and one engine, and launch it with 0% chance of success, it still succeeds.
 
Back
Top Bottom