Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the way tanks explode to be more intuitive #17809

Merged
merged 33 commits into from Jan 31, 2024

Conversation

MeggalBozale
Copy link
Contributor

About the PR

This change is part of a larger rework focused at making the Toxins department more accessible, more challenging at higher levels, and about adding more interesting and fun mechanics in Toxins for scientists to play with. For more information, see:
Player Projects - Tank Explosion Rework
HackMD Document - Tank Explosion Rework

The current handling of tank explosions is closer to being an ancient bug than a feature -- allow me to explain as I have in the HackMD:
A tank will immediately explode as soon as it surpasses a certain pressure, ~5066.25kPa.
When a tank explodes, it calls react() 3 more times to build up pressure, simulating the uncontrolled reaction of a real explosion.
The final explosion power is determined by the final pressure.

This gives rise to an issue where tanks which approach this threshold from either end will have drastically different explosion ranges. For example, consider a TTV with two tanks. The first tank is full of oxygen (1013.25 kPa) which is at a temperature of 200 degrees Kelvin. The second tank is full of plasma (1013.25 kPa) at a temperature of 599 degrees Kelvin. As it reacts, it eventually reaches a pressure of ~5060 kPa. It reacts again, surpassing the treshold, and then 3 more times. By reaching a pressure just below the explosion treshold of the container, it 'sneaks in an extra react'.

Consider the same TTV, but with the tank of plasma at 600 degrees Kelvin. As it reacts, it eventually reaches a pressure of ~5067 kPa. It reacts only 3 more times, and explodes. Comparatively, these near-identical mixes have drastically different explosion powers, because one tank is given the opportunity to build pressure an additional time.

To fix this, reactions are given a multiplier variable, which may be used to react a fractional amount of times. This is done by assuming reactions are linear (they mostly are, with minor exceptions) and providing a multiplier which acts as if such is true. It is determined on explosion of a tank as to when it exceeded the tank's maximum pressure, and the total amount of additional reacts before exploding is adjusted appropriately. This results in a more reasonable trend of explosion ranges, which is less likely to confuse players.

To show this graphically, here is the current range of explosion values. Blue is the least explosive (~0), while red is the most explosive (~12, 'maxcap'):
temperatures

And here is the same graph after the change:
temperatures

Note that after this change, tanks get four additional reacts, not 3 -- this is to keep roughly the same range of mixes possible, as this change is not intended to affect balance significantly.

Why's this needed?

It is important that game systems behave as expected, and I would argue the current explosion behavior of tanks does not act in an intuitive manner. It forces code-diving to understand the pattern, and is likely unpleasant for new scientists to work with.
It should also be noted that this only could change how difficult it is to 'discover' a mix that creates a maximum range explosion for a TTV, experienced players have no problem memorizing and sticking to a mix of temperatures which will reliably produce that large explosion.

Lastly, this helps with the newly(?) added bazaar, which demands precise explosion values for maximum profit. With the current lack of predictability, it becomes hard for players without direct access to every possible value beforehand to make use of this mechanic, due to the sudden changes in explosion range and odd trends.

Changelog

(u)MeggalBozale
(*)Tanks will now explode in a more predictable manner. For an in-depth explanation, see the PR.

@boring-cyborg boring-cyborg bot added the C-Sprites Automatically applied on any .dmi or icons folder change label Jan 29, 2024
@github-actions github-actions bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 29, 2024
@MeggalBozale
Copy link
Contributor Author

made some oopsies still, hold on

@MeggalBozale MeggalBozale added C-QoL A quality of life improvement that makes the game easier to play C-Rework Reworks a feature A-Atmospherics Attempts to touch the atmos system, help us all ☠ A-Science Deals with Artifacts, Telescience, or the department and removed C-Sprites Automatically applied on any .dmi or icons folder change labels Jan 29, 2024
@MeggalBozale
Copy link
Contributor Author

Okay it's ready, sorry for the extensive unrelated commits it was a part of another branch that I cleaned up to include only this change. Gonna see about cleaning that up for future PRs related to this

@github-actions github-actions bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 29, 2024
@ZeWaka
Copy link
Member

ZeWaka commented Jan 30, 2024

yes

Copy link
Contributor

@TobleroneSwordfish TobleroneSwordfish left a comment

Choose a reason for hiding this comment

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

This looks great, the only thing I will say is that it seems like it's widening the maxcap range a bit in addition to making it more consistent. Possibly worth a numbers tweak to make it a little harder?

@TDHooligan
Copy link
Contributor

could always set the extra reacts from 4 to 3.5 to get the average of the old math

@MeggalBozale
Copy link
Contributor Author

Easily can set to 3.5, yes. Will post with updated graph when done

@github-actions github-actions bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 30, 2024
@MeggalBozale
Copy link
Contributor Author

temperatures
New temps

@MeggalBozale
Copy link
Contributor Author

Changing scaling is simple enough so LMK if thats too small, new graph is 3.5 reacts minimum rather than 4

@TDHooligan
Copy link
Contributor

thats probably ok. could maybe be a little bigger but its not my decision 🐸

@MeggalBozale
Copy link
Contributor Author

I think it's a good trade-off for being more predictable. Having the same range of oxygen values would be the four reacts in the original PR. I'll check out 0.75 in a moment, profiling radgas for now

Copy link
Contributor

@TobleroneSwordfish TobleroneSwordfish left a comment

Choose a reason for hiding this comment

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

Lgtm, can always tweak further if it turns out to be too hard to get maxcaps

@Tarmunora Tarmunora merged commit 09925ec into goonstation:master Jan 31, 2024
23 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 31, 2024
@MeggalBozale MeggalBozale deleted the tankrework-explosionfix branch February 1, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Atmospherics Attempts to touch the atmos system, help us all ☠ A-Science Deals with Artifacts, Telescience, or the department C-QoL A quality of life improvement that makes the game easier to play C-Rework Reworks a feature size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants