Skip to content

Comments

Complete engine config select UI revamp#355

Open
jackwrichards wants to merge 12 commits intoKSP-RO:masterfrom
jackwrichards:master
Open

Complete engine config select UI revamp#355
jackwrichards wants to merge 12 commits intoKSP-RO:masterfrom
jackwrichards:master

Conversation

@jackwrichards
Copy link

Engine config UI overhaul

This PR is a full revamp of the engine configuration selector.

Previously this was just a flat list of configs where you had to hover around, eyeball differences, and dig through other menus to understand what you were actually picking. A lot of important data either wasn’t visible or wasn’t even accessible from this screen.

What’s new

Table-based config view

  • Replaced the old list with a proper table so all configs can be compared side by side
  • No more hovering or drilling into sub-menus just to see differences
  • Columns are fully customizable
  • Supports both Compact and Full views
  • Adds several new columns that weren’t previously available from this UI at all

Probability and reliability explained

  • Added a new “Survival Probability vs Burn Time” section at the bottom
  • Shows ignition chance and survival probability over time in a clear graph
  • Makes it obvious what rated vs tested burn time actually means
  • You can see the probability for any burn duration, not just fixed presets

Built-in simulation tools

  • UI now explains how reliability data is gained and how engines can fail
  • Interactive slider lets you simulate any amount of accumulated data
  • Supports engine clusters so you don’t have to do probability math in your head or on paper anymore

Clear risk messaging

  • Shows a big, simple “1 in X rated burns will fail” readout
  • Makes the actual risk explicit instead of something players have to guess at
2026-02-08.23-46-07.mp4
image image image

…nality

- Updated localization string for current engine configuration to be more concise.
- Refactored DrawConfigSelectors method to utilize BuildConfigRows for better structure and clarity in the engine configuration UI.
- Enhanced the configuration row definition structure for better data handling and display.
- Implemented dynamic column width calculation for the configuration table to improve layout adaptability.
- Adjusted GUI styles for the editor panel to enhance visual consistency and usability.
- Implemented GetCurrentFlightData method to retrieve the current flight data for a part.
- Implemented GetMaximumData method to retrieve the maximum data value for a part.
- Added GetDataPercentage method to calculate the percentage of current data relative to maximum data.
- Enhanced reflection logic to safely access TestFlightCore methods.
@periodically-makes-puns

Some other issues, which I think are unrelated to the patch bug?

  • If multiple engines have their UIs open at the same time, z-fighting starts occurring. I don't have a great video of this, but it can be fairly easily reproduced by opening and pinning two different engines, and selecting Show GUI on both of them.
  • The config entry cost appears to consider unlock credit. I personally find it more useful to ignore unlock credit and show the entry cost directly - otherwise it just shows up as Buy (0) for most configs and that's not really useful when picking between engines/configs.

@jackwrichards
Copy link
Author

Some other issues, which I think are unrelated to the patch bug?

  • If multiple engines have their UIs open at the same time, z-fighting starts occurring. I don't have a great video of this, but it can be fairly easily reproduced by opening and pinning two different engines, and selecting Show GUI on both of them.
  • The config entry cost appears to consider unlock credit. I personally find it more useful to ignore unlock credit and show the entry cost directly - otherwise it just shows up as Buy (0) for most configs and that's not really useful when picking between engines/configs.

The first issue, I will look into, I will probably end up making it so only one may be open at a time.
As for the second issue, I agrtee with you, but I have been getting mixed feedback on that.

…Slider Controls

- Set default view to compact mode in EngineConfigGUI.
- Introduced slider for burn time with input field and include ignition toggle.
- Updated survival probability calculations based on slider time in EngineConfigGUI.
- Modified reliability section to display survival probabilities for starting, current, and max data units.
- Improved layout and styling for survival probability display in EngineConfigInfoPanel.
- Refactored simulation controls to include new slider and checkbox for ignition.
- Removed redundant failure rate summary section from EngineConfigInfoPanel.
@jackwrichards
Copy link
Author

