.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   *BUGBUGBUG* affects all HL bots!!! (http://forums.bots-united.com/showthread.php?t=375)

Pierre-Marie Baty 16-01-2004 01:54

*BUGBUGBUG* affects all HL bots!!!
 
...and possibly even the official CS bots too!!

Noticed that today.

When you want to make your bot strafe, basically all you do is raising the "strafe_speed" parameter of RunPlayerMove() to the bot's max speed, right ?

Well have you noticed the effect ? The bots pass from a 0 velocity to full strafe speed in a fraction second ! Try to make your bots strafe left then right in a loop, to see, and try to do the same as a human player : human players can't strafe that fast !!!

Anyone to confirm this behaviour by looking in the engine source code (hint hint, Mike) ?

What to do ? How to fix that ?

Cheeseh 16-01-2004 02:01

Re: *BUGBUGBUG* affects all HL bots!!!
 
Can't really test with a human since a human can't exactly press the two strafe keys at different times in 0.017 seconds :P

Pierre-Marie Baty 16-01-2004 04:13

Re: *BUGBUGBUG* affects all HL bots!!!
 
No, what I mean is, try strafing two steps on your left, then immediately strafe two steps on the right ; you'll notice that while your player was strafing on the left it will slow down until standing still and then progressively begin strafing on the right, increasing its speed. Bots don't do that, they begin strafing full speed as soon as they are asked to. This is unfair. Try it.

Fiber_Optic 16-01-2004 12:03

Re: *BUGBUGBUG* affects all HL bots!!!
 
I've already noticed that on all bots I aready tested.

botman 16-01-2004 14:56

Re: *BUGBUGBUG* affects all HL bots!!!
 
Are you limiting the sidemove speed to something less than or equal to cl_sidespeed?

Is this in Counter-Strike only or did you try other MODs (Half-Life deathmatch, TFC, etc.)?

I assume you are using valid msec values in pfnRunPlayerMove(), but make sure they are correct otherwise you get weird movement results.

botman

Pierre-Marie Baty 16-01-2004 15:13

Re: *BUGBUGBUG* affects all HL bots!!!
 
My strafe speed is the same float value that is passed in pfnSetClientMaxSpeed(), which is normally used for setting the client's FORWARD speed... and I believe all bot authors do that too

It affects every MOD for which the strafe speed increases gradually (i.e, when you press on the button, you don't begin to move instantly full speed). I think HLDM is one of the rare that are not concerned (because of no graduation).

Are client variables such as cl_sidespeed available on dedicated servers too ? If so, considering no bot author out there use this CVAR to my knowledge, no wonder our bots strafe the way they do !!!

botmeister 16-01-2004 21:44

Re: *BUGBUGBUG* affects all HL bots!!!
 
My observations of bot movement agree with what PBM is saying. Bots tend to zig-zag from side to side much faster than a human can which makes them tough targets to hit, and very difficult to defeat at close range (if there's no skill penalty).

stefanhendriks 18-01-2004 17:46

Re: *BUGBUGBUG* affects all HL bots!!!
 
yes, i have noticed this too. We should probably somehow simulate this as HL does with real players?

Onno Kreuzinger 18-01-2004 22:03

Re: *BUGBUGBUG* affects all HL bots!!!
 
and perhaps include it an the skill / personality system, since that reflects different type of users

Pierre-Marie Baty 18-01-2004 22:57

Re: *BUGBUGBUG* affects all HL bots!!!
 
What I find curious is that the engine DOES filter the forward speed when you pass it in RunPlayerMove() ; if you change your bot's forward speed from 0 to its max speed, the bot's speed will raise PROGRESSIVELY. And it does not when it's the side speed. This is really weird. Do we need to emulate this ourselves or is there something we aren't doing right ?

[edit] and it is NOT the cl_sidespeed CVAR : this one is at 380, which is WAY too much already for a decent strafe speed

stefanhendriks 19-01-2004 09:12

Re: *BUGBUGBUG* affects all HL bots!!!
 
yes, i think the guys at valve forgot to do the same for strafe speed as they did with the forward speed.

I think contacting them will be one of the sollutions, it will be of no real use to simulate this. The only advantage you will have that it will look a bit more 'normal' but most people don't even notice it. Secondly, when valve DOES fix it, you end up with worthless code. You can spend your time on more urgent matters ;)

Perhaps Mike already fixed while we were talking ;)

Pierre-Marie Baty 19-01-2004 11:39

Re: *BUGBUGBUG* affects all HL bots!!!
 
The problem is that I need it quite badly for my BotWalkPath() function... because my bots *do* press the strafe keys almost all the time when wandering around, they don't just have their pEdict->v.angles face the destination waypoint and their pEdict->v.v_angle facing elsewhere, I forbidden that because it was not human-like ; instead the bots zigzag and strafe like humans when walking their path, but when it comes to tight paths the bots need to make slight corrections to their trajectory, and not completely jump out of the path (and eventually fall down the ledge they were walking) each time they try to strafe a bit. Having this fixed would help a lot.

Cheeseh 19-01-2004 19:02

Re: *BUGBUGBUG* affects all HL bots!!!
 
Yeah I do that too PM.. I haven't paid much attention to the bots strafe speed though, I didn't notice much, I'll need to check it out sometime.

botmeister 19-01-2004 19:41

Re: *BUGBUGBUG* affects all HL bots!!!
 
As a quick and dirty fix, why not just set the bots maximum speed to a lower value just before each strafe operation?

// before strafe
pst_ptrEdict->v.maxspeed = <slower than normal>
// after strafe
pst_ptrEdict->v.maxspeed = <normal speed>

Pierre-Marie Baty 20-01-2004 05:51

Re: *BUGBUGBUG* affects all HL bots!!!
 
The only quick and dirty fix I can think of would be to record the time at which the bot *started* strafing, and the current time, and compute the difference of both, and apply a filtering function to the maxspeed... which function we'd have to figure out ourselves, and which would obviously be not the same at all than the one players use. I'll try to do that (sampling player's strafe speed first to get an idea of the filtering function) and see what I can get.

Pierre-Marie Baty 20-01-2004 13:29

Re: *BUGBUGBUG* affects all HL bots!!!
 
Now is it an optical illusion??? o_O

I duplicated a real player's controls (v.button and v.impulse) on a bot's ones, toggling the bot's move_speed and strafe_speed when necessary, and here's what a sampling of the bot's velocity gives when the bot starts strafing, at a 60Hz thinking cycle:
Quote:

(server HUD): velocity 0.000000
(server HUD): velocity 0.000000
(server HUD): velocity 0.000000
(server HUD): velocity 0.000000
(server HUD): velocity 0.000000
(server HUD): velocity 18.749999
(server HUD): velocity 32.999998
(server HUD): velocity 47.249999
(server HUD): velocity 61.499999
(server HUD): velocity 75.750000
(server HUD): velocity 89.954994
(server HUD): velocity 103.307688
(server HUD): velocity 115.859220
(server HUD): velocity 127.657664
(server HUD): velocity 138.748206
(server HUD): velocity 149.173314
(server HUD): velocity 158.972912
(server HUD): velocity 168.184533
(server HUD): velocity 176.843464
(server HUD): velocity 184.982857
(server HUD): velocity 192.633887
(server HUD): velocity 199.825856
(server HUD): velocity 206.586306
(server HUD): velocity 212.941129
(server HUD): velocity 218.914662
(server HUD): velocity 224.529787
(server HUD): velocity 229.807997
(server HUD): velocity 234.769519
(server HUD): velocity 239.433340
(server HUD): velocity 243.817334
(server HUD): velocity 247.938289
(server HUD): velocity 249.999997
(server HUD): velocity 249.999997
(server HUD): velocity 249.999997
(server HUD): velocity 249.999997
(server HUD): velocity 249.999997
Bug or not bug ???

What I find strange is that when I watched this bot while I was "controlling" it, it didn't seem to strafe abnormally... while I am CERTAIN that my bots strafe abnormally most of the time. WTF ??? o_O

botmeister 21-01-2004 05:42

Re: *BUGBUGBUG* affects all HL bots!!!
 
Quote:

What I find strange is that when I watched this bot while I was "controlling" it, it didn't seem to strafe abnormally... while I am CERTAIN that my bots strafe abnormally most of the time. WTF ??? o_O
Reminds me of the observer effect ...

The bot world cannot be perceived directly, but rather through the use of instruments. And, so, there is a problem with the fact that the act of measuring disturbs the behavior and movement of bots. This is called the measurement problem.

- adapted from a book on quantum physics :D

Pierre-Marie Baty 21-01-2004 09:01

Re: *BUGBUGBUG* affects all HL bots!!!
 
LOL :D "the Principle of Uncertainty applied to CS bots"

anyway...

I HAVE FOUND THE PROBLEM!!!!!

My bots strafe almost exactly like humans now.

In fact this problem seems to appear only when a bot zigzags, not when it starts strafing for the first time. When their strafe speed has raised to its maximum, if the bots suddently change their strafe direction, the strafe speed is not decreased to zero then increased again. And actually this is somewhat normal: humans can't press the other strafe key that fast, there is at least 0.2 second between the instant where the first strafe key is released and the second one is pressed, because usually the forward/backwards keys and the strafe left/strafe right keys are opposite altogether relatively to your fingers on the keyboard. My fix only constituted in adding a check for the last strafe time in the function that makes the bots press the movement keys. Not only it fixes things, but it makes the bot's movement look REALLY realistic!! w00t 8D
Code:

void BotMove (player_t *pPlayer)
{
  // the purpose of this function is to translate the data of the BotMove structure (timings
  // at which the bot has to perform some movement - jump in 2 seconds, move forward for 5
  // seconds, and so on) into the right input buttons to be passed to RunPlayerMove(), which is
  // the function that asks the engine to perform the movement of the fakeclient. It also sets
  // the correct values for move_speed and strafe_speed which are parameters of RunPlayerMove().
 
  TraceResult tr;
 
  if (DebugLevel.legs_disabled)
          return; // return if we don't want the AI to move
 
  if (pPlayer->Bot.is_controlled)
          return; // if bot is bewitched, it doesn't "steer itself"
 
  // is the bot paused ?
  if (pPlayer->Bot.f_pause_time > server.time)
  {
          pPlayer->Bot.BotMove.f_move_speed = 0;
          pPlayer->Bot.BotMove.f_strafe_speed = 0;
 
          if (pPlayer->Bot.BotMove.f_duck_time > server.time)
          {
                pPlayer->pEntity->v.button |= IN_DUCK; // maintain duck button when needed
                pPlayer->Bot.BotMove.f_duck_time = server.time + 0.2; // keep ducking
          }
 
          return; // don't move the bot if it should be paused
  }
 
  // may the bot jump now ?
  if ((pPlayer->Bot.BotMove.f_jump_time < server.time)
          && (pPlayer->Bot.BotMove.f_jump_time + 0.1 > server.time))
          pPlayer->pEntity->v.button |= IN_JUMP; // jump
 
  // has the bot just jumped AND is bot skilled enough ?
  if ((pPlayer->Bot.BotMove.f_jump_time + 0.1 < server.time)
          && (pPlayer->Bot.BotMove.f_jump_time + 0.2 > server.time)
          && (pPlayer->Bot.pProfile->skill > 1))
          pPlayer->Bot.BotMove.f_duck_time = server.time + 0.2; // duck while jumping
 
  // may the bot duck now ?
  if (pPlayer->Bot.BotMove.f_duck_time > server.time)
          pPlayer->pEntity->v.button |= IN_DUCK; // duck
 
  // may the bot safely strafe left now ?
  if ((pPlayer->Bot.BotMove.f_strafeleft_time > server.time)
          && (pPlayer->Bot.BotMove.f_straferight_time + 0.2 < server.time)
          && !(pPlayer->Bot.BotBody.hit_state & OBSTACLE_LEFT_FALL))
  {
          pPlayer->pEntity->v.button |= IN_MOVELEFT;
          pPlayer->Bot.BotMove.f_strafe_speed = -pPlayer->Bot.BotMove.f_max_speed; // strafe left
  }
 
  // else may the bot safely strafe right now ?
  else if ((pPlayer->Bot.BotMove.f_straferight_time > server.time)
                        && (pPlayer->Bot.BotMove.f_strafeleft_time + 0.2 < server.time)
                        && !(pPlayer->Bot.BotBody.hit_state & OBSTACLE_RIGHT_FALL))
  {
          pPlayer->pEntity->v.button |= IN_MOVERIGHT;
          pPlayer->Bot.BotMove.f_strafe_speed = pPlayer->Bot.BotMove.f_max_speed; // strafe right
  }
 
  // may the bot move backwards now ?
  if (((pPlayer->Bot.BotMove.f_backwards_time > server.time)
                && (pPlayer->Bot.BotMove.f_forward_time + 0.2 < server.time))
          || (pPlayer->Bot.BotMove.b_emergency_walkback))
  {
          pPlayer->pEntity->v.button |= IN_BACK;
          pPlayer->Bot.BotMove.f_move_speed = -pPlayer->Bot.BotMove.f_max_speed; // move backwards
  }
 
  // else may the bot move forward now ?
  else if ((pPlayer->Bot.BotMove.f_forward_time > server.time)
                        && (pPlayer->Bot.BotMove.f_backwards_time + 0.2 < server.time))
  {
          pPlayer->pEntity->v.button |= IN_FORWARD;
          pPlayer->Bot.BotMove.f_move_speed = pPlayer->Bot.BotMove.f_max_speed; // run forward
  }
 
  // may the bot walk now ?
  if (pPlayer->Bot.BotMove.f_walk_time > server.time)
  {
          pPlayer->pEntity->v.button |= IN_RUN;
          pPlayer->Bot.BotMove.f_move_speed /= 2; // forward walk
          pPlayer->Bot.BotMove.f_strafe_speed /= 2; // side walk
  }
 
  return;
}


dilinator 06-04-2004 15:05

Re: *BUGBUGBUG* affects all HL bots!!!
 
what file should we addd this to?


All times are GMT +2. The time now is 02:45.

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