.:: 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)

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 14:15.

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