.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > HPB_bot
HPB_bot The trusty good ole mechs by botman HLDMTFCOpposing ForceDMCFront Line Force

Reply
 
Thread Tools
Angle offset bug
Old
  (#1)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Angle offset bug - 03-12-2004

I think this is an aged old error but I still cant figured out how to fix it

we assume we define a vector "vec"

Code:
   Vector look_vec = UTIL_VecToAngles( vec );
   
   pEdict->v.ideal_yaw = look_vec.y;
   BotFixIdealYaw(pEdict);
 
   pEdict->v.v_angle.x = look_vec.x;
 
   if (pBot->pEdict->v.v_angle.x > 180)
	pBot->pEdict->v.v_angle.x -=360;
 
   pEdict->v.angles.x = pEdict->v.v_angle.x / 3;
   pEdict->v.v_angle.x = -pEdict->v.v_angle.x;
The bot's aiming seems to be a bit off to the right side , how can this happen ?
  
Reply With Quote
Re: Angle offset bug
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Angle offset bug - 03-12-2004

This ain't making the bot aim to the right side. The only thing that could cause the effect you're witnessing may be the weapon recoil. Especially if you use the bots in realistic mods such as Counter-Strike (which I bet that's what you're trying to do).

This behaviour is not a bug in the HPB_bot, but rather a lack of a functionality, which is recoil compensation.

To compensate for the recoil, most bot authors compute their aiming vector by taking in account the "punchangle" variable in the bot's entvars structure.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Angle offset bug
Old
  (#3)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Angle offset bug - 04-12-2004

thats not the problem , because that happen although in freezetime , but when I change the code to

Code:
   pEdict->v.v_angle = UTIL_VecToAngles( vec );
   if (pEdict->v.v_angle.y > 180)
	  pEdict->v.v_angle.y -=360;
   // Paulo-La-Frite - START bot aiming bug fix
   if (pEdict->v.v_angle.x > 180)
	  pEdict->v.v_angle.x -=360;
   // set the body angles to point the gun correctly
   pEdict->v.angles.x = pEdict->v.v_angle.x / 3;
   pEdict->v.angles.y = pEdict->v.v_angle.y;
   pEdict->v.angles.z = 0;
		  
   // adjust the view angle pitch to aim correctly (MUST be after body v.angles stuff)
   pEdict->v.v_angle.x = -pEdict->v.v_angle.x;
   // Paulo-La-Frite - END
   pEdict->v.ideal_yaw = pEdict->v.v_angle.y;
 
   BotFixIdealYaw(pEdict);
The problem will go away ! But it was unrealistic anyway ...
  
Reply With Quote
Re: Angle offset bug
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Angle offset bug - 04-12-2004

It IS the problem. If you make your bot lock on the target immediately, absolutely each frame, the punch angle has no effect, neither has the weapon recoil. But since bots feature random offset variations to simulate human-like aim, this variation gets multiplied by the punch angle. Simple as that.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Angle offset bug
Old
  (#5)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Angle offset bug - 04-12-2004

no , I just force the bot to aim at the enemy head

Code:
   Vector v_enemy = v_enemy = (pBot->pBotEnemy->v.origin + pBot->pBotEnemy->v.view_ofs) -
				 GetGunPosition(pEdict);
  
Reply With Quote
Re: Angle offset bug
Old
  (#6)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Angle offset bug - 04-12-2004

yes, this is just what I'm saying. So what ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Angle offset bug
Old
  (#7)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Angle offset bug - 04-12-2004

lol , I missed the word "punch angle"

And why , it only happen sometimes and always to the yaw angle ? It never happen at "x" and "z" , I dont think it is because of the punch angle

Last edited by Rifleman; 04-12-2004 at 12:17..
  
Reply With Quote
Re: Angle offset bug
Old
  (#8)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Angle offset bug - 04-12-2004

It depends on how the mod DLL implements it.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Angle offset bug
Old
  (#9)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Angle offset bug - 06-12-2004

finally I figured it out , it is caused by the function BotFixIdealYaw()

The HPB_Bot template one is :

Code:
void BotFixIdealYaw(edict_t *pEdict)
{
   // check for wrap around of angle...
   if (pEdict->v.ideal_yaw >= 180)
	  pEdict->v.ideal_yaw -= 360 * ((int) (pEdict->v.ideal_yaw / 360) + 1);
   if (pEdict->v.ideal_yaw < -180)
	  pEdict->v.ideal_yaw += 360 * ((int) (-pEdict->v.ideal_yaw / 360) + 1);
}
It should rather be :

Code:
void BotFixIdealYaw(edict_t *pEdict)
{
   // check for wrap around of angle...
   if (pEdict->v.ideal_yaw > 180)
	  pEdict->v.ideal_yaw -= 360;
   if (pEdict->v.ideal_yaw < -180)
	  pEdict->v.ideal_yaw += 360;
}
Dont know wherever its the solution , havent test it out yet , but I think that is the solution since no other code are related to aiming and angle
  
Reply With Quote
Re: Angle offset bug
Old
  (#10)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Angle offset bug - 06-12-2004

No, this is NOT the cause. Are you listening to what we tell you ?????

By doing this you introduced a new bug that will make the engine crash if ever an angle greater than 540 is passed to it through BotFixIdealYaw.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com