I've created a complete AI agent spawning system for your MazeWalker game with the following:
Assets/Scripts/):Initial Agent Count (default: 10)Initial Agent Count to 10Agent Manager field✅ Configurable spawn count (default: 10) ✅ Can spawn more agents during gameplay ✅ Agents spawn in the start room ✅ Limited knowledge (only know current room + visited rooms by character type) ✅ Smart pathfinding to goal ✅ Shared memory between agents of same type ✅ Visual path debugging (yellow lines showing paths) ✅ Automatic reset when generating new maze
If you attach AIAgentExampleSetup.cs to a GameObject in your scene:
The system is built to be extended with:
Assets/Scripts/
├── AIAgent.cs // Individual agent behavior
├── AIAgentManager.cs // Spawn/track agents
├── AIRoomMemory.cs // Shared room knowledge
├── AIAgentUIDisplay.cs // Optional UI
├── AIAgentExampleSetup.cs // Example setup helper
├── MazeController.cs // Updated with agent support
└── ... (other maze scripts)
Root/
├── AI_AGENT_SETUP_GUIDE.md // Comprehensive documentation
└── MAZE_SETUP_GUIDE.md // Existing maze guide
AI Agents section:
- Spawn AI Agents: ✓ (checked)
- Initial Agent Count: 10
- Agent Character Type: "Default"
- Spawn Delay: 0.1
Agent Spawning:
- Initial Agent Count: 10
- Agent Character Type: "Default"
- Spawn Delay: 0.1
Agent Prefab: (leave empty - auto-creates)
Visual Settings:
- Show Agent Paths: ✓ (checked)
- Agent Path Color: Yellow
Agents not appearing?
spawnAIAgents is enabled on MazeControllerAgents not moving?
movementSpeed > 0Performance issues?
pathUpdateInterval (0.5s → 1.0s)showAgentPaths in inspectorMazeController maze = FindFirstObjectByType<MazeController>();
AIAgentManager manager = maze.GetAgentManager();
manager.SpawnAgent(); // Spawn 1
manager.SpawnAgents(5); // Spawn 5
int agentCount = manager.GetAgentCount();
string stats = manager.GetAgentStats();
Debug.Log(stats); // Shows exploration progress
List<AIAgent> agents = manager.GetActiveAgents();
foreach (var agent in agents)
{
Debug.Log($"Agent {agent.AgentId} in room {agent.CurrentRoom}");
Debug.Log($"Explored {agent.RoomMemory.VisitedCount} rooms");
}
Everything is ready to go! Just hit play and watch your agents explore the maze. 🎮
For more details, see AI_AGENT_SETUP_GUIDE.md.