Surgery Fact Sheet

Started by Kyna Tiona, January 03, 2017, 08:55:45 AM

Previous topic - Next topic

Kyna Tiona

A fact sheet for anyone interested in making a mod to fix surgery:


-   The base chance of success actually is the doctor's surgery success rate. The success rate (hereafter SR) is then multiplied by 100% + 5% of the room's cleanliness, to a minimum of 60% or a maximum of 150%. (I.E., a room with a cleanliness of -1 would multiply the SR by 95%.)

-   The SR is also multiplied by the medical potency of the medicine used. Herbal medicine has 40%, medicine has 70%, and glitterworld medicine has 160%. This means that even a doctor with a base surgery success rate of 100% will still fail 30% of the time if they aren't using glitterworld meds. Medical benefit bonuses, such as from hospital beds and vital monitors, do not affect this.

-   Operations can have a base success chance that is multiplied against the SR. The only operation that currently uses this, carcinoma, has a success chance of 70%. Hence, even a doctor with a surgery success rate of 100% would still have a 30% chance of failure.

-   Some operations have a "surgery success chance exponent", which multiplies the doctor's surgery success rate against itself a given number of times. This means that low surgery success rates are disproportionately more hazardous for some operations than for others. Notably, the multiplication doesn't happen on stats over 100%, so this process never grants a bonus.

-   In the case of a surgery failure, the game rolls a percent value to see what level of failure to inflict. There is a 50% chance of a minor failure, 40% chance of a catastrophic failure, and a 10% chance of a ridiculous failure.

-   Minor injuries deal a minimum of 20 damage, while catastrophic and ridiculous deal a minimum of 65. After inflicting each injury, the game checks the total surgery damage dealt and stops if the value is over the aforementioned number. The surgery damage dealt is a random value between 50% and 100% of that part's current HP. As such, for a part with 40 HP, there is a roughly 2.5% chance that the part will be instantly destroyed, even on a minor failure.

-   Minor and catastrophic failures can only damage parts that are a "child" or "parent" of the part being operated on. For instance, if operating on someone's skull, the head (the skull is a "child" of the head) or the brain (the brain is a "child" of the skull) could be affected, but the ears and eyes could not (they are both "children" of the head).
   Consequently, catastrophic failures can be more dangerous than ridiculous, as they guarantee that the damage will be concentrated on a small area. For instance, eyes and heads normally only have 10 and 40 health, respectively, for a total of 55 health. A catastrophic failure to the eye can only damage the eye and head, which have less total health than a catastrophic failure deals. Barring an unexpected error in the code, this should always be lethal.

-   Operations can be given a "death on failure" chance, which automatically kills the patient in place of a normal failure. This works from the bottom up, so a 10% death chance replaces the normal ridiculous failures, and a 20% chance reduces catastrophic failure chance down to 30% but leaves minor failures unaffected. Currently, only carcinoma uses this, with a death chance of 25%.

-   For a doctor with a surgery success rate of 100%, in a perfectly clean room with sterile tile, their patient in a hospital bed with a vitals monitor, using medicine to install a bionic ear, there is a 14% chance of instantaneous death.

JaxelT

Glitterworld meds have a potency of 160%, unless they're capped at 100%.

Kyna Tiona

Quote from: JaxelT on January 04, 2017, 04:40:32 PM
Glitterworld meds have a potency of 160%, unless they're capped at 100%.

Oh, you're right. Fixed.

Tynan

I'm rebalancing this, the balance got weird over time so it needed a review.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Chaia

Quote from: Tynan on January 05, 2017, 02:23:32 PM
I'm rebalancing this, the balance got weird over time so it needed a review.

True, surgeries got super strange in the last update

but: Always good to hear that the dev is working on the game

thumbs up for you, Tynan


Kyna Tiona

Quote from: Tynan on January 05, 2017, 02:23:32 PM
I'm rebalancing this, the balance got weird over time so it needed a review.

Awesome! Thank you~!

lost_RD

I say scrap the old surgery system and start fresh.

Does MedicalRecipesUtility need to be internal? AFAIK that's the only thing between me and modding surgery.

Kyna Tiona

Quote from: lost_RD on January 12, 2017, 08:15:08 AM
I say scrap the old surgery system and start fresh.

Does MedicalRecipesUtility need to be internal? AFAIK that's the only thing between me and modding surgery.

Not sure. I imagine you could still detour it fairly painlessly with HugsLib, though, at which point vanilla RimWorld stuff could still interact with it like it's internal despite it being located elsewhere.

grifo

Quote from: Tynan on January 05, 2017, 02:23:32 PM
I'm rebalancing this, the balance got weird over time so it needed a review.

As a veteran gamer and paramedic I cant restrain myself from telling you that whole health\surgery system probably need more love!

I spent 2 years (game time) in game and until that point everything made sense more or less (gameplay makes sense=immersion=dophamine=pleasure=happy customer=more sales) and then stuff started to hit the fan.

