# Character Evolution

This example models a character who evolves through multiple life stages, demonstrating how life arcs, behavior trees, and templates work together to represent growth over time.

## The Apprentice's Journey

Elena starts as a nervous apprentice and grows into a confident master baker. Her evolution touches every aspect of her character: skills, personality, relationships, and daily routine.

### Schema

```storybook
enum SkillLevel { novice, beginner, intermediate, advanced, expert, master }

enum Confidence { timid, uncertain, growing, steady, confident, commanding }

template Apprentice {
    skill_level: novice
    confidence: timid
    can_work_independently: false
    recipes_mastered: 0..5
}

template Journeyman {
    skill_level: intermediate
    confidence: growing
    can_work_independently: true
    recipes_mastered: 10..30
}

template MasterBaker {
    skill_level: master
    confidence: commanding
    can_work_independently: true
    can_teach: true
    recipes_mastered: 50..200
}
```

### The Character at Different Stages

```storybook
// Elena starts as an apprentice
character Elena: Human from Apprentice {
    age: 16
    natural_talent: 0.8
    dedication: 0.9
    recipes_mastered: 2
    confidence: timid
    mentor: Martha

    ---backstory
    Elena comes from a family of farmers who could never afford to
    buy bread from the bakery. When Martha offered her an apprenticeship,
    she jumped at the chance to learn a trade.
    ---
}
```

### The Evolution Life Arc

```storybook
life_arc ElenaCareer {
    ---description
    Tracks Elena's progression from nervous apprentice to
    confident master baker over several years.
    ---

    state apprentice_early {
        on enter {
            Elena.skill_level: novice
            Elena.confidence: timid
            Elena.can_work_independently: false
        }

        on recipes_mastered > 5 -> apprentice_growing

        ---narrative
        Elena's hands shake as she measures flour. She checks the
        recipe three times before adding each ingredient. Martha
        patiently corrects her technique.
        ---
    }

    state apprentice_growing {
        on enter {
            Elena.skill_level: beginner
            Elena.confidence: uncertain
        }

        on recipes_mastered > 15 -> journeyman

        ---narrative
        The shaking stops. Elena can make basic breads without
        looking at the recipe. She still doubts herself but
        Martha's encouragement is taking root.
        ---
    }

    state journeyman {
        on enter {
            Elena.skill_level: intermediate
            Elena.confidence: growing
            Elena.can_work_independently: true
        }

        on recipes_mastered > 30 and confidence is steady -> senior_journeyman

        ---narrative
        Elena runs the morning shift alone while Martha handles
        special orders. Customers start asking for "Elena's rolls."
        She begins experimenting with her own recipes.
        ---
    }

    state senior_journeyman {
        on enter {
            Elena.skill_level: advanced
            Elena.confidence: steady
        }

        on recipes_mastered > 50 and passed_master_trial -> master

        ---narrative
        Elena develops her signature recipe: rosemary olive bread
        that becomes the bakery's bestseller. She handles difficult
        customers with grace and trains new helpers.
        ---
    }

    state master {
        on enter {
            Elena.skill_level: master
            Elena.confidence: commanding
            Elena.can_teach: true
        }

        ---narrative
        Master Baker Elena. She has earned it. The guild acknowledges
        her mastery, and Martha beams with pride. Elena begins
        mentoring her own apprentice.
        ---
    }
}
```

### Evolving Behaviors

Elena's behavior changes as she progresses:

