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

Blood overhaul #41219

Merged
merged 71 commits into from
Jul 11, 2020
Merged

Blood overhaul #41219

merged 71 commits into from
Jul 11, 2020

Conversation

nexusmrsep
Copy link
Contributor

@nexusmrsep nexusmrsep commented Jun 10, 2020

Summary

SUMMARY: Features "Blood and blood loss overhaul."

Purpose of change

To make a step forward towards completion of "Wounds and healthcare" project.
To make bleeding more in-depth, and more realistic in its effects and mechanics.

Describe the solution

Prepare for a long read, this is a pack of interlocking features, that work as a whole and in context of the whole picture.

TL,DR: Bleeding will now occur more often in combat, but will also feel more natural, as it won't affect HP, instead depleting its own two pools: blood (volume, quantity) and red cells (quality). It is scalable from small scratches to arterial hemorrhages, and can be stopped in various new ways, but also may require recovery from it's effects or even (in future) a transfusion. Prolonged hemorrhage will lead to various effects like hypovolemic shock and/or anemia, and eventually death (but not from HP loss). Blood loss management will be more in-depth part of character's healthcare.

PART ONE - BLOOD POOLS

  • Introduction of blood pool. Blood has its own pool equal to 5 liters (or 50000 units, 1 unit = 0.1 ml of blood).
  • Introduction of red blood cells pool. Equal to 50000 (units not related to any RL conversion factor)
  • Both pools rely on vitamin infrastructure & mechanics, and work as 'counters', so they don't interfere with No Vitamins mod.
  • Both pools are "reversed", so they count loss of blood / red cells, and so are represented as negative values in their respective applications
  • Blood pool rely on volumetric approach, as it measures loss of blood volume (quantity), thus introducing hypovolemic shock, due to resulting loss of blood pressure
  • Red cells pool rely of quality approach, as it measures loss of leading blood element, thus introducing anemia as a consequence
  • Main reason behind separation of pools is their regeneration rate - while blood volume regenerates fast, it is mostly regeneration of plasma and secondary blood elements, while red cells regenerate significantly slower. In game terms blood regen takes ~3,5 days and red blood cells regen takes ~7 days (which is still ludicrously fast in comparison to reality where it would take several weeks, so I must call blob factor on that part for game-play reasons)
  • Introduction of hypovolemia shock - 4 stages according to IRL classifications and symptoms
  • Stage 4 can be fatal with blood loss above 3L and chance of death improving towards loss of 5L when it's certain
  • Introduction of anemia - 3 stages - fatal when red blood cells are less then -49950 units.
  • Anemia was separated into blood loss related anemia and iron deficiency anemia, despite similarities, so that the vitamin mechanic won't try to alternately add/remove effect (two vitamins with one deficiency equals erratic behavior)
    EDIT: Iron-deficiency anemia affects red cells - hinders regen, stops regen and eventually kills red blood cells in final stage.
  • Blood loss related anemia kicks in later then hypovolemic shock, and you can recover from shock (shorter recovery time) and still accumulate enough blood red cells loss to suffer anemia (longer recovery time) - this will play a significant role when transfusion will be introduced

