Re: Waypointing -
22-01-2005
I tried that, I added alerts to every function, looked through log after log. Everytime the crash occured, the last function reported was different. I think this is because there is a delay between the ALERT function being called, and it actually being printed in the console.
I just disabled the attacking code (commented out the IN_ATTACK and IN_ATTACK2 lines) and the problem still occurs. I'm pretty sure it doesn't have anything to do with taking damage or attacking, everything so far points to switching weapons. Switching weapons while the bot is doing something.. but what? That's the question.
[EDIT] Actually I have been testing.. and a few times now I have been getting BotAvoidContact as the last function called. I did a few tests to pinpoint this:
Played a game with nearly all weapon function removed. The bots moved around and just constantly switching between two weapons. There were many bots, all running around switching weapons. The game 'crashed' quickly, and I looked at MSVC++ and say "BotAvoidContact" as the last function.
Then I went into a game with just me and a bot. I ran up to the bot so he'd target me and begin attacking (er, switching weapons). After about a minute, the game began looping. Again, AvoidContact was the last function. I started the game again, but this time I didn't join. I just let the bot find a scientst to try and attack. He was there, running at the scientist, switching weapons.. but the game never crashed. The bot wasn't trying to avoid the scientist either, the avoid code wasn't running (for some reason, I'm not sure, something must of been over riding it). I let that run for 5 minutes, and there were no issues.
So, I comment out the if line BotAvoidContact(); in bot.cpp and run the bot again, this time testing to see if the single bot begins looping when trying to attack me. Five minutes go by of him strafing around me in circle switching weapons without a problem. So, I uncomment BotAvoidContact and go back into the game. This time it begins looping in half a minute. Comment BotAvoidContact back out and start the game, this time adding 16 bots. Although it was running at 10 FPS (major console spam from all the functions being called), the bot ran for 20 minutes without crashing (with 16 bots, I'd be suprised if it went for 20 seconds normally). I'm going to do some more tests, then run an overnight test to see if it goes all night. Here is a summary of the problem found so far:
When the bot runs, there is a small chance that HL.exe will enter an infinite loop (it'll begin using 99% of the CPU) under S&I. This ONLY happens under S&I, and involves two things. First, the bot must be switching weapons for the looping to begin (why is one question). Second, the contact avoiding code must be active for the looping to begin. If these conditions are met, the program goes into a loop for some reason. The contact avoiding code is used for bots so that they don't get stuck on each other, monsters, or other objects in the level (note: not walls). The questions are why does switching weapons and contact avoiding cause the problem when they're completely unrelated, and why does this only occur in S&I?
Anyway, I have some more testing to do. If this is indeed the problem, expect a 0.3 very soon.
Last edited by Ghoul; 22-01-2005 at 04:52..
|