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

More pharmacological expansion infrastructure work + a few new drugs #70239

Merged
merged 56 commits into from
Jan 3, 2024

Conversation

gkarfakis19
Copy link
Contributor

@gkarfakis19 gkarfakis19 commented Dec 16, 2023

Summary

Content "Further pharmacological expansion infrastructure + adds a few new drugs that make use of the system "

Purpose of change

This PR is based on #53152 and builds on #53187

Changes:

  1. I have added new variables that simulate respiration rate, and updated the existing heart rate and blood pressure variables so that they are able to be changed by json effects.
  2. I have added ibuprofen, naproxen, acetaminophen, as new drugs that utilize this new system. I have also added them to loot lists rationally, where aspirin is.
  3. I have updated aspirin to increase the duration of bleeding effects. I have also created new json infrastructure that allows effects to do this for specific body parts.
  4. I have added vitamin infrastructure that allows all those drugs above and all future vitamins of vitamin_type::DRUG to take effect 30 mins after digestion, using existing stomach infrastructure. This allows us to set custom vitamin decay rates to model different drug durations, and with some small c++ changes in the future, also allow us to "trickle in" drugs to the bloodstream.
  5. I have adapted aspirin, as well as the new painkiller drugs, to use this new system. I have also added metaprolol (a beta blocker), that uses this new vitamin system as well. It does not spawn in game ,as it has no gameplay effect yet.
  6. This means that future drugs should exclusively provide a vitamin of type vitamin_type::DRUG upon consumption. This vitamin will then cause downstream effects. Drug (has nutrition value of vitamin) -->(30 min delay) --> vitamin --> effect.

Showcasing 6 ( assume drug works for 80 mins, and that stomach digestion takes 30 )
image

Aspirin (and other drugs) by default worked as the first figure. With my system, we can get figure 3.
For now, the drugs I have changed and added don't have linear effects, just a single effect based on if their concentration is >0. In the future, this may be reconsidered for even more realism, but such a change will probably be too granular for gameplay purposes.

For reference, actual image of what irl drug concentrations look like. You can see Figure 3 is a cheap approximation of this.
6vhPl

This new vitamin drug system will also make it possible for us to model new drug interactions in the future. The intention is (in some future PR) to rip out the pkill and stim infrastructure and replace it with associated vitamins, as this allows for more granular representation of effects.

Remember that the heart rate, blood pressure and respiration rate variables do nothing in-game currently.

Describe the solution

I have added new different effects in order to better differentiate NSAID painkillers from acetaminophen and other generic painkilling effects such as alcohol or marijuana.

Currently, aspirin increases bleeding duration by around 5% (non stacking), and this lasts for 5 days.

I have added the painkillers to loot lists. I simply added them wherever aspirin was, and tried to rebalance so that ibuprofen and acetaminophen are most common, with aspirin and naproxen less common.

I did not add metaprolol to any loot lists as it has no gameplay effect (except changing the printout of the fitness band).

Describe alternatives you've considered

Not doing this.

Testing

Spawned in, ensured acetaminophen and aspirin stacked, and that aspirin increases bleeding duration.
Also tested that ibuprofen increases blood pressure, even though this does nothing in-game.
Tested that metaprolol actually blocks pain from affecting heart rate, and checked that it takes 30 mins to kick in and 24 hours to dissipate.

