From 48de9e32f0886658dbff9c85261cc69913b3659b Mon Sep 17 00:00:00 2001 From: Freagarach Date: Wed, 16 Aug 2023 09:48:24 +0000 Subject: [PATCH] Fix performance drop and memory leak on networked AI matches. When playing a network game with at least one AI, and an AI dies, after a while there will be an increasing lag on the system, eventually freezing the screen for e.g. 4 seconds every 5 seconds. It turned out that once the AI is dead, the savedEvents grew endlessly. Causing issues down the line (hashing). That is now fixed by discarding savedEvents when the AI is defeated. Patch by: @lairkers Differential revision: https://code.wildfiregames.com/D5042 Comments by: @phosit, @wraitii This was SVN commit r27800. --- binaries/data/mods/public/gui/credits/texts/programming.json | 1 + binaries/data/mods/public/simulation/ai/petra/_petrabot.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/gui/credits/texts/programming.json b/binaries/data/mods/public/gui/credits/texts/programming.json index 6d482d2802..edc7b3e35e 100644 --- a/binaries/data/mods/public/gui/credits/texts/programming.json +++ b/binaries/data/mods/public/gui/credits/texts/programming.json @@ -160,6 +160,7 @@ { "nick": "Krinkle", "name": "Timo Tijhof" }, { "nick": "Kuba386", "name": "Jakub Kośmicki" }, { "nick": "lafferjm", "name": "Justin Lafferty" }, + { "nick": "lairkers" }, { "nick": "Langbart" }, { "nick": "LeanderH", "name": "Leander Hemelhof" }, { "nick": "leper", "name": "Georg Kilzer" }, diff --git a/binaries/data/mods/public/simulation/ai/petra/_petrabot.js b/binaries/data/mods/public/simulation/ai/petra/_petrabot.js index 4b03d01099..94115d3600 100644 --- a/binaries/data/mods/public/simulation/ai/petra/_petrabot.js +++ b/binaries/data/mods/public/simulation/ai/petra/_petrabot.js @@ -88,7 +88,7 @@ PETRA.PetraBot.prototype.CustomInit = function(gameState) PETRA.PetraBot.prototype.OnUpdate = function(sharedScript) { - if (this.gameFinished) + if (this.gameFinished || this.gameState.playerData.state == "defeated") return; for (let i in this.events)