Experience System - Grim-/Talented GitHub Wiki
The mod features a comprehensive experience and talent point system that allows pawns to gain experience through various actions and earn talent points for character progression.
Experience can be gained through multiple sources, all of which are configurable:
<Talented.ExperienceGainSettings>
<experienceTypes>
<li Class="Talented.DamageExperienceTypeDef">
<baseXP>1.0</baseXP>
<damageFactor>0.1</damageFactor>
<multiplierStat>ShootingAccuracyPawn</multiplierStat>
</li>
</experienceTypes>
</Talented.ExperienceGainSettings>
-
Combat Actions
- Dealing damage
- Taking damage
- Using weapons (verbs)
-
Skill Usage
- Gaining vanilla skill experience
- Completing jobs
- Using abilities
-
Ability Usage
- Custom XP gain per ability
- Supports stat-based multipliers
The system includes several specialized experience type definitions:
-
Talented.DamageExperienceTypeDef
- Handles combat-related experience
- Configurable damage-to-experience ratio
- Supports both dealing and taking damage
-
Talented.SkillExperienceTypeDef
- Links to vanilla RimWorld skills
- Converts skill experience gains to talent experience
-
Talented.JobExperienceTypeDef
- Rewards completing specific jobs
- Configurable base experience per job
-
Talented.VerbExperienceTypeDef
- Handles weapon and ability usage
- Can be tied to specific verb types
-
Talented.AbilityExperienceTypeDef
- Specialized handling for abilities
- Supports custom experience values per ability
Talent points are awarded based on configurable formulas:
<Talented.TalentPointFormulaDef>
<defName>StandardProgression</defName>
<pointsPerPeriod>2</pointsPerPeriod>
<levelPeriod>5</levelPeriod>
<talentPointWorkerClass>Talented.StandardTalentPointWorker</talentPointWorkerClass>
</Talented.TalentPointFormulaDef>
-
Points Per Period
- How many points are awarded each period
- Configurable through pointsPerPeriod
-
Level Period
- How many levels between point awards
- Set through levelPeriod
-
Custom Formulas
- Extensible through custom worker classes
- Can implement complex progression systems
Level progression can be customized through experience formulas:
<Talented.ExperienceFormulaDef>
<defName>LinearProgression</defName>
<baseExperience>100</baseExperience>
<experienceWorkerClass>Talented.LinearExperienceFormula</experienceWorkerClass>
</Talented.ExperienceFormulaDef>
-
Linear Formula
- Experience required increases linearly with level
- Configurable base experience amount
-
Custom Formulas
- Create custom progression curves
- Implement through Talented.ExperienceFormulaWorker class
The system can be extended through:
- Def Extensions
<ModExtensions>
<li Class="Talented.XPExtension">
<xpGain>10</xpGain>
<multiplierStat>ShootingAccuracyPawn</multiplierStat>
</li>
</ModExtensions>
- Event System
- Hooks into various game events
- Automatically tracks relevant actions
- Handles cleanup to prevent memory leaks
Here's a complete example that sets up experience gain for combat:
<Talented.TalentedGeneDef>
<defName>CombatTalent</defName>
<experienceGainSettings>
<experienceTypes>
<li Class="Talented.DamageExperienceTypeDef">
<baseXP>1.0</baseXP>
<damageFactor>0.15</damageFactor>
<multiplierStat>MeleeHitChance</multiplierStat>
</li>
<li Class="Talented.VerbExperienceTypeDef">
<baseXP>5.0</baseXP>
<VerbClassName>Verse.Verb_MeleeAttack</VerbClassName>
</li>
</experienceTypes>
</experienceGainSettings>
<experienceFormula>LinearProgression</experienceFormula>
<talentPointFormula>StandardProgression</talentPointFormula>
</Talented.TalentedGeneDef>