• Advertisement
Sign in to follow this  

Issues with C++ .NET Port of Quake 3 Source Code

This topic is 2135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


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 (and attached it as I've just realised I can do this):


[size=3]You can read Greg's original page about it here:


These bugs happen if I start a game with a bot, leave that game, then start the game again with the same bot.

1. On the loading screen that shows the characters in the game and the weapons, before the second game, it starts showing twice as many icons as it should. This is accompanied by loads of error messages in the console like "R_GetShaderbyHandle: out of range hShader '271' (or different numbers)". This problem seems to be caused by Quake 3 storing too many shaders/ not deleting shader information at the end of the first game. However I'm having difficulty understanding exactly what's causing it.

2. 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 [code]bs = botstates[client];[/code][/size]
[size=3]This is the code I added:[/size]

[size=3][code]memset(bs, 0, sizeof(bot_state_t));[/code]

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.

3. 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(), [code]if (botlib_residual >= thinktime)[/code] 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.

In BotAIStartFrame(), there are the following couple of lines:

[code]elapsed_time = time - local_time;
local_time = time;[/code]

If after those 2 lines you add in these 2, it will make the AAS initialize as it should:

[code]if (elapsed_time < 0)
elapsed_time = 0;[/code]

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?

Thanks in advance.[/size]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement