Mafia

LLM-Based Game

Mafia is an innovative social deduction game featuring one human player and six LLM-driven NPCs, all managed by an LLM Game Moderator. The game uses a structured Night/Day cycle where the LLM Moderator controls the flow, handling actions like role assignment, announcing killings, managing player discussions, and driving the final voting and elimination stages. The entire game loop is governed by an LLM-controlled state machine.

  • Made adaptable, modular parsing system capable of interpreting varied LLM output structures to accurately control game flow, manage state changes, and derive real-time game outcomes.
  • Developed the core game logic using a State Machine architecture, enabling the LLM Game Moderator to dynamically control the entire game flow, from role assignment and night phase actions to day discussions and final voting stages.
  • Built a robust conversation management system to seamlessly handle one-on-one dialogues and complex multi-party discussions, including logic for managing user interruptions during structured NPC interactions.
  • Implemented a complex character animation system combining IK controls for natural head-look behavior and an animation overriding system for context-specific hand pointing and gestures based on a character’s posture.