FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.74k stars 406 forks source link

Bots use/waste medicines to treat minor injuries #11477

Closed GowardHoward closed 1 year ago

GowardHoward commented 1 year ago

Disclaimers

What happened?

Bots use medicines from the box. And I can't stop them from doing so. Because of this, I constantly do not have medicines. They spend expensive medicines on the treatment of ordinary healthier

Reproduction steps

No response

Bug prevalence

Just once

Version

0.21.6.0

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

Regalis11 commented 1 year ago

Thank you for the report!

Would it be possible to provide us some more information on the issue? I'm not entirely sure if this is an actual bug - the medic bots are supposed to use medicine when they need it to treat someone.

What box do you mean? Have you tried ordering them to ignore the box, or putting them in somewhere the medic bot can't reach?

aeondez commented 1 year ago

Bots don't really have common sense, and are not very efficient with their medicine usage. Medicine is expensive and extremely important to ration carefully. Bots know what to use to heal a given condition, but it'd be nice if bots only tried to apply medicine if its effects are mostly or fully used. The current thresholds for bots deciding to give medicine feels too low.

For example, if a bot were to use saline or for bloodloss, they should not try to use it until at least ~75% of the bloodloss effect of saline would be applied.

Just throwing out made-up numbers here to make the point:

If fentanyl heals 100 hp, don't let bots apply the fentanyl until the injured crewmember has less than 25 hp

If bandages heal 10 bleeding/burns, don't let the bots apply bandages until the injured crewmember has at least 8 bleeding/burns.

My guess is that bots are trying to get an injured crewmember back to whatever qualifies as "OK" and aren't really concerned if that means wasting meds. However, I have made a point to literally NEVER allow medic or captain bots on my subs (or at least swap their ID cards with a dead assistant or something) because they use all the meds.

itchyOwl commented 1 year ago

Although I don't disagree about the main point: it would be good to make the bots use the medicines reasonable, I somewhat disagree on the suggested approach: we shouldn't lower the thresholds of treating on orders, because that would lead to bots not treating when you tell them to treat. Lowering the thresholds when the bots act autonomously can be considered.

Can be a bit difficult to solve this without giving the player more control over it.

Regalis11 commented 1 year ago

Another thing to note is that there are two thresholds: one for health, and another for affliction strength. I.e. a character needs to be below certain health (75% by default, 90% if the bot has been explicitly ordered to treat others), and the afflictions themselves need to be above a certain thresholds for the bot to consider what to treat and how.

This is a pretty tricky problem to solve for several reasons:

If fentanyl heals 100 hp, don't let bots apply the fentanyl until the injured crewmember has less than 25 hp If bandages heal 10 bleeding/burns, don't let the bots apply bandages until the injured crewmember has at least 8 bleeding/burns.

It's unfortunately not that simple, because that's not how the medical system works. Fentanyl doesn't heal any HP, it reduces certain afflictions which can result in an increase in HP (or not, if the character is for example about to overdose or suffering of oxygen deprivation).

Regalis11 commented 1 year ago

Now thinking about it, something that might help with the issue is improving how the bots judge the strength of an affliction on a specific limb.

Now each limb is essentially handled separately: e.g. 5% internal damage on one limb is enough for a bot to consider it worth treating, which we can't easily increase, because it could mean the bot can have a nearly lethal amount of internal damage in total, spread across different limbs, before the bots start treating it. But if we took the damage on other limbs into account too, especially when the injury is treated with something that affects all limbs, we could safely bump that threshold much higher.

Another thing we should probably do is making the bots prefer less effective (and cheaper) meds for small injuries. Now they always choose the most effective one for a given affliction, regardless of its strength.

Regalis11 commented 1 year ago

Addressed in https://github.com/Regalis11/Barotrauma-development/commit/154f8ef3b194633139d177baffb0aef03fb29001

Adjustments to make bots less eager to waste medicine for minor injuries:

  • Increased afflictions' default treatment threshold from 5 to 10.
  • Bots take afflictions in other limbs into account when determining whether an affliction is sever enough to treat. I.e. a 5% burn can be ignored, but 5% burns in all limbs can't.
  • GetSuitableTreatments prefers less effective treatments for small injuries, meaning the bots will use e.g. opium or morphine for minor damage instead of always using the most powerful meds available.
Rokvach commented 1 year ago

Tested, working correctly. Can be merged and closed.