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

Add fitness band and heartrate function for character #36233

Merged
merged 49 commits into from
Apr 12, 2020

Conversation

CountAlex
Copy link
Contributor

@CountAlex CountAlex commented Dec 18, 2019

Summary

SUMMARY: Features "Adds fitness band and heartrate function to character for detetmining heart BPM"

Purpose of change

I am planning to add fitness band to family of watches. However it needs to find out BPM of player character, and this function can be useful for many purposes.

Describe the solution

This function uses average healthy BPM between 60 and 80 to define what it should be depending on fatigue, general health, stamina level, chems and anything else that should be there.

Describe alternatives you've considered

Adding simpler code for BPM calculation to fitness band. Not really reusable or complete this way.
Possible rework upon testing results to see if values are getting to high so every addition will be percentage of average BPM instead of calculated by the moment of modification.

Testing

WIP

Additional context

This function needs much more polishing and details, Any help and advices are very welcome.
Regarding what effects I am applying.
Initially average calm heartbeat is calculated as 70+-10.
Depending on level of stamina/max stamina it's increased non-lineraly up to triple value.
Depending on health value it's increased or decreased 5% for every 20 health points accordingly.
Depending on stimulators it's increased with a math formula I handpicked where it's doubles at 30 level of stims and decreseas up to tripling value.
Other effects are not there yet.
In the end value is clamped between average calm value and 250 BPM.
Spreadsheet is also avaliable (Open Office format):
heartrate.zip

Spreadsheets are below (more will be added)
Stamina effect
stam

Stims have effect that slows down but still raises with accumulation. Formula is explained in comments (or ask me for more details)
stim
Here's also plot for someone with 70 BPM in calm state. X axis is stimulant level, y is BPM.
stim effects

Healthiness effect (based on get_max_healthy that already has bmi factored in). Applied in the end as health effect can do overall count better or worse by up to 50% but still between 60-250 limits.
healthy

Temperature effect for COLDBLOOD mutations of all tiers
temp

Pain effect
pain

TODO list

  • Add item
  • Add function draft
  • Add stamina effects
  • Add nicotine effects
  • Add stimulants effects
  • Add health effects
  • Add mutations effects (SLIMESPAWNER, CHEMIMBALANCE, QUICK, COLDBLOOD, ADRENALINE)
  • Add pain effects
  • Add morale effects
  • Add medication effects - they are already factored in other checks
  • Add more spreadsheets for effects
  • Add item to itemgroups
  • Consider vaguely informing player on general health state
  • Conform effects with Dev team both gameplay-wise and medicine-wise
  • Test

src/character.h Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Dec 18, 2019

Can you provide a table or a data file, that shows what results you get for bpm with differnet numbers being put in , so that you can see the upper and lower ranges?

@CountAlex
Copy link
Contributor Author

Can you provide a table or a data file, that shows what results you get for bpm with differnet numbers being put in , so that you can see the upper and lower ranges?

I will prepare some sort of table.

src/character.cpp Show resolved Hide resolved
src/character.cpp Outdated Show resolved Hide resolved
src/character.cpp Outdated Show resolved Hide resolved
src/character.cpp Outdated Show resolved Hide resolved
@BevapDin
Copy link
Contributor

The contents of your two PRs should be in one PR. They depend on each other, merging just one of them is pretty much useless without merging the other.

Even more so: we can't really test this PR as the function it adds is never called.

We can't really test the other PR as the item it adds has no associated function or meaning.

@CountAlex
Copy link
Contributor Author

The contents of your two PRs should be in one PR. They depend on each other, merging just one of them is pretty much useless without merging the other.

Even more so: we can't really test this PR as the function it adds is never called.

We can't really test the other PR as the item it adds has no associated function or meaning.

It was suggested by dev team member on Discord that I actually make separate function to calculate BPM. This is WIP PR so after it's refined enough this function can be used for many purposes related to heartbeat not just other mentioned PR. Thus, I made this PR separate.
Calling this function would be added, for the very least for testing.

@Zireael07
Copy link
Contributor

The fact that it can be used for other things does not change the fact that there are no uses currently. The only use so far lives in the other PR. As it stands, neither of the PRs would be merged simply because the item is useless and the function is not used.

@CountAlex CountAlex changed the title [WIP] Add heartrate function for character [WIP] Add fitness band and heartrate function for character Dec 19, 2019
src/iuse.cpp Outdated Show resolved Hide resolved
@CountAlex
Copy link
Contributor Author

CountAlex commented Dec 19, 2019

Now this PR has item part of code to be complete and testable.

src/character.cpp Outdated Show resolved Hide resolved
src/character.cpp Outdated Show resolved Hide resolved
@CountAlex
Copy link
Contributor Author

Must be ready for review.
@I-am-Erk Would be neat if you'd checked effects of all kinds I've assumed to influent heartrate.

@kevingranade kevingranade merged commit 6f4bbd5 into CleverRaven:master Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Enhancement / Feature> New features, or enhancements on existing Mechanics: Character / Player Character / Player mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.