.:: 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
Bot aiming (the /=-3 part)
Old
  (#1)
DarkAngel
Member
 
Status: Offline
Posts: 2
Join Date: Feb 2005
Default Bot aiming (the /=-3 part) - 10-02-2005

Hey, ive been HL modding for a long time, but not with bots. Ive come across code in the SDK which divides a players pitch by -3 but never knew why. Now that im making a bot, ive noticed that sometimes they aim at the ground in front of a player by mistake, and i think its to do with this 3 business.

ATM my code works like this:
Code:
 
pEdict->v.v_angle.x = -pEdict->v.v_angle.x;
//  Run the bot's brain here
 while(pEdict->v.angles.x>180)pEdict->v.angles.x-=360;
 while(pEdict->v.angles.x<-180)pEdict->v.angles.x+=360;
 pEdict->v.angles.x = pEdict->v.v_angle.x/3.0f;
 pEdict->v.angles.y = pEdict->v.v_angle.y;
 pEdict->v.angles.z = 0;
 pEdict->v.v_angle.x = -pEdict->v.v_angle.x;
 g_engfuncs.pfnRunPlayerMove( pEdict, pEdict->v.v_angle, flMoveSpeed,
		 flStrafeSpeed, 0, pEdict->v.button, 0, gpGlobals->frametime*1000);
is this correct? and could someone explain why the pitch has to be divided by 3? or should it be -3?
  
Reply With Quote
Re: Bot aiming (the /=-3 part)
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: Bot aiming (the /=-3 part) - 10-02-2005

I suppose you are not completely aware of the difference between view angles and body angles. The view angles can be seen as the angles of the head, while the body angles can be seen as the angles of the rest of the body.

When a player looks upwards at let's say +45 degrees, his body should bend back about 15 degrees. Since this value is function of the head's angles, we found that

body angles pitch = - view angles pitch / 3

was a good value. I don't think your problem with the bots aiming at the ground is related to this fact in any way. I would rather look at the waypoint navigation.



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: Bot aiming (the /=-3 part)
Old
  (#3)
DarkAngel
Member
 
Status: Offline
Posts: 2
Join Date: Feb 2005
Default Re: Bot aiming (the /=-3 part) - 14-02-2005

yeh im aware that angles is the rotation of the model while v_angles is the roation of the view, i just assumed that the server would use the 'angles' for firing bullets, but i just realised that it makes its aim vector from "m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle", so i guess my assumption was wrong.
thanks anyway for the answer tho (that player models pitch is out of 30 rather than 90 so that players dont run around horizontally).

allthough i dont know what u mean by "we found that .. was a good value" seeing valve/ID used -3 in the SDK..



im using some fairly basic aiming code atm, which ill list below for discussive purposes (allthough if theres any other bot n00bs like me on here, feel free to use it)
Code:
 
Vector vecLook = vecLookPos - pBot->pEdict->v.origin;
Vector vecAngles = UTIL_VecToAngles( vecLook );
pBot->pEdict->v.ideal_yaw = vecAngles.y;
pBot->pEdict->v.idealpitch = vecAngles.x;
pBot->FixIdealYaw();
pBot->FixIdealPitch();
float turnrate;
turnrate = min( turnSpeed, fabsf( 50*UTIL_AngleDiff( pBot->pEdict->v.ideal_yaw, pBot->pEdict->v.v_angles.y ) ) );
pBot->ChangeYaw( gpGlobals->frametime*turnrate );
turnrate = min( turnSpeed, fabsf( 50*UTIL_AngleDiff( pBot->pEdict->v.idealpitch, pBot->pEdict->v.v_angles.x ) ) );
pBot->ChangePitch( gpGlobals->frametime*turnrate );
Now that i look over this code again, i think my problem is that im not figguring the bots view height into the equation (The aim direction is a line from the bots center to its target, instead of its head to target)... i guess ill go checko_O

Last edited by DarkAngel; 14-02-2005 at 14:16..
  
Reply With Quote
Re: Bot aiming (the /=-3 part)
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: Bot aiming (the /=-3 part) - 14-02-2005

Ah, I forgot to tell you too: for some weirdass reason, when working with ideal angles, the pitch must be reverted

Look in the BotAim 2 plugin code for an example of this.



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