1)  My colonist shattered clavicle and I realized that destroyed body part do not produce any pain, scar does and destroyed bone doesnt (pain would be extreme in reality).
2)  "Nothing I cant fix" I said and then I realized that shattered bones are not operable. People can implant bionic eye but cant fix a femur (not a big deal even for 20 century).

Such an exciting area for modding, but there are almost no mods, they are unmantained and limited or focused on prosthetics (implants). I suppose that health\ simple surgery\ natural bodyparts department is not really modding friendly at this moment.

P.S.
3) And next rain started in winter it was -15 outdoors. I hope its a bug and not feature!  :D

Thanks for the game and good luck!

grifo

Quote from: Caraise Link on January 03, 2017, 08:55:45 AM
A fact sheet for anyone interested in making a mod to fix surgery:

Hi, Caraise Link!

Maybe you can help me? Im trying to tweak out DE Surgeries to make post-operational traumas and dissabilities without any luck. When I use install_ArtificialBodypart string in recipes I can add a Heddiff and than modify conditions for trauma like stages, part efficiency and pain, and they working! But as soon as I use install_NaturalBodypart string it stops working. Body part just got repaired and dissapears from health tab. What I doing wrong, any advice?

P.S. My modding skill is 3 or maybe 4.. I can browse trough XMLs but have no clue how to extract core data or go beyond XMLs limitations. Maybe I should leave it to pros? Sorry for offtopic, but my brain already exploding and since people talk about surgeries with knowledge here I decided to ask!   


grifo

Lets say my doctor is 90% successfull, room is at cleanliness 0, industrial medicine is used and surgerySuccessChanceFactor is 1.25

That would be 90X1.0X0.7X1.25=78.7%

So surgerySuccessChanceFactor of 1.0 will not affect surgery difficulty? Im taking it right?

Kyna Tiona

#11
Quote from: grifo on January 17, 2017, 08:28:27 PM
Lets say my doctor is 90% successfull, room is at cleanliness 0, industrial medicine is used and surgerySuccessChanceFactor is 1.25

That would be 90X1.0X0.7X1.25=78.7%

So surgerySuccessChanceFactor of 1.0 will not affect surgery difficulty? Im taking it right?

Yep, it works exactly like that. I'm looking into the other question, get back to you in a bit.

EDIT: It looks like Recipe_InstallNaturalBodyPart isn't set up to to make use of the recipe's addsHediff value. Not sure why.

grifo

Quote from: Caraise Link on January 17, 2017, 09:18:37 PM
It looks like Recipe_InstallNaturalBodyPart isn't set up to to make use of the recipe's addsHediff value. Not sure why.

Thats the problem! I was trying to create various post-surgery conditions for natural body parts, but now Im not sure if there is a way to do it. I would love to know if there is some workaround. Let me know if you will have any ideas.

Also I was asking if anyone can help me with XML templates to override vanilla destroyed body parts values ( My idea is to introduce some pain to destroyed body parts) and no one responded. Maybe natural body parts values are hardcoded and not modding friendly? Thats the reason why all natural surgery mods are stubs, but prosthetics mods are advancing and improving. That what I was talking about in reply to Tynan.

Thanks for your reply! Good luck!

grifo

Quote from: Caraise Link on January 03, 2017, 08:55:45 AM
The success rate (hereafter SR) is then multiplied by 100% + 5% of the room's cleanliness, to a minimum of 60% or a maximum of 150%. (I.E., a room with a cleanliness of -1 would multiply the SR by 95%.)

Sorry to bother you again, but im trying to check things out before Ill balance out all SR for my surgeries. So you say -1 cleanliness is 95% multiplier, doest it mean that 1 unit of cleanliness is worth of 5%? I suppose its a cleanliness value we can observe in enviroinment display overlay?

How then its possible to have -40% or +50% malus or bonus in calculation? My dirtiest room, where cook butchering animals is at -1.94 cleanliness. Does it mean that if I do a surgery there, my intial 100% success rate will lose only about 10% after cleanliness kicks in?

And I dont have a room with cleanliness more than zero. I imagine that even If Ill construct a totally sterile room its cleanliness  will not go higher than 0.5-1.00 values, how I can have 150% multiplier in this case? Now if every 0.1 unit of cleanliness  is worth of 5% then it totally make sense. Then my average rooms will produce a instant 40% malus and sterile room will produce that exact 50% bonus for formula.

Maybe its  cleanliness of -0.1 would multiply the SR by 95%? Im really confused on this one.

Sorry if it was a dumb question but it seems like I got you wrong or you mistaken something or this formula is totally useless.

grifo

And I found this one..
roomSurgerySuccessChanceFactorExponent

How this affects a formula? Maybe thats the way to achieve those large bonuses and maluses for room cleanliness? Is there a way to actually see how formula works in development mode? More questions then before. To be honest i like the formula even if  I dont understand how it works  :D. It clearly allows to configure surgery chances in any possible way, but if someone who created it can post an exact example how it works like AXBXC where are A is..., B is... and C is... it will save a lot of nerves and time for modders. I have a feeling that currently all surgery modders are confused and tend to avoid using whole power of formula, just bcz they are not sure about outcome.