.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   The RealBot 'Source' (http://forums.bots-united.com/forumdisplay.php?f=52)
-   -   Making Realbot suck at shooting for once (http://forums.bots-united.com/showthread.php?t=2014)

yangmungi 20-06-2004 00:46

Making Realbot suck at shooting for once
 
i saw the code and im looking into why the personality values dont seem to affect the bots... Anyone else come up with something? Every one of my friends called the bots hackers so yeah.

[edit] the ini_parser seems fine, im learning about class pointers but i have a general idea. what about Random_float? [/edit]

dstruct2k 20-06-2004 08:48

Re: Making Realbot suck at shooting for once
 
Well, I installed PODBot for testing, and POD's have a setting to disable "inhuman turning" aka Realbot's turn-on-a-dime.

I'll look into porting this, but it might be something Stefan will have to look at.

stefanhendriks 20-06-2004 11:34

Re: Making Realbot suck at shooting for once
 
Let me help you a bit:

in bot.cpp, there is the cBot class written. In the function cBot::Aim() the bot aims at a vector given as argument in that function. Now, we look where Aim() is called...

hence! it is called in the function below, called AimAtEnemy()

at the bottom of AimAtEnemy you see Aim() being called. The function AimAtEnemy looks like this:

Code:

/******************************************************************************
 Function purpose: Aims at enemy, only when valid. Based upon skill how it 'aims'
 ******************************************************************************/
void cBot::AimAtEnemy ()
{
  // No (valid) enem pointer? -> bail out
  if (pBotEnemy == NULL)
        return;
  Vector vVecEnd = pBotEnemy->v.origin + pBotEnemy->v.view_ofs;
  // We cannot see our enemy? -> bail out
  if ((f_blinded_time > gpGlobals->time) ||
          (!(FInViewCone (&vVecEnd, pEdict) && FVisible (vVecEnd, pEdict))))
  {
  Aim(v_enemy);
  return;
  }
  // ------------------------ we can see enemy -------------------------
  Vector vTarget;
  float fDistance;
  float fScale = 0.0;
  // Distance to enemy
  fDistance = (pBotEnemy->v.origin - pEdict->v.origin).Length ();
  // Scale this
  fScale = fDistance / 2500;
  if (fScale > 0.9)
        fScale = 0.9;
  // Super skill requires little differentation
  if (bot_skill == 0)
        fScale = 0.05;
  if (CarryWeaponType () == SNIPER)
        fScale = 0.01;
 
  // Set target here
  vTarget = pBotEnemy->v.origin;
 
  if (bot_skill <= 1)
        vTarget = pBotEnemy->v.origin + pBotEnemy->v.view_ofs + Vector (0, 0, -16);
  else if (bot_skill > 1 && bot_skill < 4)
        vTarget = pBotEnemy->v.origin + pBotEnemy->v.view_ofs * RANDOM_FLOAT (0.5, 1.1);
  else if (bot_skill > 3 && bot_skill < 5)
  vTarget = pBotEnemy->v.origin;
  else if (bot_skill > 4)
  vTarget = pBotEnemy->v.origin + Vector (0, 0, -32);
  // Based uppon how far, we make this fuzzy
  float fDx, fDy, fDz;
  fDx = fDy = fDz = 0.0;
  // Equals SKILL
  fDx = fDy = fDz = (bot_skill * fScale);
  vTarget = vTarget + Vector (RANDOM_FLOAT (-fDx, fDx), RANDOM_FLOAT (-fDy, fDy), RANDOM_FLOAT (-fDz, fDz));
  // Add Offset
  fDx = fpXOffset;
  fDy = fpYOffset;
  fDz = fpZOffset;
  // Set extra offset
  vTarget = vTarget + Vector (RANDOM_FLOAT (-fDx, fDx), RANDOM_FLOAT (-fDy, fDy), RANDOM_FLOAT (-fDz, fDz));
  // When holding a grenade, do this aiming.
  if (current_weapon.iId == CS_WEAPON_HEGRENADE
          || current_weapon.iId == CS_WEAPON_FLASHBANG)
  {
          vTarget = vTarget + Vector (0, 0, 50);
  }
 
  Aim (vTarget);  // Aim
}


stefanhendriks 20-06-2004 11:36

Re: Making Realbot suck at shooting for once
 
I bet you can change the if bot_skill < lines, because i noticed SKILL > 1 is even better then SKILL < 1 :D

dstruct2k 20-06-2004 18:50

Re: Making Realbot suck at shooting for once
 
English translation:

If bot skill is from 0 to 1, target enemy in head.

If bot skill is from 1.1 to 3.9, target enemy with a randomized offset.

If bot skill is from 3.1 to 4.9, target enemy's location without correcting for movement.

If bot skill is 4.1 or worse, aim way above head without correcting for movement.



Those numbers are wrong. :) I would put it like this:
Code:

if (bot_skill <= 1)
vTarget = pBotEnemy->v.origin + pBotEnemy->v.view_ofs + Vector (0, 0, -16);
else if (bot_skill > 1 && bot_skill <= 4)
vTarget = pBotEnemy->v.origin + pBotEnemy->v.view_ofs * RANDOM_FLOAT (0.5, 1.1);
else if (bot_skill > 4 && bot_skill <= 6)
vTarget = pBotEnemy->v.origin;
else if (bot_skill > 6)
vTarget = pBotEnemy->v.origin + Vector (0, 0, -32);

Now you've got all numbers covered, none double-covered, and it should seem more realistic.

I can't figure out the code that actually does the turning of the bot, they seem to turn at the speed of light as if their sensitivity was at 200 or something extreme.

V or 'Tex 20-06-2004 22:46

Re: Making Realbot suck at shooting for once
 
Funny thing, I run all my bots on skill 1 because otherwise they rarely present a challenge, but this time I chose to have a 'team' on my side.


When I died, I spec'd the guy that killed me and he was simultaneously shooting at 3 people using speed-of-light turning. He'd snap of two shots at one guy, and his screen would flicker to another, and then another. It was insane.

frashman 20-06-2004 22:57

Re: Making Realbot suck at shooting for once
 
yes so it should be correct

yangmungi 23-06-2004 15:04

Re: Making Realbot suck at shooting for once
 
2 Questions
1. Whats the constant of 2500?
2. Does AimAtEnemy() modify where the bot is facing or where the bullets will go?

Note: i noticed the bots don't share the same recoil as our human buddies

stefanhendriks 23-06-2004 16:04

Re: Making Realbot suck at shooting for once
 
1. the constant is a distance, (ie the further away, the more 'fuzz'). I have upped this to 4096 in the new source
2. the AImAtEnemy() function modifies their 'gun' position.

And to you rnote:
the CS DLL makes bots have the same effect in recoil as humans...

V or 'Tex 24-06-2004 00:01

Re: Making Realbot suck at shooting for once
 
Aye, I think the bots should keep their superhuman turning because at skill 0 it is still easy for me to be 5-1 against them in a 6 vs 6 match.


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

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