Additional context

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` EOC: Effects On Condition Anything concerning Effects On Condition json-styled JSON lint passed, label assigned by github actions labels Dec 16, 2023
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Dec 16, 2023
@gkarfakis19 gkarfakis19 changed the title Implement some new drugs and effects to enhance medical complexity More pharmacological expansion infrastracture work + a few new painkillers Dec 16, 2023
@gkarfakis19 gkarfakis19 changed the title More pharmacological expansion infrastracture work + a few new painkillers More pharmacological expansion infrastructure work + a few new painkillers Dec 16, 2023
@Maleclypse
Copy link
Member

I'm not you and I can't tell you what to do, but if I were doing what you are doing, I would rip out the entire pkill infrastructure and replace it with a series of vitamins, NSAIDs and opiates. That way you can more granularly control what effects are happening and the potential interactions of drugs. As an example once opiates and stims are a vitamin you could create a two hidden effects that when you have both together produce a third vitamin that reflects the issues of taking uppers and downers together rather than them canceling out. Different types of opiates would just produce more opiate vitamin or if you wanted to get real granular you could create a new vitamin for each opiate type and model their own burn rates in the metabolism and create interactions based on that. The vitamin system is incredibly useful for creating complex interactions.

@github-actions github-actions bot removed json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Dec 16, 2023
@gkarfakis19
Copy link
Contributor Author

I'm not you and I can't tell you what to do, but if I were doing what you are doing, I would rip out the entire pkill infrastructure and replace it with a series of vitamins, NSAIDs and opiates. That way you can more granularly control what effects are happening and the potential interactions of drugs. As an example once opiates and stims are a vitamin you could create a two hidden effects that when you have both together produce a third vitamin that reflects the issues of taking uppers and downers together rather than them canceling out. Different types of opiates would just produce more opiate vitamin or if you wanted to get real granular you could create a new vitamin for each opiate type and model their own burn rates in the metabolism and create interactions based on that. The vitamin system is incredibly useful for creating complex interactions.

That sounds like a great project. The issue is that I have never used the vitamin system before and this sounds quite complicated. I have never made such sweeping changes to the game before. For now, what I added does not really interact with the pkill system that much. I can certainly move onto replacing the entire pkill system after this is added. Using vitamins for everything sounds like a much better way of handling individual drugs than what I am doing.

In any case, I'd like to keep this PR to what I have outlined (simply hooking up json meds to these variables). Once that is merged, I can take a look at the more ambitious case of replacing everything with vitamins, but I believe what I am building now is good enough.

@gkarfakis19
Copy link
Contributor Author

Also, I'd love to have someone with more medical knowledge like @I-am-Erk 's opinion on this.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Bionics CBM (Compact Bionic Modules) labels Dec 16, 2023
@gkarfakis19 gkarfakis19 marked this pull request as ready for review December 16, 2023 02:05
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 16, 2023
@gkarfakis19
Copy link
Contributor Author

the PR as it stands does what it says on the tin.
However, instead of using vitamins, I am using a pkill-inspired system for the blood pressure, perspiration rate and heart rate modifiers that effects influence that may be harder to extend in the feature.
I can either commit this PR as is (it's still relatively contained), and then work on porting everything (including pkill hopefully) to vitamins on a separate PR, or rip out what I have now and port it to vitamins immediately.

I think getting this merged as-is makes more sense, as it brings value to the game already. I would appreciate advice by more senior contributors on this.

I will work on getting the new meds added to loot lists for now.

@github-actions github-actions bot added Spawn Creatures, items, vehicles, locations appearing on map Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies labels Dec 16, 2023
@gkarfakis19
Copy link
Contributor Author

Well, to be honest, every single line of C++ code I have written in this PR doesn't actually have any gameplay effect (much like beta blockers), so I guess I should just throw it all out? This PR is mainly infrastructure for drugs like beta blockers. I see no point in removing perfectly functional code just because it could be possibly JSONified in the future. In regards to redundant code, I hope you realize that the functions I am modifying (heart rate, blood pressure etc.) were added in 2021 and have never been used since.
The reason that beta blockers will not spawn yet is precisely because of this (they have no gameplay effect). This will obviously change in the future once gameplay effects for high/low HR/blood pressure are added, but this PR has to go through first.

Once this goes through, feel free to implement everything I've done in JSON if you want to. I do not wish to rush things, but I do not see a credible argument to change anything in this PR yet. I am waiting on @I-am-Erk's review of these changes, as I respect his opinion on this very much.

@I-am-Erk
Copy link
Member

OK I think I can finally start looking at this.

Copy link
Member

@I-am-Erk I-am-Erk left a comment

Choose a reason for hiding this comment

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

I have to get back to work but i'm about halfway through

data/json/effects.json Outdated Show resolved Hide resolved
data/json/effects.json Outdated Show resolved Hide resolved
data/json/effects.json Show resolved Hide resolved
data/json/itemgroups/Clothing_Gear/clothing.json Outdated Show resolved Hide resolved
data/json/itemgroups/Clothing_Gear/clothing.json Outdated Show resolved Hide resolved
data/json/items/comestibles/med.json Outdated Show resolved Hide resolved
data/json/items/comestibles/med.json Outdated Show resolved Hide resolved
data/json/items/comestibles/med.json Show resolved Hide resolved
data/json/vitamin.json Outdated Show resolved Hide resolved
src/character.cpp Show resolved Hide resolved
gkarfakis19 and others added 3 commits December 29, 2023 01:57
Co-authored-by: I-am-Erk <45136638+I-am-Erk@users.noreply.github.com>
Co-authored-by: I-am-Erk <45136638+I-am-Erk@users.noreply.github.com>
Co-authored-by: I-am-Erk <45136638+I-am-Erk@users.noreply.github.com>
gkarfakis19 and others added 2 commits December 29, 2023 12:05
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Maleclypse
Copy link
Member

Needs to resolve conflicts.

@gkarfakis19
Copy link
Contributor Author

Needs to resolve conflicts.

I am waiting on @I-am-Erk's full review first.

@I-am-Erk
Copy link
Member

I-am-Erk commented Jan 2, 2024

So as you mentioned to me on Discord, I think there's some concern here about how vitamins interact with this system, where if you take multiple aspirin the duration increases. It's not something I'd necessarily call a blocker, but I think it's something we'd need to fix fairly soon. Probably vitamins aren't the right tool for this, although one option would be to design an alternative type of vitamin that operates differently to represent drugs. Basically we need to have some kind of system for dose-response curves. It can be quite simple, and I'm not sure if vitamins or a special type of effect flag are a better method.

Like I said, I'm okay with putting this in using vitamins so long as this is something we think about longer term

Copy link
Member

@I-am-Erk I-am-Erk left a comment

Choose a reason for hiding this comment

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

I'm not great at reading c++ like this, but what I see there looks pretty good.

src/character.cpp Outdated Show resolved Hide resolved
gkarfakis19 and others added 2 commits January 2, 2024 14:28
Co-authored-by: I-am-Erk <45136638+I-am-Erk@users.noreply.github.com>
@gkarfakis19
Copy link
Contributor Author

I'm not great at reading c++ like this, but what I see there looks pretty good.

Great. I'll push the otc painkiller rename changes.

@github-actions github-actions bot added Missions Quests and missions Map / Mapgen Overmap, Mapgen, Map extras, Map display Items: Food / Vitamins Comestibles and drinks labels Jan 2, 2024
@gkarfakis19
Copy link
Contributor Author

this should be ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Bionics CBM (Compact Bionic Modules) [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs Missions Quests and missions Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies NPC / Factions NPCs, AI, Speech, Factions, Ownership Spawn Creatures, items, vehicles, locations appearing on map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants