AGENT_PERSONALIZATION_SETUP.md 4.1 KB

Agent Personalization System Setup

A complete personalization system for agents with randomized names, stats, and clickable info panels.

Files Created

Scripts

  1. AgentNameGenerator.cs - Generates random names (mix of silly, real, and fantasy)
  2. AgentStats.cs - Agent stats system (Strength, Speed, Magic, Dexterity)
  3. AgentInfoPanel.cs - UI controller for agent info popup
  4. AIAgent.cs (modified) - Added name, stats, and click detection

UI

  1. AgentInfoPanel.uxml - Info panel layout
  2. AgentInfoPanel.uss - Info panel styling

Setup Instructions

Step 1: Ensure Agents Have Colliders

Agents need a collider for click detection. Verify in AIAgentManager.CreateDefaultAgentPrefab() that agents have:

  • ✓ SphereCollider (or BoxCollider/CapsuleCollider)
  • ✓ Mesh renderer for visibility

Step 2: Create Agent Info Panel

  1. Create a new GameObject called "AgentInfoPanel"
  2. Add UIDocument component
  3. Set Panel Asset to AgentInfoPanel.uxml
  4. Add AgentInfoPanel.cs script to the same GameObject
  5. The script will auto-find and setup everything

Step 3: (Optional) Create Main UIDocument

If you don't already have one:

  1. Create GameObject "MainUI"
  2. Add UIDocument component
  3. Assign AgentStatsPanel.uxml as Panel Asset
  4. Add AgentStatsUIController script

Features

Agent Names

  • Randomly generated on spawn
  • Mix of silly names (Bobo, Zippy), real names (Alex, Sam), and fantasy names (Aragorn, Merlin)
  • Format: "FirstName LastName"
  • Visible in hierarchy as: "Agent_0 (Bobo McWiggle)"

Agent Stats

  • Strength: Physical power
  • Speed: Movement speed
  • Magic: Magical ability
  • Dexterity: Agility and precision
  • Each stat: 1-100
  • Total pool: 40 points (so stats are relatively balanced)
  • Generated randomly on spawn with normalization

Clickable Agents

  • Click any agent in the maze
  • Shows info panel with:
    • Agent name
    • All stats with progress bars
    • Total stats
    • Current status (Exploring or Reached Exit)
  • Click close button or outside panel to dismiss
  • Panel appears on right side of screen

How It Works

Name Generation

string name = AgentNameGenerator.GenerateRandomName();
// Result: "Legolas Windrunner", "Bobo Fizzlebop", "Jordan Darkbringer", etc.

Stats Creation

AgentStats stats = new AgentStats();
Debug.Log(stats); // STR: 8 | SPD: 12 | MAG: 10 | DEX: 10 | Total: 40

Click Detection

  • AIAgent has OnMouseDown() which calls AgentInfoPanel.ShowAgentInfo()
  • Requires collider on agent GameObject
  • Works with raycasting automatically

Customization

Add More Names

Edit AgentNameGenerator.cs:

private static readonly string[] FirstNames = new[]
{
    // Add your names here
    "CustomName",
    // ...
};

Change Stats Pool

Edit AgentStats.cs:

private const int STAT_TOTAL_POOL = 40; // Change this value

Change Info Panel Position

Edit AgentInfoPanel.uss:

.info-panel-container {
    right: 20px;  /* Change position */
    top: 100px;
}

Add More Stats

  1. Add property to AgentStats.cs
  2. Add stat item to AgentInfoPanel.uxml
  3. Add styling to AgentInfoPanel.uss
  4. Update AgentInfoPanel.cs DisplayAgentInfo method

Troubleshooting

Agents not clickable:

  • Verify colliders are on agent GameObjects
  • Check console for "OnMouseDown" debug messages
  • Make sure agent GameObject is active

Info panel not showing:

  • Verify UIDocument is assigned AgentInfoPanel.uxml
  • Check console for errors in AgentInfoPanel.cs
  • Ensure AgentInfoPanel GameObject is active

Names not showing:

  • Verify AgentNameGenerator.cs exists in Scripts folder
  • Check console for name generation errors
  • Confirm agents are spawning

Stats all zero:

  • Ensure AgentStats.cs is in Scripts folder
  • Verify AIAgent initializes agentStats in Start()
  • Check console for stat generation errors

Next Steps

  • Add agent color coding by stats (e.g., red for high strength)
  • Add animations when stats are displayed
  • Add stat history/progression tracking
  • Add agent trading or stat modification mechanics
  • Add visual indicators on agents (badges for high stats)