I tried to get what is the reason why we get a Crash To Desktop when we use bots. I founded two situations when it occurs :
- When using function DestroyAllBotsPlayers()
- When stopping a local server BEFORE bots destroyed
Map tested : Horde_Single.Map.Gbx
Script : Horde.Script.txt
Both map and script are available from here : http://files.maniaplanet.com/botdata/BotExample.zip
I have modified this script to temporally fix the DestroyAllBotsPlayers() problem.
Original code
Line 82 :
Code: Select all
Void UnspawnEveryone()
{
DestroyAllBotPlayers();
foreach(Player in Players)
{
UnspawnPlayer(Player);
}
}
Line 82 :
Code: Select all
Void UnspawnEveryone()
{
foreach(Player in BotPlayers)
{
DestroyBotPlayer(Player);
}
//DestroyAllBotPlayers();
foreach(Player in Players)
{
UnspawnPlayer(Player);
}
}
BUT
The second CrashToDesktop comes when we stop a game from local with the script. The game crashes because bots are not destroyed. You cant test by yourself, in my modified code, if you try to leave before UnspawnEveryone() call, the game will crash. If you leave the local game after the function call, you will be redirected safely to the main menu
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Line 390 :
Code: Select all
log("Bots unspawned you can leave without CTD");
sleep(5000);
Version française résumée (Short French Version) :
La fonction DestroyAllBotsPlayers() semble causer une fuite RAM et donc un crash to desktop. Utiliser une boucle foreach ainsi que la fonction DestroyPlayer(CSmPlayer player) évite le problème. De plus, si l'on tente de quitter une partie locale alors que des bots sont toujours existants sur la map, un crash se produira.
Thank you for reading this report
![Thanks :thx:](./images/smilies/andromaque.gif)
Notice : My english skills are...
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)