Cataclysm-DDA
Cataclysm-DDA copied to clipboard
Average NPC skill level increases over time
Summary
Balance "The average skill level of NPCs will rise over time"
Purpose of change
NPCs are often outclassed by a player of any (gameplay skill) level that can survive long enough to meet the NPC.
We have no time scaling for NPCs. We can apply skills on a class basis, but there's no way to restrict the class from spawning day 1. This means our classes are hamstrung by conflicting needs of balancing the 'early' and 'late' cataclysm experience.
NPCs are often seen as dead weight, as they have no growth curve at all. They don't spend all day huddled in cabins ruthlessly skilling up like our players tend to do.
Describe the solution
Well, give NPCs a gentle growth curve. Those that survive tend to be the skilled and the lucky - and the lucky are still alive, so they can learn to become skilled.
Add two external options: days per level, and level cap. At the time the NPC is generated and randomized, check how many days we are passed the cataclysm. Divide that by days per level, and try to randomly apply that number of levels to skills one at a time. If that skill is at or over the cap, the roll is wasted (meaning growth starts falling off as skills hit the cap, although even that takes a VERY long time).
The options are external so mods may access them as needed.
Describe alternatives you've considered
Applying some sort of time scalars directly to NPC classes on a class-by-class basis
Testing
Rigged up some debug messages to catch values.
Set the date forward an absurd 10 years, spawned a random NPC. They got 520 skill increases and were 7 across the board.
Reloaded, set the date forward only 1 year and spawned a new NPC. Got this:
Additional context
I removed an existing across-the-board bonus to speech which dated back quite a few years. The trade formula has changed since then, I don't think it's necessary.
Yeah, I'd agree. Also, why don't we make it so that a certain classes of npc get the ability to learn more. I.E. A doctor pre-cataclysm would have way more experience 10 years later than a random office worker reading medical studies
She's kind of weak, for 1 year post-cataclysm. I wouldn't have taken her at the start. And you forgot about proficiency. She's survived a year, but hasn't learned anything.
Some ideas.
- Dependence on intelligence
- Separate combat and non-combat experience.
- Emphasis on melee, ranged, or crafting skills
- Prioritization based on starting professions. To associate NPC backstory and skills.
- Focus on skills with max level, especially if they are combat related skills.
I like it, but how about giving them experience instead of skills directly? It'll look a little more natural.
Good idea. I'm looking at the formula for skill levels and I'll have to do some math to make sure the resulting values are reasonable.
And you forgot about proficiency. She's survived a year, but hasn't learned anything.
Proficiencies are subject to change in a much greater degree than skills are. The number of skills available to character has changed almost not at all in cdda's lifetime (even mods have only added a few), whereas proficiencies are pure JSON and can be built out by any contributor willing to put in the time.
I have some alternative plans for giving NPCs reasonable proficiencies (mostly involving tying them to backgrounds). If I'm able to do that it'll probably come in a separate PR as it'll need at least a little bit of infrastructure to load json. In particular I want to get NPCs up to player standards - almost all of them should start with the same basic proficiencies that the standard player does (home cooking, driver's license).
Separate combat and non-combat experience. Emphasis on melee, ranged, or crafting skills Prioritization based on starting professions. To associate NPC backstory and skills. Focus on skills with max level, especially if they are combat related skills.
I have considered a distribution other than pure random, but the main problem with that is that it needs to consider mods as well. Right now in vanilla we have two 'categories', right? 14 combat skills, 13 non-combat skills. If we balanced it separately per-category, a mod that added say 10 more combat skills and 0 non-combat skills would suddenly have a huge imbalance. We could counter this by separating out the options for each category, but that isn't very scalable.
Basically, your ideas have some merit but I don't have a great idea for implementation that works for all circumstances. I'll be thinking about it.
Okay, I pushed a changed version. The time for a average NPC to reach level 7 remains the same, but allocation is based on exp per day. Because it now pipes through Character::practice() we can now take character focus into account, as well as other modifiers such as savant and pacifist. Additionally, practicing is set to always allow 'multileveling', so that exp past the level cap isn't discarded.
There is some weirdness in Character::practice() which causes the actual exp value to be multiplied by 100. This makes the external option's values confusing in isolation (50 exp per day is in fact, 5000 exp per day before focus), but I don't think tearing that pillar down is a particularly good idea.
If we balanced it separately per-category, a mod that added say 10 more combat skills and 0 non-combat skills would suddenly have a huge imbalance. We could counter this by separating out the options for each category, but that isn't very scalable.
We don't have to strike a balance. You have 24 hours in a day. To give you an example, half the time you're in training to create, the other half to destroy.
In other words. The experience calculated by you is divided in a given proportion, which does not depend on the number of skills. (For example 1/2+1/2 or 1/3+2/3). Each portion is divided by the number of skills in the combat and peace segments. The fewer they are, the more significant the increase. There is a logic to this. Focused on doing one thing or taking on everything.
Then we would get:
- EXP * 1/2 * ( sum(combat_skills) / sum(all_skills) )
- EXP * 1/2 * ( sum(peace_skills) / sum(all_skills) )
This could be the first realization.
Second realization.
Add up all the levels taken in all skills. This is 100%. We take each skill and divide its level by this sum. So, for each skill we get a priority. Experience is distributed depending on the priority. Skill with a level of 10, is not taken into account. Alternatively, separate calculation for combat and production skills.
Example. A character is created with skills: melee 3, athletics 1 and tailoring 5.
- Sum: 9
- Priorities: 3/9, 1/9 and 5/9.
More than half of the experience will go into tailoring until it reaches level 10.
Third realization.
We add some random component. Let's say it's equal to the sum of skills. Now it's 13 or 14, depending on what we're counting for. It's added to the sum calculated earlier. The ratio of it to the new sum is the experience distributed randomly.
Same example. Random component = 13.
- New sum = 9+13 = 22.
- Priorities: 3/22, 1/22, 5/22 and 13/22 (distributed randomly among 13 skills)
Second example. A character with skills melee 9, athletics 9, and tailoring 9.
- Sum: 9 + 9 + 9 + 13=40
- Priorities: 9/40, 9/40, 9/40 and 13/40
As you can see, the more skills have a level and the higher that level, the smaller the random component. It's a curve realization of the character's focus on his strengths. That to survive, he focused on what he was good at. Even if it's tailoring.
P.S. You might like the idea of adding character experience for their age. In the second half of the post, there were some ideas.
https://github.com/CleverRaven/Cataclysm-DDA/issues/67580#issuecomment-1936979448