[hlcoders] How to get the msec value for the bots in the HL1 engine?

2006-05-01 Thread THE STORM

Hi all,

I know that this question is a bit outdated but I want to ask how is the
best way to get the msec value for the RunPlayerMove() call? I'm talking
about the old HL1 engine.
I tried with gpGlobals-frametime * 1000; Work good first 30 minutes and
after that the bots start to be stucked in to the round spawn.
I will be very happy if someone point me the best way to get that msec
value.

___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] How to get the msec value for the bots in the HL1 engine?

2006-05-01 Thread Jeffrey \botman\ Broome

THE STORM wrote:

Hi all,

I know that this question is a bit outdated but I want to ask how is the
best way to get the msec value for the RunPlayerMove() call? I'm talking
about the old HL1 engine.
I tried with gpGlobals-frametime * 1000; Work good first 30 minutes and
after that the bots start to be stucked in to the round spawn.
I will be very happy if someone point me the best way to get that msec
value.


I used something like this (based on code Rich Whitehouse used for the
Jumbot)...

   // adjust the millisecond delay based on the frame rate interval...
   if (msecdel = gpGlobals-time)
   {
  msecdel = gpGlobals-time + 0.5;
  if (msecnum  0)
 msecval = 450.0/msecnum;
  msecnum = 0;
   }
   else
  msecnum++;

   if (msecval  1)// don't allow msec to be less than 1...
  msecval = 1;

   if (msecval  100)  // ...or greater than 100
  msecval = 100;

   g_engfuncs.pfnRunPlayerMove( pEdict, pEdict-v.v_angle, 0.0,
   0, 0, pEdict-v.button, 0, msecval);

...it does a pretty good job of averaging the msecval over many frames
and clamps it to be within a fairly good range.

Just make 'msecnum' be a local 'int' variable for the bot and make
'msecdel' and 'msecval' be local 'float' variables...

   int msecnum;
   float msecdel;
   float msecval;

--
Jeffrey botman Broome

___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] How to get the msec value for the bots in the HL1 engine?

2006-05-01 Thread THE STORM

Jeffrey botman Broome wrote:

THE STORM wrote:

Hi all,

I know that this question is a bit outdated but I want to ask how is the
best way to get the msec value for the RunPlayerMove() call? I'm talking
about the old HL1 engine.
I tried with gpGlobals-frametime * 1000; Work good first 30 minutes and
after that the bots start to be stucked in to the round spawn.
I will be very happy if someone point me the best way to get that msec
value.


I used something like this (based on code Rich Whitehouse used for the
Jumbot)...

   // adjust the millisecond delay based on the frame rate interval...
   if (msecdel = gpGlobals-time)
   {
  msecdel = gpGlobals-time + 0.5;
  if (msecnum  0)
 msecval = 450.0/msecnum;
  msecnum = 0;
   }
   else
  msecnum++;

   if (msecval  1)// don't allow msec to be less than 1...
  msecval = 1;

   if (msecval  100)  // ...or greater than 100
  msecval = 100;

   g_engfuncs.pfnRunPlayerMove( pEdict, pEdict-v.v_angle, 0.0,
   0, 0, pEdict-v.button, 0, msecval);

...it does a pretty good job of averaging the msecval over many frames
and clamps it to be within a fairly good range.

Just make 'msecnum' be a local 'int' variable for the bot and make
'msecdel' and 'msecval' be local 'float' variables...

   int msecnum;
   float msecdel;
   float msecval;

--
Jeffrey botman Broome



Hi botman,

I used the same algoritm before but its not work well on higher than 100fps.
gpGlobals-frametime * 1000; work good on 255 fps but after some time
the bots start to be stucked in to their spawn points.
Do you know better way ( I wonder what the official CS bot use ).
Thanks a lot anyway, I will back to the way that you posted if there is
no other solution.

The Storm

___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders