All notable changes to Peril Dice will be documented in this file. ## [2.1.0] - 2025-01-08 ### ✨ Major Features Added - **Ready State System**: Players must mark themselves ready before games can start - **Game Protection**: Prevents players from joining games in progress - **Performance Optimization**: Reduced lag by limiting confetti to wins only - **Enhanced Bot Intelligence**: Improved bot behavior and duplicate number avoidance ### 🔧 Core Fixes - **Complete Game Flow**: Fixed end-to-end gameplay from start to finish - **Elimination Logic**: Proper handling of player elimination and game continuation - **Win Condition**: Fixed victory detection and game ending - **Data Synchronization**: Resolved corruption in pick data between scripts - **Peril Player Assignment**: Fixed race conditions in peril player transitions ### 🎮 Gameplay Improvements - **Dynamic Picking**: Number of picks now properly based on peril player's lives - **Duplicate Prevention**: Enhanced system to prevent duplicate number selection - **Dialog Pagination**: Improved number selection interface for d30 dice - **Floater Updates**: Real-time HUD updates throughout gameplay - **Bot Continuation**: Bots now properly continue games when humans are eliminated ### 🛠️ Technical Enhancements - **Modular Communication**: Improved inter-script messaging system - **Error Handling**: Comprehensive validation and error recovery - **Memory Management**: Better floater cleanup and channel tracking - **Data Encoding**: Fixed CSV conflicts with semicolon encoding system - **State Management**: Robust game state synchronization across modules ### 🐛 Bug Fixes - Fixed missing pick dialogs after game events - Resolved duplicate message issues between scripts - Fixed lives reset problems between rounds - Corrected floater display inconsistencies - Fixed bot confusion during player elimination - Resolved pick data corruption issues - Fixed peril player variable sync problems ### ⚡ Performance - Removed confetti from life loss (keeping only victory confetti) - Optimized debug output to reduce lag - Improved floater management efficiency - Enhanced bot processing speed ## [2.0.0] - 2024-12-XX ### 🎉 Initial Modular Release - **Modular Architecture**: Separated functionality into specialized scripts - **Bot System**: Added AI players for testing and gameplay variety - **Floating HUD**: Real-time player statistics display - **Dynamic Dice**: Automatic dice sizing based on player count - **Player Management**: Runtime player joining and leaving - **Owner Controls**: Administrative functions for game management ### 🎲 Core Game Features - **Pick System**: Number selection with validation - **Rolling Mechanism**: Automated dice rolling with visual effects - **Life Management**: 3-life system with elimination - **Peril Tracking**: Dynamic peril player assignment - **Victory Conditions**: Last player standing wins ### 🏗️ Architecture - **Main Controller**: Central game logic and state management - **Dialog Handlers**: User interface and input processing - **Roll Module**: Dice mechanics and particle effects - **Bot Manager**: AI player behavior and automation - **Floater Manager**: HUD display coordination - **Game Helpers**: Utility functions and calculations ## [1.0.0] - 2024-XX-XX ### 🌟 Original Release - Basic Peril Dice game implementation - Manual gameplay mechanics - Simple player tracking - Basic dice rolling functionality --- ## Development Notes ### Known Issues - **Bot Race Condition**: Bots may occasionally pick duplicate numbers when triggered simultaneously - **Debug Output**: Extended games may experience minor lag from comprehensive logging ### Future Enhancements - Serialized bot picking to eliminate race conditions - Configurable debug levels - Additional game modes and variants - Enhanced visual effects and animations ### Credits - **Original Game Design**: Noose the Bunny (djmusica28) - Second Life - **Automation & Development**: Enhanced for automated gameplay - **Architecture**: Modular LSL system for scalability and maintainability
101 lines
3.5 KiB
Text
101 lines
3.5 KiB
Text
integer MSG_SYNC_GAME_STATE = 107;
|
|
|
|
list validatePicksData(list picksData, list names) {
|
|
list allPicksFlat = [];
|
|
integer i;
|
|
|
|
for (i = 0; i < llGetListLength(picksData); i++) {
|
|
string entry = llList2String(picksData, i);
|
|
list parts = llParseString2List(entry, ["|"], []);
|
|
|
|
if (llGetListLength(parts) == 2) {
|
|
string name = llList2String(parts, 0);
|
|
string picks = llList2String(parts, 1);
|
|
list pickNums = llParseString2List(picks, [","], []);
|
|
|
|
// Check if name is in names list
|
|
if (names != [] && llListFindList(names, [name]) == -1) {
|
|
llOwnerSay("⚠️ picksData name not in names list: " + name);
|
|
}
|
|
|
|
// Check for duplicate picks in this player's list
|
|
integer j;
|
|
list uniqueCheck = [];
|
|
for (j = 0; j < llGetListLength(pickNums); j++) {
|
|
string pick = llList2String(pickNums, j);
|
|
if ((string)((float)pick) != pick) {
|
|
llOwnerSay("⚠️ Invalid number in picks for " + name + ": '" + pick + "'");
|
|
}
|
|
if (~llListFindList(uniqueCheck, [pick])) {
|
|
llOwnerSay("🚨 Duplicate pick in " + name + "'s picks: " + pick);
|
|
} else {
|
|
uniqueCheck += [pick];
|
|
}
|
|
allPicksFlat += [pick];
|
|
}
|
|
|
|
// Only show picks if player has actually picked something
|
|
if (picks != "") {
|
|
llOwnerSay("✅ " + name + "'s picks: " + llList2CSV(pickNums));
|
|
}
|
|
} else if (entry != "") {
|
|
// Only warn about non-empty malformed entries
|
|
llOwnerSay("⚠️ Malformed entry in picksData: " + entry);
|
|
}
|
|
}
|
|
|
|
// Check for duplicate picks across all players
|
|
list seen = [];
|
|
integer k;
|
|
for (k = 0; k < llGetListLength(allPicksFlat); k++) {
|
|
string val = llList2String(allPicksFlat, k);
|
|
if (~llListFindList(seen, [val])) {
|
|
llOwnerSay("❌ Duplicate pick across players: " + val);
|
|
} else {
|
|
seen += [val];
|
|
}
|
|
}
|
|
|
|
return picksData;
|
|
}
|
|
|
|
|
|
|
|
default {
|
|
state_entry() {
|
|
llOwnerSay("🔍 Debugger ready!");
|
|
}
|
|
|
|
link_message(integer sender, integer num, string str, key id) {
|
|
if (num == MSG_SYNC_GAME_STATE) {
|
|
list parts = llParseString2List(str, ["~"], []);
|
|
if (llGetListLength(parts) < 4) {
|
|
llOwnerSay("⚠️ Incomplete game state received.");
|
|
return;
|
|
}
|
|
|
|
list lives = llCSV2List(llList2String(parts, 0));
|
|
list picksData = llCSV2List(llList2String(parts, 1));
|
|
string perilPlayer = llList2String(parts, 2);
|
|
list names = llCSV2List(llList2String(parts, 3));
|
|
|
|
// Only show checking message if there's actual picks data to validate
|
|
integer hasPicksData = FALSE;
|
|
integer i;
|
|
for (i = 0; i < llGetListLength(picksData); i++) {
|
|
string entry = llList2String(picksData, i);
|
|
list parts = llParseString2List(entry, ["|"], []);
|
|
if (llGetListLength(parts) == 2 && llList2String(parts, 1) != "") {
|
|
hasPicksData = TRUE;
|
|
jump skipCheck;
|
|
}
|
|
}
|
|
@skipCheck;
|
|
|
|
if (hasPicksData) {
|
|
llOwnerSay("🔍 Checking picksData...");
|
|
}
|
|
validatePicksData(picksData, names);
|
|
}
|
|
}
|
|
}
|