Phase 0 (housekeeping): - Add .gitignore to protect credentials and runtime files - Track all project source code, docs, and config Phase 1 (perception loop): - Implement pluggable parser architecture (BaseMudParser ABC + ParserFactory) - Add DeadSoulsParser with regex for HP/MP/SP prompt, room descriptions, exits (multiple formats), NPC/item detection, and combat events - Add OutputBuffer for accumulating text between prompts - Update GameState with SP support and update_from_prompt/room/combat methods - Rewire main loop to use parser + buffer for real-time game state updates - Add reconnection logic to TelnetClient (retry with backoff) - Remove old TextParser (replaced by pluggable system) - Add mud_type config field for selecting parser at runtime - Add comprehensive test suite (50 tests, all passing)
3.3 KiB
3.3 KiB
MUD AI Player - Implementation Roadmap
This document outlines the tasks required to build a complete, autonomous AI player for LPMUDs.
🟢 Phase 1: Core Connectivity & Basic Setup (Current Status)
- Telnet Client: Basic connection and disconnection handling.
- Configuration: YAML-based config for credentials and server info.
- Automatic Login:
- Username/Password automtation.
- "Take over existing session" handling.
- KeepAlive Manager: Prevent idle disconnects.
- Logging:
- Setup basic logging.
- Implement strict
game.logrotation and archiving structure.
🟡 Phase 2: Perception (Parsing & Sensing)
The bot needs to "see" the world effectively.
- ANSI Parsing:
- Refine
ANSIParserto fully strip color codes for logic but preserve them for UI if needed. - Detect prompt lines vs. content lines.
- Refine
- Status Parsing (Vitals):
- Implement regex to capture HP/MP/SP from prompt (e.g.,
hp: 350/350). - Update
GameState.characterwith real-time stats.
- Implement regex to capture HP/MP/SP from prompt (e.g.,
- Room Parsing (Vision):
- Identify Room Title (usually colored/bold).
- Identify Room Description (multiline text).
- Identify Exits (e.g.,
[ Exits: n s w ]). - Identify NPCs/Mobs/Items in the room.
- Inventory & Equipment:
- Implement
invcommand parser. - Implement
eqcommand parser.
- Implement
🟠 Phase 3: World Modeling (Mapping)
The bot needs to know where it is and where it has been.
- Room Hashing:
- Create unique hash for rooms based on Title + Description + Exits (to handle non-unique IDs).
- Graph Database:
- Integrate
NetworkXor SQLite for storing the world map. - Store nodes (Rooms) and edges (Exits).
- Integrate
- Pathfinding:
- Implement A* algorithm to find shortest path between known rooms.
- Implement "Breadth-First Search" (BFS) for exploration mode.
🔴 Phase 4: Decision Engine (The Brain)
The bot needs to decide what to do next.
- Action Queue System:
- Priority queue for actions (e.g.,
HEAL>ATTACK>LOOT>MOVE).
- Priority queue for actions (e.g.,
- Behavior Trees / State Machine:
- IdleState: Heal, Buff, Check Inventory.
- ExploreState: Pick unknown exit, Move.
- CombatState:
- Auto-target hostile mobs.
- Execute combat rotation (skills/spells).
- Flee trigger (if HP < Threshold).
- LootState: reliable looting of corpses.
- LLM Integration (Optional/Hybrid):
- Use LLM for "roleplay" responses to other players.
- Use LLM for "quest parsing" (understanding vague instructions).
🔵 Phase 5: Humanization
Make the bot undetectable and less robotic.
- Reaction Time Jitter:
- Randomize delays between commands (e.g., 200ms - 1500ms).
- Typo Generator:
- Occasionally misspell commands and correct them (optional).
- Schedule System:
- Define "active hours" and "sleep hours".
🟣 Phase 6: Testing & Metrics
- Unit Tests: Coverage for parsers (critical).
- Integration Tests: Mock MUD server for offline testing.
- Performance Profiling: Ensure graph traversal doesn't lag the bot.