```storybook
// Early apprentice: hesitant, checks everything
behavior Elena_ApprenticeEarly {
    then cautious_baking {
        CheckRecipeThreeTimes
        MeasureCarefully
        AskMarthaForConfirmation
        ProceedSlowly
        CheckResultAnxiously
    }
}

// Growing apprentice: more confident
behavior Elena_ApprenticeGrowing {
    then competent_baking {
        ReviewRecipe
        MeasureIngredients
        MixWithConfidence
        choose problem_handling {
            then handle_alone {
                if(confidence > 0.4)
                AssessSituation
                ApplyLearning
            }
            AskMarthaForHelp
        }
    }
}

// Journeyman: independent and creative
behavior Elena_Journeyman {
    choose work_mode {
        then creative_mode {
            if(inspiration_high)
            ExperimentWithRecipe
            TasteTest
            if(result_good) {
                RecordNewRecipe
            }
        }

        then production_mode {
            ExecuteRecipeFromMemory
            MonitorOvenTimings
            ManageMultipleBatches
        }

        then teaching_mode {
            if(helper_present)
            DemonstrateTeechnique
            ObserveHelper
            ProvideGentleFeedback
        }
    }
}

// Master: leadership and mentoring
behavior Elena_Master {
    choose master_activity {
        then mentor_apprentice {
            if(apprentice_needs_guidance)
            AssessApprenticeProgress
            DesignLearningChallenge
            ObserveAndFeedback
        }

        then innovate {
            if(creative_energy_high)
            ResearchNewTechniques
            ExperimentWithIngredients
            DocumentFindings
        }

        then lead_production {
            PlanDailyProduction
            DelegateToTeam
            QualityCheckResults
        }
    }
}
```

### Evolving Relationships

The mentor relationship changes as Elena grows:

```storybook
// Early apprenticeship
relationship EarlyMentorship {
    Martha as mentor self {
        patience: 0.9
        teaching_intensity: 0.8
    } other {
        sees_potential: 0.8
        reminds_her_of_herself: true
    }

    Elena as apprentice self {
        gratitude: 1.0
        anxiety: 0.7
    } other {
        admiration: 0.95
        intimidated: 0.5
    }

    bond: 0.6
}

// Later: colleagues and friends
relationship MaturePartnership {
    Martha as senior_partner self {
        pride_in_elena: 0.95
        ready_to_step_back: 0.6
    } other {
        sees_equal: 0.8
        trusts_judgment: 0.9
    }

    Elena as junior_partner self {
        confidence: 0.85
        gratitude: 0.9
    } other {
        respect: 0.95
        sees_as_mother_figure: 0.7
    }

    bond: 0.95
}
```

### Evolving Schedules

Elena's schedule changes as she takes on more responsibility:

```storybook
// Apprentice schedule: supervised hours
schedule ElenaApprentice {
    block arrive {
        06:00 - 06:15
        action: routines::arrive_early
    }

    block learn_and_assist {
        06:15 - 14:00
        action: baking::assist_martha
    }

    block cleanup_duty {
        14:00 - 15:00
        action: shop::cleanup
    }

    block study {
        15:00 - 16:00
        action: learning::study_recipes
    }
}

// Master schedule: leadership hours
schedule ElenaMaster modifies ElenaApprentice {
    block arrive {
        04:00 - 04:15
        action: routines::open_bakery
    }

    block learn_and_assist {
        04:15 - 12:00
        action: baking::lead_production
    }

    block cleanup_duty {
        12:00 - 13:00
        action: social::lunch_with_team
    }

    block study {
        13:00 - 15:00
        action: baking::mentor_apprentice
    }

    block business {
        15:00 - 17:00
        action: management::business_planning
    }
}
```

## Key Takeaways

This example demonstrates:

1. **Life arcs as character development**: Elena's career progression modeled as states
2. **Evolving behaviors**: Different behavior trees for each stage of growth
3. **Changing relationships**: The mentor dynamic shifts from dependency to partnership
4. **Schedule evolution**: Responsibilities grow with skill level
5. **Narrative prose**: Each life arc state tells a story about who Elena is becoming
6. **Template progression**: Templates define the capability profile at each stage

## Cross-References

- [Life Arcs Reference](../reference/13-life-arcs.md) - State machine syntax
- [Design Patterns](../advanced/20-patterns.md) - Progressive development pattern
- [Best Practices](../advanced/23-best-practices.md) - Character design guidelines