PART TWO - BLEEDING

  • Bleeding no longer depletes limb HP, instead depleting blood & red cells pools, triggering their deficiency effects.
  • Bleeding had been given 40 levels of intensity for scalability (from just a scratch to arterial red fountain)
  • Each level is equal to loosing 1 ml per turn, thus max lvl 40 = 40 ml per turn = 2,4 L / minute (of unrestricted flow)
    EDIT: Rebalanced. In fact this was not true from the beginning since I forgot to mention that there were additional limiters to it. Current rate of blood loss is 0.1 ml per turn per level, thus lvl 40 = 4 ml per turn = 240 ml / minute. To lose 3L of blood (threshold for accounting for death chance) you would need to bleed at max lvl for 12+ minutes (effectively 15+ minutes including natural reduction of bleeding rate and blood regen rate).
  • Bleeding effect has its duration linked with intensity levels, and is solely driven by duration, with 1_minute duration = 1 intensity level. 40_minutes duration = 40 lvl of intensity. This works smoothly in regards to scalability of the whole system, and is intuitive.
  • Bleeding has been decoupled from obsoleted BLOOD flag, and universally linked with damage types of STAB, CUT and BULLET / BALLISTIC, which made bleeding a natural result of damage that penetrates skin and body layers. This, in pair with new bleeding scalability and blood pools, makes bleeding a natural, intuitive and progressive consequence of combat, introducing more in-depth approach to combat damage management and more use for wound dressings and such.
  • Pause/wait single action will allow to put pressure on the most bleeding wound, significantly reducing total bleeding time, extremely useful for heavy bleeding in absence of bandages, or as a support to using bandages.
  • NPC-s bleed as players and inform of hypovolemia, and put pressure on wounds when they pause/wait
  • Monsters' bleeding is simplified - they have no blood pools, no limbs, and no way to stop big bleeds other then wait. The simplification here introduces HP loss due to bleeding, triggering on statistical chance based on bleeding intensity, and every time HP is lost, as a reaction bleeding will reduce in duration (coagulation on the wound?), with overall effect of monsters' bleeding ending quicker, but with significant loss of HP if you manage to bring it to a high intensity.

PART THREE - DRESSINGS

  • Bandages' (etc.) blood loss stopping quality / power is now measured in how much blood loss intensity levels can it stop at application, and not as a chance of stopping whole bleeding instantly (obsoleted 0/1 statistical chance in favor of effectiveness in relation to bleeding intensity) - and as a result severe hemorrhage may requite repeated application of wound dressing,
  • It is supported and enhanced by characters first aid skill.
  • Introduced adhesive bandages aka band-aids, a low-tier dressings to deal with small bleeding scratches,
  • Introduced tourniquet, a wearable first aid device used to apply pressure to a limb or extremity in order to limit blood flow. Should be employed only to manage heavy bleeding, because prolonged use will harm the limb. It can be adjusted in size to fit different limbs (but not head or torso). Tourniquet will not reduce bleeding effect intensity level (its not applied on the wound, bleeding wound has to be dealt with bandages etc.), but will reduce the effective blood loss (reduction of blood & red cells pools).
  • Introduced recipes for fabrication of the above newly introduced items (finally some use for medical tape)
  • Small scale dressings (like newly introduced adhesive bandages aka band-aids) may be ineffective at stopping top-tier arterial bleeding, but simultaneous use of tourniquet, dressings and wound pressure is synergistic enough to deal with the danger of bleeding out at any level. High first aid skill for example allows using smaller dressing on bigger wounds.
  • Introduction of IFAK - Individual First Aid Kit - a new first aid kit of military origin with contents oriented on dealing with heavy bleeding. Contents are in line with existing IRL IFAK-s.

PART THREE - MISCELLANEOUS

  • added debug tool to bleed self, for easy testing (access to blood pool and red cells pool already covered via player "needs")
  • UI has been updated where applicable to new changes
  • new death events and according update of memorial logger
  • nanobots CBM has been updated accordingly to the new changes

Alternatives I've considered

  • dozen of other approaches
  • different balance, which is still on the table, as this changes meta a lot
  • splitting this into parts, but it wouldn't make sense if not introduced as an internally consistent pack of features
  • not doing this and not dealing with reeeee hysteria and "hot frozen" bugs

Testing

  • compiles
  • blood pools work as intended, depleting and replenishing as designed
  • bleeding triggers blood pools deficiency effects, they trigger their own results
  • player dies when he should, events trigger
  • monsters dealing appropriate damage cause bleeding, shift in meta may need additional shift in danger evaluation (damn you manhacks and sewer gators)
  • monsters can bleed out as expected, but the simplifications work as intended to prevent exploits
    (shotgun moose hunting is very satisfying)
  • new items seem to work as intended, including new blood stopping power, UI, boundary conditions, special cases (looking at you tourniquet)
  • pausing to press the wound and save yourself from grave works as a charm (perhaps in future may be transplanted to wait action also?)

