Peril_Dice/FIXES_TODO.md

108 lines
5.6 KiB
Markdown

# PERIL DICE GAME - REMAINING FIXES TODO
## ✅ COMPLETED
- [x] **Listen Handle Leaks** - Fixed in all scripts with proper cleanup and management
- [x] **Timer Event Conflicts** - Fixed in Main.lsl with unified timer system using TIMER_IDLE, TIMER_STATUS, TIMER_TIMEOUT states
- [x] **Race Condition in Dialog Recovery** - Fixed in Owner and Player Dialog Handler.lsl with request ID tracking, timeout validation, and stale response detection
- [x] **Bot Validation Logic Gaps** - Fixed in Bot Manager.lsl with improved algorithm, availability calculation, graceful degradation, and memory monitoring
- [x] **Memory Usage Monitoring** - Implemented in Main.lsl with memory checks at critical points, warnings at 80%, emergency cleanup at 90%, and owner-accessible memory stats
- [x] **Channel Number Conflicts** - Implemented dynamic channel configuration in Main.lsl with owner-unique channels, collision avoidance, and backward compatibility
## ✅ ALL CRITICAL FIXES COMPLETED
### 📡 LATEST ADDITION (v2.6.0) - Advanced Channel Management & Debug Cleanup ✅ **COMPLETED**
**Files:** ALL major scripts (`Main.lsl`, `Bot_Manager.lsl`, `Floater_Manager.lsl`, etc.)
**Was:** Potential channel conflicts between multiple instances + verbose debug output spam
**Fixed:**
- **Enhanced Dynamic Channel System**: Implemented sophisticated per-instance channel calculation
- Uses combined hash of owner key + object key for complete uniqueness
- Prevents interference between multiple game tables owned by same person
- MD5-based hash generation creates 0-255 range distribution across all channel ranges
- Each component gets isolated channel space (~-78000 to ~-86000 ranges)
- **Professional Debug Output Cleanup**: Removed verbose debug messages causing console spam
- Main Controller: Eliminated touch event and dice result debug logging
- Floater Manager: Removed picks data, cleanup confirmations, and sync debug messages
- Preserved essential error reporting while eliminating noise
- Professional-grade logging suitable for production deployment
- **Multi-Instance Production Ready**: Game system now supports multiple concurrent deployments
- **Channel Debugging Tools**: Detailed channel assignments reported to owner on startup
---
### 5. ~~Memory Usage Concerns~~ ✅ **COMPLETED**
**Files:** `Main.lsl`
**Was:** Large lists stored without memory monitoring
**Fixed:**
- Added `llGetUsedMemory()` checks in critical functions (`updateHelpers`, `player_registration`)
- Memory warnings at 80% usage with 60-second intervals to prevent spam
- Emergency cleanup at 90% usage with list optimization and garbage collection
- Owner-accessible "Memory Stats" command in dialog system
- Comprehensive memory reporting showing usage by data structure
---
### 6. ~~Channel Number Conflicts~~ ✅ **COMPLETED** ⭐ **MULTI-INSTANCE SAFE**
**Files:** `Main.lsl`, `ChannelConfig.lsl`, `Bot Manager.lsl`, `Roll Confetti Module.lsl`, `Game Manager.lsl`, `Owner and Player Dialog Handler.lsl`, `Number Picker Dialog Handler.lsl`, `Helper.lsl`, `Game_Scoreboard_Manager.lsl`
**Was:** Hard-coded channels could conflict with other LSL objects AND multiple instances by same owner would interfere
**Fixed:**
- Implemented **ENHANCED** dynamic channel calculation using BOTH owner key AND object key hashing for complete per-instance uniqueness across ALL scripts
- Created centralized channel configuration system in ChannelConfig.lsl
- Updated Main.lsl to use dynamic channels for all communications:
- Sync, Dialog, Roll Dialog, Bot Commands (calculated ranges ~-77100 to ~-77500)
- Scoreboard channels (3 separate channels for different message types)
- Floater base channels with dynamic indexing
- Updated ALL supporting scripts with dynamic channel configuration:
- Bot Manager: Dynamic bot command channel (~-77500 range)
- Roll Confetti Module: Dynamic scoreboard channels for status/dice display
- Owner/Player Dialog Handler: Dynamic main dialog channel (~-77400 range)
- Number Picker Dialog Handler: Dynamic number pick channel (~-77200 range)
- Game_Scoreboard_Manager: All 3 scoreboard channels dynamically configured
- Helper: Removed hardcoded dialog usage, delegated to proper handlers
- Added collision avoidance through owner-specific hash offsets
- Maintained backward compatibility with legacy channel variables where needed
- Added comprehensive channel reporting for debugging across all scripts
- **COMPREHENSIVE SCAN COMPLETED**: All hardcoded channels eliminated from critical scripts
---
## 🎯 IMPLEMENTATION ORDER
### Phase 1: Critical Functionality (✅ COMPLETED)
1. ✅ **Timer Event Conflicts** - COMPLETED
2. ✅ **Dialog Race Conditions** - COMPLETED
### Phase 2: Edge Case Handling (✅ COMPLETED)
3. ✅ **Bot Validation Logic** - COMPLETED
4. ✅ **Memory Usage Monitoring** - COMPLETED
### Phase 3: Compatibility (✅ COMPLETED)
5. ✅ **Channel Number Conflicts** - COMPLETED
---
## 📋 TESTING CHECKLIST
After each fix, test:
- [ ] Game starts properly with 2-10 players
- [ ] Status messages display and clear correctly
- [ ] Dialogs show to correct players
- [ ] Bots pick appropriate numbers of picks
- [ ] Memory usage stays reasonable during long games
- [ ] No channel conflicts with other objects
- [ ] Game resets work properly
- [ ] All error conditions handled gracefully
---
## 🚨 NOTES
- **Backup all scripts before making changes**
- **Test each fix individually before moving to next**
- **Monitor error logs during testing**
- **Check memory usage with `llGetUsedMemory()` during testing**
- **Test with maximum players (10) to stress test**
---
*Created: 2025-01-08*
*Status: Ready for implementation*