.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Releases, Installers, Docs & Coding (http://forums.bots-united.com/forumdisplay.php?f=48)
-   -   FPS dependent code (http://forums.bots-united.com/showthread.php?t=7347)

Serious Sam 30-10-2009 11:48

FPS dependent code
 
Hello,
I have started coding my own bot in my free time not very long ago, its based on the sources of yapb 1, still only minor modifications, and what I noticed is that if I use this bot in a dedicated server and try to increase the server FPS with the sys_ticrate command, bots start to behave strange. I Tried a few other bots to see if these are the only ones with this problem, and I noticed problems in all other bots I tested, and the new beta of PODBot MM was the first one that was working properly at higher server FPS. So, if it's possible, could you point me to the part in the code of podbot mm that makes this, and allow me to copy it into my bot? I'm not very good at reading sources and creating new code, so I cant find it myself and I cant code it on my own.

KWo 30-10-2009 16:28

Re: FPS dependent code
 
In bot.cpp in BotSpawnInit function:
PHP Code:

   pBot->fTimePrevThink gpGlobals->time;
   
pBot->fTimePrevThink2 gpGlobals->time;
   
pBot->fTimeFrameInterval 0.0;

   
pBot->i_msecval 0;                // KWo - 17.03.2007
   
pBot->f_msecvalrest 0.0;          // KWo - 17.03.2007 

And the clue is somewhere at the end of the function BotThink in bot.cpp (almost at bottom of that file):
PHP Code:

// this is Leon Hartwig's method for computing the msec value
   
f_msecval = (gpGlobals->time pBot->fTimePrevThink2) * 1000.0;
   
pBot->fTimePrevThink2 gpGlobals->time;

   
i_msecvalrest 0;                         // KWo - 17.03.2007
   
i_msecval = (int) (f_msecval);             // KWo - 17.03.2007
   
if (i_msecval 10)                        // KWo - 17.03.2007
   
{
      
f_msecval f_msecval - (float)(i_msecval) + pBot->f_msecvalrest;
      
i_msecvalrest = (int)(f_msecval);
      
pBot->f_msecvalrest f_msecval - (float)(i_msecvalrest);
   }
   
i_msecval i_msecval i_msecvalrest;

   if (
i_msecval 1)
      
i_msecval 1// don't allow the msec delay to be null
   
else if (i_msecval 100)
      
i_msecval 100// don't allow it to last longer than 100 milliseconds either

   
g_engfuncs.pfnRunPlayerMove (pEdictvecMoveAnglespBot->f_move_speedpBot->f_sidemove_speed0pEdict->v.button0, (unsigned chari_msecval);    // KWo - 25.09.2006 - thanks to THE_STORM 


Serious Sam 31-10-2009 22:54

Re: FPS dependent code
 
thanks a lot :innocent:


All times are GMT +2. The time now is 11:36.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.