Additional context

This is a big change. I've tried to separate commits into logical sections for better readability but you have to disregard a few unsquashed at the beginning, tracking back to former introduction of blood groups.

I cannot guarantee that it is totally bug free, although many iterations of testing eliminated everything obvious.

It may need further balancing, especially as it will create a new meta in combat and will change danger assessment of monsters that deal bleeding inducing damage.

I also, at this stage, couldn't guarantee introduction of advanced JSON-ization for future interactions with mutations etc., and left it for future development. It's already huge as it is.

nexusmrsep and others added 30 commits May 31, 2020 10:00
@nexusmrsep
Copy link
Contributor Author

Again following @I-am-Erk suggestions I've re-balanced blood loss rates.

Current blood loss levels: 0.1ml/turn/level = 6ml/minute/level

With max level 40 we get 4ml/turn max, which is 240ml/minute (1L per 4,16 minutes) and that gives us roughly 12,5 minutes to lose 3L of blood at which point game starts checking death condition (simplified as this disregards how much the wound would close in that time).
In testing with one bleeding wound of lvl 40 it took 15 minutes to lose approx. 3L of blood (including regen ratio etc.).

@nexusmrsep
Copy link
Contributor Author

I believe I've satisfied most (if not all) requests for changes in this code, with one exception - @SirPendrak idea about using tentacles to stop bleeding more effectively. This I'll add later along with few more factors that might limit use of hands.

There are few things I'd like to do to make it better, but none of them has to bloat this monstrosity any more.
One of those things are introduction of dedicated tests to get a grip on the mechanics, so they don't float away in the future.
And as I said at the beginning: this will change the meta, this will need more tweaking, but unless there is still something conceptually wrong with the current model, those tweaks should be minor.

As so, I shall mark this PR as ready.

Another round of reviews gladly welcomed.

@nexusmrsep nexusmrsep marked this pull request as ready for review July 5, 2020 19:40
@nexusmrsep nexusmrsep removed the request for review from John-Candlebury July 8, 2020 15:55
chaosvolt added a commit to chaosvolt/cdda-arcana-mod that referenced this pull request Jul 11, 2020
Preparation for CleverRaven/Cataclysm-DDA#41219

* Set it so that red potion's effect blocks the extra effects of blood
loss, and consuming it gives a hefty dose of blood and red blood cells.
* Updated medical items so that they reduce bleeding at expected rates.
* Set various effects that halt bleeding to also disrupt anemia and
hypovolemic shock. In practice though, since there's no way for spells
or effects to generate vitamins, I suspect this won't be as useful as
halting blood loss would be.
* Set it so that Dragonblood mutants gain bonuses to blood recovery,
scaling up as their main metabolic traits evolve (since those are the
ones that affect healing rate)
* Removed use of oboslete monster flag.
@kevingranade kevingranade merged commit c876885 into CleverRaven:master Jul 11, 2020
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/psa-blood-overhaul-is-now-in-the-experimental/24140/1

@nexusmrsep nexusmrsep deleted the blood2 branch July 12, 2020 08:01
@misterprimus
Copy link
Contributor

misterprimus commented Jul 16, 2020

This was one of the big things for me that was taking away from immersion (didn't make sense for body parts to be damaged from bloodloss). I was longing for an Unreal World-style bloodloss system. I just started playing downed helicopter start and noticed my bleeding parts weren't losing HP, Then I saw this PR. HURRAY! Can't comment on stability yet, but haven't noticed any problems so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Game: Mechanics Change Code that changes how major features work Items / Item Actions / Item Qualities Items and how they work and interact [JSON] Changes (can be) made in JSON Mechanics: Character / Player Character / Player mechanics Mechanics: Effects / Skills / Stats Effects / Skills / Stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.