KSP Rocket Kalculator for Realism Overhaul

A pair of unofficial calculators for building rockets in Kerbal Space Program.

KSP Rocket Kalculator for Realism Overhaul

Origins

This project began as a class assignment for an Object‑Oriented Programming Design course at LSU. The initial goal was simple: generate a list of parts that could build a rocket with a target Δv. Since we were considering turning it into a game mod, the first version was written in C#.

The original algorithm used a brute‑force approach: given a target Δv, payload mass, and minimum thrust‑to‑weight ratio (TWR), it iteratively increased the rocket’s size until the requirements were met. This worked well enough for the base game, where many community tools already provided destination‑specific Δv requirements.

Rust Revisit

When KSP 2 entered early access, I revisited the project in Rust as a way to modernize the toolchain and explore performance improvements. Later, as I began playing with the Realism Overhaul (RO) mod suite, I revisited the project again to support more realistic physics and early‑career gameplay constraints.

Realism Overhaul (RO) Refactor

For an Independent Research course at LSU, I redesigned the calculator to support RO’s continuous tank sizing and more detailed engine and fuel models.

The original brute-force method became impractical under RO because:

1) Each tank can go from 0.001m in height up to 50.000m in height, creating an enormous search space.

2) RO exposes exact tank dimensions, fuel mixtures, and structural densities, enabling precise modeling.

Performance Gains

To address this, I replaced the brute-force inner loop with an analytical approach. Instead of iterating over thousands of possible tank heights, the calculator directly solves for the exact tank height required to achieve a target Δv or TWR. This removes an entire dimension of the search space, reducing the complexity from roughly O(abcde) to O(abcd), a potential speedup of up to 50,000x.

To support this, I extracted fuel densities, structural densities, and burn rates from the game's UI and MechJeb readouts, then built helper functions to compute tank mass and propellant mass for each fuselage type. With these values, I derived a closed-form equation for the required tank height using the Tsiolkovsky rocket equation and RO's mass models.

My first derivation had an error, but analyzing the output helped me identify and correct it. The corrected equation now provides accurate tank dimensions across all supported engines and fuselage types.

Limitations

The current version of the calculator focuses on kerosene-based and methalox engines. Hydrolox engines are not yet supported because of their lower structural mass requirements. Supporting these engines would require a new approach to handle the tank and fuselage densities for engines that use hydrolox fuel while maintaining the current functionality for all the existing engines.

Additionally, engine-specific propellant flow rates and burn times are not accurately exposed in neither the in-game tooltips nor the RO configuration files. To ensure accurate Δv and TWR calculations, these values were manually calculated and hard-coded based on in-game behavior and MechJeb readouts. A future version may incorporate automated data extraction or a community-maintained engine database to remove this manual step.