Visual C++ .NET Quake 3 Source Port
I've been trying to make a mod for Quake 3, using Greg Dolley's C++ .NET port of the source code. However, I'm having some problems, which I don't get in my regular (fully patched) install of Quake 3. I'm wondering if anyone might be willing to try compiling the source port, to see if they could make any sense of the following problems? Also if people notice any other problems/ know how to fix them, that would be interesting, too.
I've put the source port up at the following url:
You can read Greg's original page about it here:
Quake 3 C++ .NET Port « Greg Dolley’s Weblog
These bugs happen if I start a game with a bot, leave that game, then start the game again with the same bot.
1. The bot loads up OK in the first game, but in the second game they don't join the game at the start. I get the error messages: "Fatal: BotAISetupClient: client 1 already setup", "Fatal:invalid move state 1", "Fatal invalid goalstate handle 1" and "Fatal: invalid chat state 1" in the console. From the first message, it seems like at the end of the first game, Quake 3 is just not deleting the client data relating to the bot as it should be.
I managed to solve this by adding some code in the BotAISetupClient function in ai_main.c, after
bs = botstates[client];
This seems to clear out some memory for the new bot to use. However, the problem with this is that in a debug build you get loads of "no valid ltg" messages when you start a new game. I'm wondering if my added code might cause some other problems, too, because this is clearly not the way Quake 3 normally does things. I've noticed that when some bots start a game like this, they stand around for a while being a bit kind of stupified.
memset(bs, 0, sizeof(bot_state_t));
2. The above problem/ fix leaves you with the following problem: the bots still won't load, because the AAS doesn't get initialized at the start of the second game. This turned out to be a problem in BotAIStartFrame() in ai_main.c. elapsed_time kept getting set to a negative value at the start of any game other than the first game you play. This then caused botlib_residual to get set to a negative value.
For the AAS stuff to get initialized in BotAIStartFrame(),
must be met in that function. However, due to elapsed_time/ botlib_residual being set to negative values, this wasn't happening at the start of the game.
if (botlib_residual >= thinktime)
In BotAIStartFrame(), there are the following couple of lines:
If after those 2 lines you add in these 2, it will make the AAS initialize as it should:
elapsed_time = time - local_time;
local_time = time;
Is my solution OK? Or is there a better way of fixing this problem? I'm thinking this problem could be something to do with elapsed_time being static perhaps. Doesn't static work differently depending on your compiler or something?
if (elapsed_time < 0)
elapsed_time = 0;
Thanks in advance.