Thread: Visual C++ .NET Quake 3 Source Port

  1. #1
    Registered User
    Join Date
    Sep 2007

    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];
    memset(bs, 0, sizeof(bot_state_t));
    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.

    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(),
    if (botlib_residual >= thinktime)
    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:

    elapsed_time = time - local_time;
    local_time = time;
    If after those 2 lines you add in these 2, it will make the AAS initialize as it should:

    if (elapsed_time < 0)
    elapsed_time = 0;
    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.
    Last edited by bengreenwood; 03-16-2012 at 08:05 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird Problems Compiling/ Running .NET Quake 3 Source Port
    By bengreenwood in forum Game Programming
    Replies: 2
    Last Post: 12-01-2011, 06:52 PM
  2. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  3. Understanding something in Quake 2 Source Code
    By bengreenwood in forum C Programming
    Replies: 5
    Last Post: 08-05-2009, 02:22 PM
  4. Understanding a Line of Quake 2 Source Code
    By bengreenwood in forum C++ Programming
    Replies: 6
    Last Post: 08-04-2009, 03:15 PM
    By no-one in forum A Brief History of
    Replies: 8
    Last Post: 12-23-2001, 11:33 PM