Skip to content

Conversation

@ender-titan1
Copy link
Member

@ender-titan1 ender-titan1 commented Sep 2, 2025

Brief Description of What This PR Does

This PR reworks the environmental tolerances tab to be more player friendly and intuitive.

For this PR to be feature complete, the following tasks have to be finished:

  • New tolerances UI
  • Switch to preferred/tolerance system for pressure
  • Make tooltips work (new ones if necessary)
  • More obvious warning text (panel?)
  • Change tutorial text
  • Make sure MP costs work as intended
  • Make sure auto-evo's MP cost matches the player's
  • Code style and structure conforms to the styleguide and programming conventions

Additionally, the following tasks have been completed in the process of developing this:

  • Fix a bug that prevented auto-evo from making any changes to environmental tolerances
  • Add environmental tolerances to the auto-evo tool's CSV export
  • Add health icon to BBCode icons

Related Issues

N/A

Progress Checklist

Note: before starting this checklist the PR should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR)
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.

@ender-titan1 ender-titan1 changed the title Update the environmental tolerances tab with new visuals Add new visuals and fixes to environmental tolerances Sep 15, 2025
@ender-titan1
Copy link
Member Author

This PR is now feature complete and ready for testing and review.

@ender-titan1 ender-titan1 marked this pull request as ready for review September 17, 2025 19:16
@ender-titan1 ender-titan1 requested review from a team September 17, 2025 19:16
@ender-titan1 ender-titan1 added this to the Release 0.8.4 milestone Sep 17, 2025

/// <summary>
/// How wide a temperature range this species can stay in effectively. The range of temperatures is
/// <c>PreferredTemperature - TemperatureTolerance</c> to <c>PreferredTemperature + TemperatureTolerance</c>
Copy link
Contributor

Choose a reason for hiding this comment

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

Now it is only PreferredTemperature + TemperatureTolerance, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Temperature has not been changed, it is still Preferred +/- Tolerance, this is indicated in the UI by the line connecting the range to the grabber being drawn from the center of the range as opposed to pressure where it is drawn from the minimum.

@Patryk26g
Copy link
Contributor

I have tested the functionality and did a code review, for me it looks fine :)

edge-case with the way the pressure tolerance was saved.
Copy link
Member

@hhyyrylainen hhyyrylainen left a comment

Choose a reason for hiding this comment

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

It took a while, but this should be a full review of all the code here. I didn't see any major architecture problems, but I did spot quite many potential code cleanup and code uniformity with other Thrive code changes that could be done. I didn't playtest yet, but I think the latest screenshot that was shown looked good of the result of this PR.

public float OxygenResistance;

public EnvironmentalTolerances()
: this(0, 0, 0, 0, 0, 0)
Copy link
Member

Choose a reason for hiding this comment

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

Why are the default tolerances now basically unusable values?

Copy link
Member Author

Choose a reason for hiding this comment

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

I might have missed something, but I don't think there was any point having default values here in the first place, as any time this constructor is used, it's followed by CopyFrom.

The only case where that doesn't happen is in the unit tests, but in my opinion it would make more sense to assign test values there then have a bunch of default values in the class that almost always get immediately overwritten.

Copy link
Member

Choose a reason for hiding this comment

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

Well, even if it is not currently used, I think it's still a useful thing to have. I know this is kind of a struct, but in OOP one key concept is that the constructor makes classes valid to use, so it should ensure that all values have sensible data in them after construction. So even if not currently used, I think the default values were useful at least in illustrating what kind of data the class might hold for future readers of the code.

/// Temperature (in C) that this species likes to be in
/// </summary>
public float PreferredTemperature = 15;
public float PreferredTemperature;
Copy link
Member

Choose a reason for hiding this comment

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

So why was this default value removed?


// Show in red the conditions that are not matching to make them easier to notice
if (Math.Abs(patchTemperature - preferredTemperatureWithOrganelles) >
if (Math.Abs(patchTemperature - CurrentTolerances.PreferredTemperature) >
Copy link
Member

Choose a reason for hiding this comment

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

So now only conditions that are without modifiers bad are shown?

Wouldn't this make the GUI less helpful? Or does something compensate to show this? I haven't playtested yet so it might be the case that like the other modifier place turns red in this case and that helps?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is because PreferredTemperature isn't actually affected by any modifiers, just the temperature range is, so there is no point in calculating preferredTemperatureWithOrganelles.

Copy link
Member

Choose a reason for hiding this comment

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

I'm going to ask that you make it so. We should account for future flexibility if some organelle, for example, in the future wants to reduce the temperature a cell can be in.

I just think that cutting out a part of the feature is going to make a potential future change so much harder, that we ought to do things fully now to support whatever tweaks someone doing balance changes might want to make.

@revolutionary-bot
Copy link

We are currently in feature freeze until the next release.
If your PR is not just a simple fix, then it may take until the release to get reviewed and merged.

#endif

var change = Math.Max(score.PerfectOxygenAdjustment, maxChange);
var change = Math.Max(score.PressureRangeSizeAdjustment, maxChange);
Copy link
Member

Choose a reason for hiding this comment

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

I'm preparing a separate PR to get this quite important auto-evo fix in, and I noticed that even this fix still seems to have a typo, because this is used to modify temperature but the variable here refers to pressure range.

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

Labels

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

6 participants