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

Prevent gaining non-intelligence stats from reading with Stats Through Skills #39387

Closed

Conversation

anothersimulacrum
Copy link
Member

@anothersimulacrum anothersimulacrum commented Apr 9, 2020

Summary

SUMMARY: Mods "Stats Through Skills: Prevent raising strength, dexterity, or perception through reading"

Purpose of change

For all the skills but intelligence, it doesn't make much sense to learn skills by reading. It probably doesn't make some sense for a bit of the intelligence skills, but someone else can perform the analysis for that.

Describe the solution

Split SkillLevel::_exercise into two variables - _practice, and _knowledge.
Create enum skill_exercise_type, which tells SkillLevel::train whether to train _practice or _knowledge.
Plumb the skill_exercise_type through all instances of player::practice and SkillLevel::train
Training from NPCs and reading books gives KNOWLEDGE, all other training gives PRACTICE.
Adjust skill rust to subtract equally from each of these experience pools.

Add practice_ratio to SkillLevel
This tracks the ratio of practice experience to knowledge experience that was used to learn this skill.
On level up, determine this with the formula

( sum of all previous experience * practice_ratio ) +
( experience to get to this level * ( practice / ( practice + knowledge ) ) )
----------------------------------------------------------------------------------
sum of all previous experience + experience to get to this level

Adjust savegame loading code to load the previous experience value into practice experience.
Similarly, if there is no practice_ratio, set it to 1.0f.
Along with these changes, bump the savegame version.

Adjust skill_boost to contain skills that will give stats through practice and skills that will give stats through knowledge separately.
When calculating skill boost, use the experience of each type where appropriate, over 1000.

Add skill_boost::_coefficient and skill_boost::_max_stat, and use them in the calculation to cap and multiply the experience.

Change the calculation for stats through skills from

( skill_total - 3 )^0.4

to

( ( 0.9 * experience_total ) - 0.5 )^0.33

This roughly tracks the previous min/average experience to gain each stat level, but is a little accelerated.
The stat cap is set to 5, tracking with the previous effective stat cap.

Stats through skills now emphasizes higher levels, as opposed to more levels, because stat gains are based off of experience, not number of skills.

Add character::set_skill_practice_ratio and SkillLevel::set_practice_ratio, to set the practice ratio for skills.
Using this, when taking skills in character creation, give then a practice ratio of 50%.
I'm not tied to this number, it's just the arbitrary one I chose.

Testing

BEFORE applying this change, create a world with stats through skills, and a default character, and go out and forage in the woods a bit, until you have some experience in the survival skill.
Remember the amount of experience you have in survival.
Load the save with this applied, and your experience in survival will be the same.

Set skill learning rate to 100 in the options before performing the next steps:

Spawn in the books Under the Hood and Mechanical Mastery, and read them until your mechanics is level 6. Your strength stat will not increase.
Spawn in the books that come up when you search first in the debug menu, and read them until your first aid is level 6. Your intelligence will increase.

Create a new default character in the same world.

Spawn in appropriate tools, use the debug menu to level your mechanics to 1, and then repair or otherwise interact with vehicles until your mechanics is 6. Your strength stat will increase.
Spawn in several bandages, and bandage your character till your first aid skill is 6. Your intelligence will increase.

Create a new character in the same world, but this time take 10 levels of swimming.
You will get a strength boost of 2.
Create a new default character in this world, and swim until your swimming is level 10.
You will have a strength boost of 3.

@anothersimulacrum anothersimulacrum force-pushed the sts-readercise branch 3 times, most recently from c165945 to 0642bf7 Compare April 9, 2020 06:52
@anothersimulacrum anothersimulacrum changed the title [WIP] Prevent gaining non-intelligence stats from reading with Stats Through Skills Prevent gaining non-intelligence stats from reading with Stats Through Skills Apr 9, 2020
@FuelType-Memes
Copy link
Contributor

So, 2 situations:

  1. I start with mechanics 1, I practice to lvl 6. My STR should increase
  2. I start with mechanics 1. I read to lvl 6. My STR should not increase

Does it mean, that if I read I'm never getting the STR I could've gotten without reading?

@anothersimulacrum
Copy link
Member Author

anothersimulacrum commented Apr 9, 2020

Yes.
Doing anything but purely practicing your skill up to the same level as just practicing it to that level will always result in less stats.

@FuelType-Memes
Copy link
Contributor

  1. Say it takes 20 (abstract) points of practice to get to lvl 6 mechanics. I read to lvl 6, and also practice the equivalent of 20 points, why should I not gain the same amount of stats?
  2. I would say this brings inconsistency: how would a player understand that reading is actually detrimental in the long run?

@anothersimulacrum
Copy link
Member Author

Because you're reading, you're not doing anything that would actually make you stronger.
I plan to make a follow-up PR to display practice/knowledge experience in the skill menu, I'm still figuring out how to display it though.

@FuelType-Memes
Copy link
Contributor

I understand the point you're trying to make about reading, but I'm specifically talking about the same amount of practice with and without reading

  1. Read to lvl 6 -> gain 0 point
  2. Practice to lvl 6 -> gain 1 point
  3. Read to lvl 6 AND practice the same amount it would take to get to lvl 6 -> gain 1 point

Situation 3 should actually take less practicing, because you now know the theory

Create a new character in the same world, but this time take 10 levels of swimming.
You will get a strength boost of 1.
Create a new default character in this world, and swim until your swimming is level 10.
You will have a strength boost of 2.

Why should practicing after the cataclysm matter more than practicing before the cataclysm?

@anothersimulacrum
Copy link
Member Author

I'm sorry, I don't understand what you're trying to say about those scenarios.

