Thrusters are the primary source of propulsion for starship cruising.
| |||||||||||||||||||
Description | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Afterburners provide plenty of acceleration and speed in a small package but are less efficient than other thrusters. |
| |||||||||||||||
Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Ion thrusters accelerate very slowly but can be used to achieve high top speeds. |
| |||||||||||||||
Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Plasma thrusters have a lower top speed but provides efficient acceleration. |
The following code is extracted directly from ActiveStarship.kt
in the GitHub repository.
A spreadsheet using these calculations can be found here. You can copy it to calculate your own starship's speed.
These values are constants used in the thrust calculation. this.mass
is the starship's mass; though the summation of the starship's mass may be extracted by executing the /starshipinfo
command, as given by mass.kt
the EnumMap private val massMap
applies a constant to the blast resistance of every pilotable block within the detected ship to output the total mass. Therefore, with exceptions to shulker boxes at 1000.0
mass, carbyne (concrete) at 1.0
mass, and anvils at 6000.0
mass, val BLAST_RESIST_MASS_MULTIPLIER = 5.0
is multiplied to the blast resistance of the object to obtain the final value; if the mass of a block falls below 1.0 mass, it is made equal to 1.0 mass as given from max(it.blastResistance * BLAST_RESIST_MASS_MULTIPLIER, 1.0)
.
val baseSpeedFactor = 50.0
val speedExponent = 0.5
val massExponent = 0.2
val reductionBase = 0.85
val finalSpeedFactor = 1.0
val mass = this.mass
The initial acceleration and speed values are calculated by summing the acceleration, speed, and weight values for all thrusters in each direction. it.type.#
refers to the thrusters' accel
, speed
, or weight
listed in the properties above.
val totalAccel = 1.0 + faceThrusters.sumOf { it.type.accel }
val totalWeight = faceThrusters.sumOf { it.type.weight }.toDouble()
val reduction = reductionBase.pow(sqrt(totalWeight))
val totalSpeed = faceThrusters.sumOf { it.type.speed } * reduction
The final acceleration and speed is then calculated based on modifiers such as the constant modifiers from above and the ship's reactor output (seen in /starship
and based off of block count). The final values are then sent and used by the active starship.
val calculatedSpeed = totalSpeed.pow(speedExponent) / mass.pow(massExponent) * baseSpeedFactor
val maxSpeed = reactor.output * .4 / totalSpeed
val speed = (min(maxSpeed, calculatedSpeed) * finalSpeedFactor).roundToInt()
val acceleration = ln(2.0 + totalAccel) * ln(2.0 + totalWeight) / ln(mass.squared()) * reduction * 30.0
return ThrustData(acceleration, speed)
This speed is then halved, giving you your final cruise speed - the one that appears when you type '/cruise'
The reactor output equation is specified below.
reactor.output = Math.cbrt(starship.initialBlockCount.coerceAtLeast(500).toDouble()) * 3000.0 * (starship.type.poweroverrider)
'poweroverrider' is 0 for speeders and platforms, 0.7 for freighters, and 1 for warships.