diff --git a/ACS/DOOMWARE.acs b/ACS/DOOMWARE.acs index c43458c..eaaabfc 100644 --- a/ACS/DOOMWARE.acs +++ b/ACS/DOOMWARE.acs @@ -280,29 +280,13 @@ achievemnts will not be tracked.\ // Game changelog #define CHANGES "\ -Version 1.05\n\ +Version 1.05a\n\ What's new in this version?\n\n\ -+ Zandronum 3.1 update\n\ -+ Added points to Deathmatch and linked the DoomWare score to them\n\ -+ Added points to Internal Zandronum scoreboard\n\ -+ Added 'doomware_fakerandom' CVar\n\ -* Changed music in SSG and Grenades Duel minigames\n\ -* Changed teleport system for Boxing minigame\n\ -* Finally fixed the camera in E1M1 Karts\n\ -* Fixed Arch-Viles not receiving Wacky Mods correctly\n\ -* Fixed boss battle spectator bug caused by Zandronum 3.1\n\ -* Fixed freeze and particles in brawler tiebreaker\n\ -* Fixed Buu342 Morph in 'Put Yourself Out' minigame\n\ -* Fixed teleport bug in Source Port minigame\n\ -* Fixed Wackymods Mecha Romeros\n\ -* Gave the CacoDemons some musical notes\n\ -* Improved networking and HUD performance by using internal Zandronum functions\n\ -* Prevented cheating the jumps in Void minigame\n\ -* Tweaked time in Town Infection minigame\n\ -* Tweaked windows and map for Batman Doom\n\ -* Turkey is now affected by wackymods\n\ -- Removed some built-in Zandronum gamemode text\n\ -- Removed loss from fake barrels\n\ ++ Added monster blocker to elevator in Batman Doom\n\ ++ Added a railing to an evil turn on Rainbow Road\n\ +* Changed the shufflebags to dynamic weighted random generation for everything except next wackymod\n\ +* Fixed hats following last spectator during boss round\n\ +* Fixed game not displaying alive count properly during boss round\n\ " @@ -371,24 +355,18 @@ int data_role[MAXPLAYERS]; // (Internal) List of each player's role int data_achieve[MAXPLAYERS]; // (Internal) Bit field each player's achievements int data_bosskills[MAXPLAYERS]; // (Internal) List of each player's boss kills -// Shufflebags to make random "feel" more random -global int 01:sbag_wackymods[]; // (Internal) The entire wackymods shufflebag -global int 02:sbag_wackymodschance[]; // (Internal) The entire wackymodschance shufflebag -global int 03:sbag_minigames[]; // (Internal) The entire minigames shufflebag -global int 04:sbag_1v1[]; // (Internal) The entire 1V1 minigames shufflebag -global int 05:sbag_1vm[]; // (Internal) The entire 1VM minigames shufflebag +global int 1: wrng_minigames[]; // (Internal) Minigame weights for Weighted Random Number Generation +global int 2: wrng_1v1[]; // (Internal) 1v1 minigame weights for Weighted Random Number Generation +global int 3: wrng_1vM[]; // (Internal) 1vM minigame weights for Weighted Random Number Generation +global int 4: wrng_wackymods[]; // (Internal) Wackymod weights for Weighted Random Number Generation +global int 5: sbag_nextwacky[]; // (Internal) Shufflebag with the next wackyround -// Trackers -global int 06:sbag_track_wackymods; // (Internal) Tracks where we are currently in the wackymods shufflebag -global int 07:sbag_track_wackymodschance; // (Internal) Tracks where we are currently in the wackymodschance shufflebag -global int 08:sbag_track_minigames; // (Internal) Tracks where we are currently in the minigames shufflebag -global int 09:sbag_track_1v1; // (Internal) Tracks where we are currently in the 1V1 minigames shufflebag -global int 10:sbag_track_1vm; // (Internal) Tracks where we are currently in the 1VM minigames shufflebag +global int 6: lastlimit_minigames; // (Internal) Stores the last minigame round limit (in case we change map) +global int 7: lastlimit_1v1; // (Internal) Stores the last 1v1 minigame round limit (in case we change map) +global int 8: lastlimit_1vM; // (Internal) Stores the last 1vM minigame round limit (in case we change map) +global int 9: lastlimit_wackychance; // (Internal) Stores the last wackymod chance (in case the CVar changes) -// Limits -global int 11:sbag_limit_minigames; // (Internal) Checks the last upper limit of the minigames shufflebag -global int 12:sbag_limit_1v1; // (Internal) Checks the last upper limit of the 1V1 minigames shufflebag -global int 13:sbag_limit_1vm; // (Internal) Checks the last upper limit of the 1VM minigames shufflebag +global int 10: sbagtrack_nextwacky; // (Internal) Tracks where we are currently in the nextwacky shufflebag /*=================================================================================================== @@ -404,7 +382,7 @@ script "DoomWare_Server_Boot" OPEN // Called when the map starts. Waits for play // Initialize shufflebags if (GetCVar("doomware_fakerandom")) - DoomWare_InitShuffleBags(); + DoomWare_InitRNG(); // Figure out the map skin if (!StrICmp(GetCVarString("doomware_mode"), "halloween") || (GetCVar("doomware_automode") && GetTimeProperty(SystemTime(), TM_MONTH) == 9)) @@ -603,7 +581,8 @@ Script "DoomWare_Server_InitHints" (void) // Initializes the list of hints to di } bool temp_bannedrounds[NUMBEROFGAMES]; -int temp_shufflearray[1000]; +int temp_shufflearray[NUMBEROFGAMES]; +int temp_shufflearray_weight[NUMBEROFGAMES]; Script "DoomWare_Server_InitRounds" (void) // Initializes the list of minigames to play { int i, j, k; @@ -657,29 +636,32 @@ Script "DoomWare_Server_InitRounds" (void) // Initializes the list of minigames // Create a temporary array with all the rounds that aren't banned for (i=0; i= MAXROUNDS) + if (!GetCVar("doomware_duplicates") && totalrounds >= MAXROUNDS) { - // Shuffle the temp array - for (i=0; i NUMBEROFWACKYMODS) - DoomWare_Shuffle_WackyMod(); -} - -function void DoomWare_CheckSBag_WackyChance(void) // Checks if the wackymodschance shufflebag's limit is reached, and shuffles it if so -{ - if (sbag_track_wackymodschance == 0 || sbag_track_wackymodschance-1 > GetCVar("doomware_wackymodschance")) - DoomWare_Shuffle_WackyChance(); -} - -function void DoomWare_CheckSBag_Minigames(void) // Checks if the minigame shufflebag's limit is reached, and shuffles it if so +function void DoomWare_InitRNG(void) // Initialize all the RNG stuff { - if (sbag_track_minigames == 0 || sbag_track_minigames-1 > NUMBEROFGAMES) + int i; + + // Initialize all the weights if they haven't been already or we changed map + if (lastlimit_minigames == 0 || lastlimit_minigames != NUMBEROFGAMES) { - sbag_limit_minigames = NUMBEROFGAMES; - DoomWare_Shuffle_Minigames(); + lastlimit_minigames = NUMBEROFGAMES; + for (i=0; i NUMBEROFTIEBREAKERS) + if (lastlimit_1v1 == 0 || lastlimit_1v1 != NUMBEROFTIEBREAKERS) { - sbag_limit_1v1 = NUMBEROFTIEBREAKERS; - DoomWare_Shuffle_1V1(); + lastlimit_1v1 = NUMBEROFTIEBREAKERS; + for (i=0; i NUMBEROFTIEBREAKERSM) + if (lastlimit_1vM == 0 || lastlimit_1vM != NUMBEROFTIEBREAKERSM) { - sbag_limit_1vm = NUMBEROFTIEBREAKERSM; - DoomWare_Shuffle_1VM(); + lastlimit_1vM = NUMBEROFTIEBREAKERSM; + for (i=0; i GetCVar("doomware_wackymodschance")) + DoomWare_SBagShuffle_NextWacky(); } -function void DoomWare_Shuffle_WackyMod(void) // Shuffles the wackymods shufflebag +function void DoomWare_WRng_Minigames(int totalrounds) // Fills the round_current array with MAXROUNDS games, using weighted RNG { int i; - - // Create a temporary array with all the values - for (i=0; i largest_weight) + largest_weight = temp_shufflearray_weight[i]; + } + + // Perform the weighted shuffle + while (curround < MAXROUNDS) + { + int copysize = totalrounds-curround; + int selection = random(0, total_weight); + int k = 0; + + // Subtract weights until it's less than zero + while (1) + { + selection -= Max(1, largest_weight-temp_shufflearray_weight[k]); + + if (selection <= 0) + break; + + k = (k+1)%copysize; + } + + // Copy the resulting item to our shuffled array and subtract the weight + round_current[curround] = temp_shufflearray[k]; + wrng_minigames[temp_shufflearray[k]-1] += 100; + total_weight -= temp_shufflearray_weight[temp_shufflearray[k]-1]; + temp_shufflearray_weight[temp_shufflearray[k]-1] += 100; + + // Remove the item from our array + for (int j=k; j largest_weight) + largest_weight = wrng_1v1[i]; + } + + selection = random(0, total_weight); + i = 0; + + // Subtract weights until it's less than zero + while (1) { - int j = random(i, GetCVar("doomware_wackymodschance")-1); - int k = temp_shufflearray[i]; - temp_shufflearray[i] = temp_shufflearray[j]; - temp_shufflearray[j] = k; + selection -= Max(1, largest_weight - wrng_1v1[i]); + + if (selection <= 0) + break; + + i = (i+1)%NUMBEROFTIEBREAKERS; } - // Copy the values from the temp array to our shufflebag - for (i=0; i largest_weight) + largest_weight = wrng_1vM[i]; + } + + selection = random(0, total_weight); + i = 0; + + // Subtract weights until it's less than zero + while (1) { - int j = random(i, NUMBEROFGAMES-1); - int k = temp_shufflearray[i]; - temp_shufflearray[i] = temp_shufflearray[j]; - temp_shufflearray[j] = k; + selection -= Max(1, largest_weight - wrng_1vM[i]); + + if (selection <= 0) + break; + + i = (i+1)%NUMBEROFTIEBREAKERSM; } - // Copy the values from the temp array to our shufflebag - for (i=0; i largest_weight) + largest_weight = wrng_wackymods[i]; + } + + selection = random(0, total_weight); + i = 0; + + // Subtract weights until it's less than zero + while (1) { - int j = random(i, NUMBEROFTIEBREAKERS-1); - int k = temp_shufflearray[i]; - temp_shufflearray[i] = temp_shufflearray[j]; - temp_shufflearray[j] = k; + selection -= Max(1, largest_weight - wrng_wackymods[i]); + + if (selection <= 0) + break; + + i = (i+1)%NUMBEROFWACKYMODS; } - // Copy the values from the temp array to our shufflebag - for (i=0; i GetCVar("doomware_wackymodschance")) + DoomWare_SBagShuffle_NextWacky(); // Return the result return val; @@ -1289,7 +1266,7 @@ Script "DoomWare_Server_GameLogic" (void) // Main game logic "thread" if (DEBUG_TIEB > 0) round_tiebreaker = DEBUG_TIEB; else if (GetCVar("doomware_fakerandom")) - round_tiebreaker = DoomWare_SBagNext_1V1(); + round_tiebreaker = DoomWare_WRng_1v1(); else round_tiebreaker = random(1, NUMBEROFTIEBREAKERS); } @@ -1298,7 +1275,7 @@ Script "DoomWare_Server_GameLogic" (void) // Main game logic "thread" if (DEBUG_TIEBM > 0) round_tiebreaker = DEBUG_TIEBM; else if (GetCVar("doomware_fakerandom")) - round_tiebreaker = DoomWare_SBagNext_1VM(); + round_tiebreaker = DoomWare_WRng_1vM(); else round_tiebreaker = random(1, NUMBEROFTIEBREAKERSM); round_is1vmtiebreaker = true; diff --git a/ACS/MAP30.acs b/ACS/MAP30.acs index fb9a229..bfaa27e 100644 --- a/ACS/MAP30.acs +++ b/ACS/MAP30.acs @@ -880,12 +880,13 @@ Script "DoomWare_Server_GameLogic" (void) // Check if everyone is dead game_alive = 0; - for (i=0; i