Experience System - Grim-/Talented GitHub Wiki

Experience and Talent Point System

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 Gain

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>

Experience Sources

  1. Combat Actions

    • Dealing damage
    • Taking damage
    • Using weapons (verbs)
  2. Skill Usage

    • Gaining vanilla skill experience
    • Completing jobs
    • Using abilities
  3. Ability Usage

    • Custom XP gain per ability
    • Supports stat-based multipliers

Experience Types

The system includes several specialized experience type definitions:

  1. Talented.DamageExperienceTypeDef

    • Handles combat-related experience
    • Configurable damage-to-experience ratio
    • Supports both dealing and taking damage
  2. Talented.SkillExperienceTypeDef

    • Links to vanilla RimWorld skills
    • Converts skill experience gains to talent experience
  3. Talented.JobExperienceTypeDef

    • Rewards completing specific jobs
    • Configurable base experience per job
  4. Talented.VerbExperienceTypeDef

    • Handles weapon and ability usage
    • Can be tied to specific verb types
  5. Talented.AbilityExperienceTypeDef

    • Specialized handling for abilities
    • Supports custom experience values per ability

Talent Points

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>

Configuration Options

  1. Points Per Period

    • How many points are awarded each period
    • Configurable through pointsPerPeriod
  2. Level Period

    • How many levels between point awards
    • Set through levelPeriod
  3. Custom Formulas

    • Extensible through custom worker classes
    • Can implement complex progression systems

Experience Formulas

Level progression can be customized through experience formulas:

<Talented.ExperienceFormulaDef>
    <defName>LinearProgression</defName>
    <baseExperience>100</baseExperience>
    <experienceWorkerClass>Talented.LinearExperienceFormula</experienceWorkerClass>
</Talented.ExperienceFormulaDef>

Available Formula Types

  1. Linear Formula

    • Experience required increases linearly with level
    • Configurable base experience amount
  2. Custom Formulas

    • Create custom progression curves
    • Implement through Talented.ExperienceFormulaWorker class

Integration System

The system can be extended through:

  1. Def Extensions
<ModExtensions>
    <li Class="Talented.XPExtension">
        <xpGain>10</xpGain>
        <multiplierStat>ShootingAccuracyPawn</multiplierStat>
    </li>
</ModExtensions>
  1. Event System
    • Hooks into various game events
    • Automatically tracks relevant actions
    • Handles cleanup to prevent memory leaks

Example Configuration

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>
⚠️ **GitHub.com Fallback** ⚠️