image Latest look of the UI

/// </summary>
public static class EngineConfigPropellants
{
private static readonly FieldInfo MRCSConsumedResources = typeof(ModuleRCS).GetField("consumedResources", BindingFlags.NonPublic | BindingFlags.Instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why reflection when GetConsumedResources() exists?

public static bool userClosedWindow = false;

// Track the currently open GUI to ensure only one is visible at a time
private static ModuleEngineConfigsBase currentlyOpenGUI = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should get unassigned on leaving editor scene to prevent a :smol: leak

Comment on lines +453 to +471
string[] headers = {
"Name", Localizer.GetStringByTag("#RF_EngineRF_Thrust"), "Min%",
Localizer.GetStringByTag("#RF_Engine_Isp"), Localizer.GetStringByTag("#RF_Engine_Enginemass"),
Localizer.GetStringByTag("#RF_Engine_TLTInfo_Gimbal"), Localizer.GetStringByTag("#RF_EngineRF_Ignitions"),
Localizer.GetStringByTag("#RF_Engine_ullage"), Localizer.GetStringByTag("#RF_Engine_pressureFed"),
"Rated (s)", "Tested (s)", "Ign Reliability", "Burn No Data", "Burn Max Data",
"Survival @ Time",
Localizer.GetStringByTag("#RF_Engine_Requires"), "Extra Cost", ""
};
string[] tooltips = {
"Configuration name", "Rated thrust", "Minimum throttle",
"Sea level and vacuum Isp", "Engine mass", "Gimbal range", "Ignitions",
"Ullage requirement", "Pressure-fed", "Rated burn time",
"Tested burn time (real-world test duration)",
"Ignition reliability (starting / max data)",
"Cycle reliability at 0 data", "Cycle reliability at max data",
"Survival probability at slider time (starting / max data)",
"Required technology", "Extra cost for this config", "Switch and purchase actions"
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should move all the rest to loc file too. Weird if some are there and others aren't.

int visibleRows = Mathf.Min(actualRows, ConfigMaxVisibleRows);
int scrollViewHeight = visibleRows * ConfigRowHeight;

var scrollStyle = new GUIStyle(GUI.skin.scrollView) { padding = new RectOffset(0, 0, 0, 0) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwise to allocate new styles twice per frame.

Comment on lines +1074 to +1096
internal string GetTechString(ConfigNode node)
{
if (!node.HasValue("techRequired"))
return "-";

string tech = node.GetValue("techRequired");
if (ModuleEngineConfigsBase.techNameToTitle.TryGetValue(tech, out string title))
tech = title;

var words = tech.Split(' ');
if (words.Length <= 1)
return tech;

var abbreviated = words[0];
for (int i = 1; i < words.Length; i++)
{
if (words[i].Length > 4)
abbreviated += "-" + words[i].Substring(0, 4);
else
abbreviated += "-" + words[i];
}
return abbreviated;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind about allocating gui styles. This is a lot worse!
I wonder if we could show only the year number here. Or perhaps just make the text smaller? Make it wrap?


#endregion

#region RP-1 Credit Integration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should extract such integrations into a separate file.

Comment on lines +242 to +244
string[] failureTypes = { "Shutdown", "Perf. Loss", "Reduced Thrust", "Explode" };
int[] failureDu = { 1000, 800, 700, 1000 };
float[] failurePercents = { 55.2f, 27.6f, 13.8f, 3.4f };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not the best to hardcode all the TF values. Some of those might be subject to change.

@periodically-makes-puns

The configuration menu sometimes doesn't show up when selecting parts with symmetry. It's a bit weird to reproduce but you should run into it fairly quickly if you try reconfiguring a set of RCS thrusters and a cluster of engines a bunch. I suspect it has something to do with how the Hide GUI toggle is handled across symmetric parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants