Skip to content

Fix Brain Math #20711

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

VMSolidus
Copy link
Contributor

This PR fixes an issue where characters were experiencing brain damage at rates that were sometimes inconsistent depending on player population and server performance. To accomplish this, it makes it so that brain damage taken is no longer a random amount per second that fluctuates based on server performance, and is instead an amount of damage per second that scales with the previous conditions, but is "tick invariant", meaning it no longer changes if for instance you have 75 players online causing server lag.

The benefit of this is particularly noticeable in the extreme ends of lowpop as well as high pop. It'll no longer cause brain-damage at hyperspeed if theres' only 10 people online.

@VMSolidus
Copy link
Contributor Author

!review

Comment on lines +30 to +62
//brain damage speed modifiers. All except safe include modifiers for "Stabilized with Inaprovaline" vs Not Stabilized.
//damage per second is this value times deltaTime, such that no matter frametime, this will be your baseline damage.
//it's also directly 1:1 with your brain's numerical healthbar. If your brain has 200hp, consider that it has "200 seconds" of budget.

//think of it like, "If a perfectly healthy crewman suddenly has a heart attack that cuts off 100% of blood flow to the brain", that crewman
//will lose 2s of his 200s budget, every second. Keeping this in mind, it might come up in testing that we'll want to look at tweaking these numbers for some
//desired time budget that feels right. Setting the BDPS to 0.5 will turn the 200s budget into 400s. While setting it to 2 will make it a 100s budget.
var/brain_damage_per_second = 1

//85% blood volume and up
//this one is actually used for the passive healing rate mainly.
var/safe_damage_modifier = 1

//70% to 85%
var/okay_damage_modifier = 1
var/okay_stabilized_mod = 0.3
var/okay_unstable_mod = 0.6

//60% to 70%
var/bad_damage_modifier = 1
var/bad_stabilized_mod = 0.4
var/bad_unstable_mod = 0.8

//30% to 60%
var/crit_damage_modifier = 1
var/crit_stabilized_mod = 0.6
var/crit_unstable_mod = 1

//0% to 30%
var/dying_damage_modifier = 2
var/dying_stabilized_mod = 0.8
var/dying_unstable_mod = 1

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm leaving this for someone better versed in medical code to review proper, but I'd suggest turning these comments to DMDocs. The documentation section in STYLE.md may be a useful reference.

@NonQueueingMatt NonQueueingMatt added the Changes Required The PR requires changes before it can be approved and/or merged. label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes Required The PR requires changes before it can be approved and/or merged. Review Required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants