Add pluggable parser system, perception loop, and project infrastructure
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)
This commit is contained in:
1 parent
0f370ec089
commit
f85c27a742
42 files changed
+3490
-134
No files matched your search
@@ -0,0 +1,82 @@
|
||||
# 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)
|
||||
|
||||
- [x] **Telnet Client**: Basic connection and disconnection handling.
|
||||
- [x] **Configuration**: YAML-based config for credentials and server info.
|
||||
- [x] **Automatic Login**:
|
||||
- [x] Username/Password automtation.
|
||||
- [x] "Take over existing session" handling.
|
||||
- [x] **KeepAlive Manager**: Prevent idle disconnects.
|
||||
- [ ] **Logging**:
|
||||
- [x] Setup basic logging.
|
||||
- [ ] Implement strict `game.log` rotation and archiving structure.
|
||||
|
||||
## 🟡 Phase 2: Perception (Parsing & Sensing)
|
||||
|
||||
The bot needs to "see" the world effectively.
|
||||
|
||||
- [ ] **ANSI Parsing**:
|
||||
- [ ] Refine `ANSIParser` to fully strip color codes for logic but preserve them for UI if needed.
|
||||
- [ ] Detect prompt lines vs. content lines.
|
||||
- [ ] **Status Parsing (Vitals)**:
|
||||
- [ ] Implement regex to capture HP/MP/SP from prompt (e.g., `hp: 350/350`).
|
||||
- [ ] Update `GameState.character` with real-time stats.
|
||||
- [ ] **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 `inv` command parser.
|
||||
- [ ] Implement `eq` command parser.
|
||||
|
||||
## 🟠 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 `NetworkX` or SQLite for storing the world map.
|
||||
- [ ] Store nodes (Rooms) and edges (Exits).
|
||||
- [ ] **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`).
|
||||
- [ ] **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.
|
||||
Reference in new issue
Block a user