Page 1 of 1

Func DestroyAllBotsPlayers() causes a CTD + more.

Posted: 10 Jul 2013, 13:05
by Lethan
Hello guys,

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);
	}
}
New code
Line 82 :

Code: Select all

Void UnspawnEveryone()
{
    foreach(Player in BotPlayers)
    {
        DestroyBotPlayer(Player);
    }
   //DestroyAllBotPlayers();
	
	foreach(Player in Players) 
	{
		UnspawnPlayer(Player);
	}
}
This will fix temporally the Crash To Desktop when the map ends.

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 :D .
Line 390 :

Code: Select all

log("Bots unspawned you can leave without CTD");
sleep(5000);
Sleep function will give you the time to easily stop the local game for testing purposes.

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 :thx:

Notice : My english skills are... :mrgreen:

Re: Func DestroyAllBotsPlayers() causes a CTD + more.

Posted: 10 Jul 2013, 13:14
by spaii
:thumbsup:

Re: Func DestroyAllBotsPlayers() causes a CTD + more.

Posted: 11 Jul 2013, 11:40
by Dommy
Thank You :thx: