The Challenge
Design expressive NPCs that react differently to player behavior in a Y2K, humor-driven world. The AI had to feel dynamic and unpredictable without relying on complex behavior trees or heavy computation.
What I Built
Created a lightweight NPC AI system driven by contextual triggers and probability-based emotional reactions. Each NPC reacts differently to player actions, wandering, speaking, or shifting into states like scared or angry, using clean, reusable state logic tailored to the game’s surreal tone and comedic timing. The system remained performant and easy for the team to expand throughout development.
Technical Contributions
1. Probability-Based State Switching
Problem:
NPCs needed to react differently depending on what the player did, and reactions had to feel unpredictable but intentional.
Solution:
Created a probability-weighted selection system where each reaction has a defined chance range.
Result:
NPCs respond with a variety of emotional states based on player interaction, making encounters feel reactive and unique.
2. Idle State Implementation
Problem:
NPCs needed natural ambient behavior when not interacting with the player.
Solution:
Programmed an IDLE_State that wanders on timers and triggers random dialog lines.
Result:
NPCs feel alive and humorous through wandering and spontaneous dialog even without player involvement.
3. Modular State Logic
Problem:
Needed a clean way to organize all NPC reactions without hardcoding or clutter.
Solution:
Applied a project-specific version of the state machine pattern: each Broken Reality NPC holds its own state that manages behavior logic.
Result:
Designers and programmers could easily add new emotional states or contextual reactions without rewriting core logic.
Results & Impact
Supported 10+ unique NPC behaviors using clean, reusable code
Achieved dynamic emotional reactions aligned with the game’s surreal humor
Delivered context-sensitive and unpredictable NPC behavior
Improved clarity and maintainability for team members working with AI logic






