How Gamification Design Makes AI Coding More Fun
How Gamification Design Makes AI Coding More Fun
Section titled “How Gamification Design Makes AI Coding More Fun”Traditional AI coding tools are actually quite powerful; they just lack a bit of warmth. When we were building HagiCode, we thought: if we are going to write code anyway, why not turn it into a game?
Background
Section titled “Background”Anyone who has used an AI coding assistant has probably had this experience: at first it feels fresh and exciting, but after a while it starts to feel like something is missing. The tool itself is powerful, capable of code generation, autocomplete, and Bug fixes, but… it does not feel very warm, and over time it can become monotonous and dull.
That alone is enough to make you wonder who wants to stare at a cold, impersonal tool every day.
It is a bit like playing a game. If all you do is finish a task list, with no character growth, no achievement unlocks, and no team coordination, it quickly stops being fun. Beautiful things and people do not need to be possessed to be appreciated; their beauty is enough on its own. Programming tools do not even offer that kind of beauty, so it is easy to lose heart.
We ran into exactly this problem while developing HagiCode. As a multi-AI assistant collaboration platform, HagiCode needs to keep users engaged over the long term. But in reality, even a great tool is hard to stick with if it lacks any emotional connection.
To solve this pain point, we made a bold decision: turn programming into a game. Not the superficial kind with a simple points leaderboard, but a true role-playing gamified experience. The impact of that decision may be even bigger than you imagine.
After all, people need a bit of ritual in their lives.
About HagiCode
Section titled “About HagiCode”The ideas shared in this article come from our practical experience on the HagiCode project. HagiCode is a multi-AI assistant collaboration platform that supports Claude Code, Codex, Copilot, OpenCode, and other AI assistants working together. If you are interested in multi-AI collaboration or gamified programming, visit github.com/HagiCode-org/site to learn more.
There is nothing especially mysterious about it. We simply turned programming into an adventure.
Why Choose Gamification
Section titled “Why Choose Gamification”The essence of gamification is not just “adding a leaderboard.” It is about building a complete incentive system so users can feel growth, achievement, and social recognition while doing tasks.
HagiCode’s gamification design revolves around one core idea: every AI assistant is a “Hero,” and the user is the captain of this Hero team. You lead these Heroes to conquer various “Dungeons” (programming tasks). Along the way, Heroes gain experience, level up, unlock abilities, and your team earns achievements as well.
This is not a gimmick. It is a design grounded in human behavioral psychology. When tasks are given meaning and progress feedback, people’s engagement and persistence increase significantly.
As the old saying goes, “This feeling can become a memory, though at the time it left us bewildered.” We bring that emotional experience into the tool, so programming is no longer just typing code, but a journey worth remembering.
Hero Character System
Section titled “Hero Character System”Hero is the core concept in HagiCode’s gamification system. Each Hero represents one AI assistant. For example, Claude Code is a Hero, and Codex is also a Hero.
The Three Hero Slots
Section titled “The Three Hero Slots”A Hero has three equipment slots, and the design is surprisingly elegant:
- CLI slot (main class): Determines the Hero’s base ability, such as whether it is Claude Code or Codex
- Model slot (secondary class): Determines which model is used, such as Claude 4.5 or Claude 4.6
- Style slot (style): Determines the Hero’s behavior style, such as “Fengluo Strategist” or another style
The combination of these three slots creates unique Hero configurations. Much like equipment builds in games, you choose the right setup based on the task. After all, what suits you best is what matters most. Life is similar: many roads lead to Rome, but some are smoother than others.
The Hero Growth System
Section titled “The Hero Growth System”Each Hero has its own XP and level:
type HeroProgressionSnapshot = { currentLevel: number; // Current level totalExperience: number; // Total experience currentLevelStartExperience: number; // Experience at the start of the current level nextLevelExperience: number; // Experience required for the next level experienceProgressPercent: number; // Progress percentage remainingExperienceToNextLevel: number; // Experience still needed for the next level lastExperienceGain: number; // Most recent experience gained lastExperienceGainAtUtc?: string | null; // Time when experience was gained};Levels are divided into four stages, and each stage has an immersive name:
export const resolveHeroProgressionStage = (level?: number | null): HeroProgressionStage => { const normalizedLevel = Math.max(1, level ?? 1); if (normalizedLevel <= 100) return 'rookieSprint'; // Rookie sprint if (normalizedLevel <= 300) return 'growthRun'; // Growth run if (normalizedLevel <= 700) return 'veteranClimb'; // Veteran climb return 'legendMarathon'; // Legend marathon};From “rookie” to “legend,” this growth path gives users a clear sense of direction and achievement. It mirrors personal growth in life, from confusion to maturity, only made more tangible here.
Creating a Custom Hero
Section titled “Creating a Custom Hero”To create a Hero, you need to configure three slots:
const heroDraft: HeroDraft = { name: 'Athena', icon: 'hero-avatar:storm-03', description: 'A brilliant strategist', executorType: AIProviderType.CLAUDE_CODE_CLI, slots: { cli: { id: 'profession-claude-code', parameters: { /* CLI-related parameters */ } }, model: { id: 'secondary-claude-4-sonnet', parameters: { /* Model-related parameters */ } }, style: { id: 'fengluo-strategist', parameters: { /* Style-related parameters */ } } }};Every Hero has a unique avatar, description, and professional identity, which gives what would otherwise be a cold AI assistant more personality and warmth. After all, who wants to work with a tool that has no character?
Dungeon System
Section titled “Dungeon System”A “Dungeon” is a classic game concept representing a challenge that requires a team to clear. In HagiCode, each workflow is a Dungeon.
How Dungeons Are Organized
Section titled “How Dungeons Are Organized”Dungeon organizes workflows into different “Dungeons”:
- Proposal generation dungeon: Responsible for generating technical proposals
- Proposal execution dungeon: Responsible for executing tasks in proposals
- Proposal archive dungeon: Responsible for organizing and archiving completed proposals
Each dungeon has its own Captain Hero, and the captain is automatically chosen as the first enabled Hero.
This is really just division of labor, like in everyday life, except turned into a game mechanic.
Team Collaboration Mechanism
Section titled “Team Collaboration Mechanism”You can configure different Hero squads for different dungeons:
const dungeonRoster: HeroDungeonRoster = { scriptKey: 'proposal.generate', displayName: 'Proposal Generation', members: [ { heroId: 'hero-1', name: 'Athena', executorType: 'ClaudeCode' }, { heroId: 'hero-2', name: 'Apollo', executorType: 'Codex' } ]};For example, you can use Athena for generating proposals because it is good at strategy, and Apollo for implementing code because it is good at execution. That way, every Hero can play to its strengths. It is like forming a band: each person has an instrument, and together they create something beautiful.
Dungeon Flow Control
Section titled “Dungeon Flow Control”Dungeon uses fixed scriptKey values to identify different workflows:
// Script keys map to different workflowsconst dungeonScripts = { 'proposal.generate': 'Proposal Generation', 'proposal.execute': 'Proposal Execution', 'proposal.archive': 'Proposal Archive'};The task state flow is: queued (waiting) -> dispatching (being assigned) -> dispatched (assigned). The whole process is automated and requires no manual intervention. That is also part of our lazy side, because who wants to manage this stuff by hand?
XP and Level System
Section titled “XP and Level System”XP is the core feedback mechanism in the gamification system. Users gain XP by completing tasks, XP levels up Heroes, and leveling up unlocks new abilities, forming a positive feedback loop.
Ways to Gain XP
Section titled “Ways to Gain XP”In HagiCode, XP can be earned through the following activities:
- Completing code execution
- Successfully calling tools
- Generating proposals
- Session management operations
- Project operations
Every time a valid action is completed, the corresponding Hero gains XP. Just like growth in life, every step counts, only here that growth is quantified.
Real-Time Progress Visualization
Section titled “Real-Time Progress Visualization”XP and level progress are visualized in real time:
type HeroDungeonMember = { heroId: string; name: string; icon?: string | null; executorType: PCode_Models_AIProviderType; currentLevel?: number; // Current level totalExperience?: number; // Total experience experienceProgressPercent?: number; // Progress percentage};Users can always see each Hero’s level and progress, and that immediate feedback is the key to gamification design. People need feedback, otherwise how would they know they are improving?
Achievement System
Section titled “Achievement System”Achievements are another important element in gamification. They provide long-term goals and milestone-driven satisfaction.
Achievement Types
Section titled “Achievement Types”HagiCode supports multiple types of achievements:
- Code generation achievements: Generate X lines of code, generate Y files
- Session management achievements: Complete Z conversations
- Project operation achievements: Work across W projects
These achievements are really like milestones in life, except we have turned them into a game mechanic.
Achievement States
Section titled “Achievement States”Achievements have three states:
type AchievementStatus = 'unlocked' | 'in-progress' | 'locked';The three states have clear visual distinctions:
- Unlocked: Gold gradient with a halo effect
- In progress: Blue pulse animation
- Locked: Gray, with unlock conditions shown
Each achievement clearly displays its trigger condition, so users know what to do next. When people feel lost, a little guidance always helps.
Celebration Effect on Unlock
Section titled “Celebration Effect on Unlock”When an achievement is unlocked, a celebration animation is triggered. That kind of positive reinforcement gives users the satisfying feeling of “I did it” and motivates them to keep going. Small rewards in life work the same way: they may be small, but the happiness can last a long time.
Battle Report Daily Combat Report
Section titled “Battle Report Daily Combat Report”Battle Report is one of HagiCode’s signature features. At the end of each day, it generates a full-screen battle-style report.
Report Content
Section titled “Report Content”Battle Report displays the following information:
type HeroBattleReport = { reportDate: string; summary: { totalHeroCount: number; // Total number of Heroes activeHeroCount: number; // Number of active Heroes totalBattleScore: number; // Total battle score mvp: HeroBattleHero; // Most valuable Hero }; heroes: HeroBattleHero[]; // Detailed data for all Heroes};- Total team score
- Number of active Heroes
- Number of tool calls
- Total working time
- MVP (Most Valuable Hero)
- Detailed card for each Hero
MVP Highlight Display
Section titled “MVP Highlight Display”The MVP is the best-performing Hero of the day and is highlighted in the report. This is not just data statistics, but a form of honor and recognition. After all, who does not want to be recognized?
Detailed Hero Cards
Section titled “Detailed Hero Cards”Each Hero card includes:
- Level progress
- XP gained
- Number of executions
- Usage time
These metrics help users clearly understand how the team is performing. Seeing the results of your own effort is satisfying in itself.
Technical Implementation
Section titled “Technical Implementation”HagiCode’s gamification system uses a modern technology stack and design patterns. There is nothing especially magical about it; we just chose tools that fit the job.
Technology Stack Choices
Section titled “Technology Stack Choices”// React + TypeScript for the frontendimport React from 'react';
// Framer Motion for animationsimport { AnimatePresence, motion } from 'framer-motion';
// Redux Toolkit for state managementimport { useAppDispatch, useAppSelector } from '@/store';
// shadcn/ui for UI componentsimport { Dialog, DialogContent } from '@/components/ui/dialog';Framer Motion handles all animation effects, shadcn/ui provides the foundational UI components, and Redux Toolkit manages the complex gamification state. Good tools make good work.
Gamified UI Design System
Section titled “Gamified UI Design System”HagiCode uses a Glassmorphism + Tech Dark design style:
/* Primary gradient */background: linear-gradient(135deg, #22C55E 0%, #25c2a0 50%, #06b6d4 100%);
/* Glass effect */backdrop-filter: blur(12px);
/* Glow effect */background: radial-gradient(circle at center, rgba(34, 197, 94, 0.15) 0%, transparent 70%);The green gradient combined with glassmorphism creates a technical, futuristic atmosphere. Visual beauty is part of the user experience too.
Animation Effects
Section titled “Animation Effects”Framer Motion is used to create smooth entrance animations:
<motion.div animate={{ opacity: 1, y: 0 }} initial={{ opacity: 0, y: 18 }} transition={{ duration: 0.35, ease: 'easeOut', delay: index * 0.08 }} className="card"> {/* Card content */}</motion.div>Each card enters one after another with a delay of 0.08 seconds, creating a fluid visual effect. Smooth animation improves the experience. That part is hard to argue with.
Data Persistence
Section titled “Data Persistence”Gamification data is stored using the Grain storage system to ensure state consistency. Even fine-grained data like accumulated Hero XP can be persisted accurately. No one wants to lose the experience they worked hard to earn.
Practical Guide
Section titled “Practical Guide”Create Your First Hero
Section titled “Create Your First Hero”Creating your first Hero is actually quite simple:
- Go to the Hero management page
- Click the “Create Hero” button
- Configure the three slots (CLI, Model, Style)
- Give the Hero a name and description
- Save it, and your first Hero is born
It is like meeting a new friend: you give them a name, learn what makes them special, and then head off on an adventure together.
Build a Dungeon Team
Section titled “Build a Dungeon Team”Building a team is also simple:
- Go to the Dungeon management page
- Choose the dungeon you want to configure, such as “Proposal Generation”
- Select members from your Hero list
- The system automatically selects the first enabled Hero as Captain
- Save the configuration
This is simply the process of forming a team, much like building a team in real life where everyone has their own role.
View the Daily Report
Section titled “View the Daily Report”At the end of each day, you can view the day’s Battle Report:
- Click the “Battle Report” button
- View the day’s work results in a full-screen display
- Check the MVP and the detailed data for each Hero
- Share it with team members if you want
This is also a kind of ritual, a way to see how much effort you put in today and how far you still are from your goal.
Notes and Best Practices
Section titled “Notes and Best Practices”Performance Optimization
Section titled “Performance Optimization”Use React.memo to avoid unnecessary re-renders:
const HeroCard = React.memo(({ hero }: { hero: HeroDungeonMember }) => { // Component implementation});Performance matters too. No one wants to use a laggy tool.
Motion Can Degrade Gracefully
Section titled “Motion Can Degrade Gracefully”Detect the user’s motion preference settings and provide a simplified experience for motion-sensitive users:
const prefersReducedMotion = useReducedMotion();const duration = prefersReducedMotion ? 0 : 0.35;Not everyone likes animation, and respecting user preferences is part of good design.
Backward Compatibility
Section titled “Backward Compatibility”Keep legacyIds to support migration from older versions:
type HeroDungeonMember = { heroId: string; legacyIds?: string[]; // Supports legacy ID mapping // ...};No one wants to lose data just because of a version upgrade.
Internationalization Support
Section titled “Internationalization Support”Use i18n translation keys for all text to make multi-language support easy:
const displayName = t(`dungeon.${scriptKey}`, { defaultValue: displayName });Language should never be a barrier to using the product.
Summary
Section titled “Summary”Gamification is not just a simple points leaderboard, but a complete incentive system. Through the Hero system, Dungeon system, XP and level system, achievement system, and Battle Report, HagiCode transforms programming work into a heroic journey full of adventure.
The core value of this system lies in:
- Emotional connection: Giving cold AI assistants personality
- Positive feedback: Every action produces immediate feedback
- Long-term goals: Levels and achievements provide a growth path
- Team identity: A sense of collaboration within Dungeon teams
- Honor and recognition: Battle Report and MVP showcases
Gamification design makes programming no longer dull, but an interesting adventure. While completing coding tasks, users also experience the fun of character growth, team collaboration, and achievement unlocking, which improves retention and activity.
At its core, programming is already an act of creation. We just made the creative process a little more fun.
If this article helped you:
- Leave a like so more people can discover it
- Give us a Star on GitHub: github.com/HagiCode-org/site
- Visit the official site to learn more: hagicode.com
- Watch the 30-minute hands-on demo: www.bilibili.com/video/BV1pirZBuEzq/
- Install with one click and try it: docs.hagicode.com/installation/docker-compose
- Quick install for Desktop: hagicode.com/desktop/
- Public beta has started, and you are welcome to install and try it
References
Section titled “References”- HagiCode official documentation
- Framer Motion animation library
- shadcn/ui component library
- Redux Toolkit state management
Thank you for reading. If you found this article useful, please click the like button below so more people can discover it.
This content was created with AI-assisted collaboration, reviewed by me, and reflects my own views and position.
- Author: newbe36524
- Article link: https://docs.hagicode.com/blog/2026-03-16-gamifying-ai-coding/
- Copyright notice: Unless otherwise stated, all articles on this blog are licensed under BY-NC-SA. All rights reserved!