Thread: Bot Aiming
View Single Post
Re: Bot Aiming
Old
  (#15)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Bot Aiming - 31-12-2004

if you run around a bot using this aiming algorithm with a constant angular velocity, you won't be hit ( if momentum, speed are not at instant aiming and the bullet spread isnt that big ).

some more info : http://johannes.lampel.net/joebotxp/botaim/index.html

the difference between the current angle will stay at a constant value, see diagram 1. This difference is related to the speed as (1-c)*currentSpeed. Thus the last diagram is the corrected one, which should allow a bot to kill you when you are running around a bot . so just a bit of correction is needed, and of course a local storage of the current state of the algorithm, before correcting

Code:
float a=.95,  // momemtum
 idealSpeed,
 c=.02,   // overall_speed
 aNow,   // recalculated momentum based on framerate
 fADiff;
float fmsecCount50 = m_fmsecCount / 50.0f;
float fAngleChange;
fADiff = abs(m_VIdealAngles.y - m_VCurrentAngles.y);
if(fADiff>180.0f){if(m_VIdealAngles.y > 0){m_VIdealAngles.y -= 360.0f;}
 else{m_VIdealAngles.y += 360.0f;}}
// compute the ideal angle speed (i.e, the amount of turning we WOULD want to do)
idealSpeed = (m_VIdealAngles.y - m_VCurrentAngles.y);
idealSpeed = idealSpeed*c;
// compute the new momentum given the previous one
aNow = exp(log(a) * fmsecCount50);
// compute the angle speed (i.e, the amount of turning we will actually achieve this frame)
m_fAngleSpeedYaw = m_fAngleSpeedYaw*aNow + idealSpeed*(1.f-aNow);
// calculate how big the actual angel change is
fAngleChange = m_fAngleSpeedYaw * (fmsecCount50);
m_VCurrentAngles.y += fAngleChange;
// ((1.f - c) * fAngleChange) to compensate 'shooting behind enemy'
m_pEntity.getEntity()->v.angles.y = m_VCurrentAngles.y + (1.f - c) * fAngleChange;
at least it's better than before, but I gotta test it in more different situations ... testing aiming inside the game isnt funny



Last edited by @$3.1415rin; 31-12-2004 at 22:28..
  
Reply With Quote