What I'm demonstrating in that particular case is is that the practice ratio is set to 50% when taking skills in chargen. I'm not tied to that ratio, but I didn't know what a better one would be.
Reading swimming to 10 would get you a stat boost of 0 in strength, because the practice ratio is 0%.

@FuelType-Memes
Copy link
Contributor

Sorry, I might have chosen my words poorly

Just trying to understand the reasoning and logic behind this system:

What I'm demonstrating in that particular case is is that the practice ratio is set to 50% when taking skills in chargen. I'm not tied to that ratio, but I didn't know what a better one would be.

For me, it seems logical that taking a skill during a character gen should actually give higher practice ratio (100% or even higher), as I would assume that the character is familiar with the chosen skill either through profession (an actual mechanic should have plenty of practice) or because they invested some time in this skill before the cataclysm (hobby; ex-mechanic; helped relative around a shop)

Reading swimming to 10 would get you a stat boost of 0 in strength, because the practice ratio is 0%.

Yes, I agree with that proposal, but practice should not be a ratio. Let's take your example:
Read a skill to lvl 10. You're at a skill ceiling so no more lvl gain. You're never getting that bonus stat, no matter what. Even if you now practice that skill all day and all night you're never getting the bonus stat point

@anothersimulacrum
Copy link
Member Author

I'd actually be more tempted to give it a lower ratio, with the justification that the stat gains from that skill are incorporated into the stats taken at chargen.

Practice isn't really a ratio, I'm just storing it in a ratio because experience is wiped out on each level up. When multiplied by skill or an amount of experience, it gives how much of that skill, or how much experience has been gained through practicing.

Okay, I see what you mean. I'll look into how to resolve that.
I'm thinking that I'll grab all experience of the proper type, convert that into a level, and then use that level to apply stat boosts.

@GrandpuhTy
Copy link
Contributor

Alternatively you could also play with stats through kills. Should the two mods be merged?

@anothersimulacrum
Copy link
Member Author

No.

@KorGgenT
Copy link
Member

Alternatively you could also play with stats through kills. Should the two mods be merged?

I have no interest in merging my mod (StK) with stats through skills, nor do i think it is a balanced and good idea.

@KorGgenT KorGgenT added [C++] Changes (can be) made in C++. Previously named `Code` Mods Issues related to mods or modding labels Apr 10, 2020
@anothersimulacrum
Copy link
Member Author

anothersimulacrum commented Apr 10, 2020

Okay: Updated it!

Now, Stats Through Skills cares about the experience of each type, not the levels. This way, training your skills through reading, while it will still not give you as many stat boosts as doing it through practice, will not mean you are locked out of gaining stat boost by practicing after this.

Stat boosts are completely divorced from level ups, and can occur any time you have the appropriate amount of experience in the relevant skills.

These changes mean it is more useful to have higher levels in fewer skills than lower levels in more skills, because those level levels carry less experience than the higher ones.

@anothersimulacrum anothersimulacrum force-pushed the sts-readercise branch 5 times, most recently from 928b532 to 62a4a94 Compare April 10, 2020 16:50
@anothersimulacrum anothersimulacrum mentioned this pull request Apr 13, 2020
@anothersimulacrum anothersimulacrum force-pushed the sts-readercise branch 3 times, most recently from 407a35f to 823983b Compare April 14, 2020 16:06
@lgtm-com
Copy link

lgtm-com bot commented Apr 14, 2020

This pull request fixes 1 alert when merging 823983b into 32e6aab - view on LGTM.com

fixed alerts:

  • 1 for Use of c-style math functions

@anothersimulacrum anothersimulacrum force-pushed the sts-readercise branch 5 times, most recently from c8ae293 to 2d0aa17 Compare April 16, 2020 15:24
Copy link
Member

@kevingranade kevingranade left a comment

Choose a reason for hiding this comment

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

I need to think about this, the main issue I have is that this is pretty invasive to the skill class, which is not justified for a peripheral feature like STS.
OTOH, this might feed into the way skills will work in the future.

This allows differentiating between skills learned from reading books,
and skills learned from practicing them.
This is important for things such as Stats Through Skills, where you
should be able to gain stats from doing activities, but not by sitting
in a basement and reading.

This will cause some differences in how skill is lost due to skill rust,
but skill rust is generally unused, so I figured it was not worth the
time to make it perfect.

This also changes how savegames are loaded, and as such the savegame
version has been bumped.

Skills taken in character generation are treated as 50% practice and 50%
knowledge. There's no strong reason for this ratio, it's just what
worked.
For all the skills but intelligence, it doesn't make much sense to learn
skills by reading. It probably doesn't make some sense for a bit of the
intelligence skills, but someone else can easily change that in the
future.

Because stat bonuses are now based on skill experience, as opposed to
number of skills, Stats Through Skills now emphasizes fewer, higher
skills, as opposed to more, lower skills.

The new formula:
cbrt( 0.9 * experience - 0.5 )
Roughly matches the old formula
sqrt( skills - 3 ) ^ 0.4
in the amount of experience required to get each stat bonus.
It does, however gain slightly faster than the old one.

Because I basically reinvented Stats Through Skills, I put my name in
authors.
@anothersimulacrum
Copy link
Member Author

Talked a bit with Kevin, this is indeed too invasive. If I can think of something less invasive, I may come back to this in future.

@martinrhan
Copy link
Contributor

Talked a bit with Kevin, this is indeed too invasive. If I can think of something less invasive, I may come back to this in future.

it is quite disappointing that this PR is closed. I expected pretty much on this.

@anothersimulacrum anothersimulacrum deleted the sts-readercise branch July 23, 2021 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Mods Issues related to mods or modding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants