Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove/Reduce randomness in medical chem healing
#1
Right now, a large number of medical chems, rather than healing Y damage every tick, have an X% chance to heal Y damage every tick.  This can make healing people rather RNG dependent, a problem only exacerbated once mult gets involved.  From my own experiments, the game appears to only roll once if it's processing multiple ticks at the same time. 
For why this matters, take salicylic acid, which has a 55% chance of healing 2 BRUTE.  In a lag-free situation, the amount of healing and the chance of said healing occurring over a period of three ticks would be a 9.1125% (0.45 x 0.45 x 0.45) chance of healing 0 BRUTE, a 33.4125% ([0.45 x 0.45 x 0.55] + [0.45 x 0.55 x 0.45] + [0.55 x 0.45 x 0.45]) chance of healing 2 BRUTE, a 40.8375% ([0.55 x 0.55 x 0.45] + [0.55 x 0.45 x 0.55] + [0.45 x 0.55 x 0.55]) chance of healing 4 BRUTE, and a 16.6375% (0.55 x 0.55 x 0.55) chance of healing 6 BRUTE.
In a high lag situation, where three ticks are being processed at once, the possible outcomes would instead be a 45% chance of healing 0 BRUTE and a 55% chance of healing 6 BRUTE, because, as noted, it rolls once and multiplies the results.  (This isn't even a particularly high multiplier for peak hours, as I recall.)

What I propose, then, is to go from X% of healing Y damage to healing X% of Y damage.  I went ahead and did the math for a bunch of them.  I generally won't be mentioning the stuff that wouldn't change to save me a bunch of typing.  (I've not done overdose damage because that tends to be way more complicated and would mostly just get healed by the healing.  Overdoses really need a rework, honestly.)

Format is [CHEMICAL - old behavior -> new behavior]

CHARCOAL - 50% chance of increasing depletion rate of all other chems by 1 -> increases depletion rates of all other chems by 0.5
EPHEDRINE - over 0 health 33% chance of -1 BRUTE, -1 BURN, 8% chance of -1 TOX; under 0 health -1 BRUTE, -1 BURN, 50% chance of -1 TOX -> over 0 health -0.33 BRUTE, -0.33 BURN, -0.08 TOX; under 0 health -1 BRUTE, -1 BURN, -0.5 TOX
MENTHOL - 55% chance of -2 BURN -> -1.1 BURN
MUGWORT - on INGEST by wizards, 85% chance of -1 LOSEBREATH, 45% chance of -1 OXY, 45% chance of -1 TOX, 45% chance of -6 BRUTE, 45% chance of -6 BURN -> on ingest by wizards, -0.85 LOSEBREATH, -0.45 OXY, -0.45 TOX, -2.7 BRUTE, -2.7 BURN
OCULINE - 80% chance of -1 eye damage, 80% chance of -1 ear damage -> -0.8 eye damage, -0.8 ear damage
OMNIZINE - 50% chance of -1 LOSEBREATH, 10% chance of -1 BLEED -> -0.5 LOSEBREATH, -0.1 BLEED
PENTETIC ACID - 75% chance of -4 TOX, 33% chance of +! BRUTE, 33% chance of +1 BURN -> -3 TOX, +0.33 BRUTE, +0.33 BURN
PERFLUORODECALIN - 33% chance of -1 BRUTE, 33% chance of -1 BURN -> -0.33 BRUTE, -0.33 BURN
POTASSIUM IODIDE - 33% chance of -1 kidney damage, 33% chance of -1 liver damage -> -0.33 kidney damage, -0.33 liver damage
PROCONVERTIN - 90% chance of -1 BLEED -> -0.9 BLEED
SALICYLIC ACID - 55% chance of -2 BRUTE -> -1.1 BRUTE
SALINE-GLUCOSE SOLUTION - 33% chance of -2 BRUTE, 33% chance of -2 BURN, 33% chance of generating 1u of blood -> -0.66 BRUTE, -0.66 BURN, +0.33u blood
STRANGE REAGENT - 10% chance of +2 BRUTE, 10% chance of +2 TOX -> +0.2 BRUTE, +0.2 TOX
STYPTIC POWDER - 5% chance of -1 BLEED -> -0.05 BLEED (The actual value isn't on the wiki, I'm going off of memory of the PR.  It might be a higher chance, it was awhile back.)
SYNAPTIZINE - under 90 BRAIN, 50% chance of -1 BRAIN -> under 90 BRAIN, -0.5 BRAIN

Note that I'm not sure if LOSEBREATH, BRAIN, eye, ear, and organ damage can be non-integer values since the health analyzer doesn't give detailed information there.  If they can't, it probably wouldn't be a big deal just to round it.
Reply
#2
probmult() increases the likelihood of an event across multiple ticks.
Reply
#3
Not saying this doesn't apply to a bunch of them, but there's nothing inherently wrong with using `probmult` instead of `mult` for the various healing stuff for the most part (caveat: this doesn't hold whenever it would exceed 100% at the moment).

I disagree to some degree with removing the RNG entirely. The RNG aspect of some of the chems is a feature of the chem. Assuming it has a relatively low chance of happening and uses `probmult` then I think that feels better than using `mult` to just increase the effects. For chems with, say, >50% chance of an effect happening, I would prefer they had the randomness removed, used `mult`, and had their number scaled accordingly as in the OP (as at this point the RNG is pretty much just an inconvenience rather than actually being anything resembling a balancing factor).

I am unsure of whether some of the items (e.g. bleed, eye damage, ear damage) can be reasonably affected by non-integer values. I would assume so, but this is SS13 so it's entirely possible that that's not the case.

Examples in above that I think shouldn't be changed (except for to use probmult if they're not already): styptic powder bleed healing (use probmult), omnizine's bleed healing (use probmult), ephedrines tox healing (use probmult).

Charcoal I would consider leaving as-is because the non-deterministic nature means you can't perfectly predict the rate of depletion of things, which I consider a plus.
Reply
#4
(08-12-2021, 11:56 AM)UrsulaMejor Wrote: probmult() increases the likelihood of an event across multiple ticks.

Would that address the healing being all-or-nothing?  I don't know anything about coding.
Reply
#5
"mult" is our way of dealing with the ticks sometimes being a little slower than expected. IIRC we "assume" that a life tick is every 4 seconds and that mult (by default) is 2. No, I don't know why we don't have mult be 1 by default, probably to do with the life tick previously being 2 seconds or something.

An effect can use mult to scale its effect. For example, if something heals 1 BRUTE damage per tick, we can use mult to make it heal an amount based on the actual time that has passed. If this particular tick took 50% as long again as usual, mult would be 3 (default of 2, plus 50%), so it would heal 50% more than normal in this given tick.

probmult is mostly for things that can't really have the effect scaled by a multiplier (or not in a way that is particularly well balanced), to increase the chance of it happening based on how long the tick actually was. I can't remember if probmult accounts for the default of 2 or not, but basically it means that if a tick takes 50% as long as normal to happen, the things that could occur in that tick have a 50% greater chance of applying (so turns a 10% chance into a 15% chance if the tick was 50% longer than normal).

This means that in general the effect over a long period roughly balances out. This doesn't hold true for cases where it would increase the probability to over 100%, so is best used for things that have a relatively low percentage chance of happening in order to properly scale.

EDIT: "probmult" doesn't change the all-or-nothing aspect, but means that it triggers roughly the same amount over a longer time frame regardless of the lag. Using "mult", removing the prob part and reducing the amount to scale by the current probability would "fix" the thing you're talking about. I would argue that that's not desirable in all cases. Many chems already do work this way, though.
Reply
#6
codernote: probmult isn't a simple `prob * mult`, the math works out such that if mult is 2, a 10% chance becomes a 19%, but 50% chance becomes only 75%, not 100%, etc etc, which is why where possible we use mult on numbers directly for damage, healing, etc, instead of going through probmult
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)