View Single Post
The f____ shield. How to get bots to deal with it?
Old
  (#1)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default The f____ shield. How to get bots to deal with it? - 20-01-2004

I've been trying to get bots to successfully attack a player with a shield. I've used the animation sequence to detect if a player has the shield active or inactive, this seems to work fine:

Code:
if ( ptrTarget->v.weaponanim == 5 || ptrTarget->v.weaponanim == 6 ) 
{
	 // shield is active
}
else
{
	 // shield is not active
}
Now what I need is to detect if a bot can hit the player behind an activated shield or not. For example, if the bot is behind the target player, then it can hit the player even when the players shield is active. The same can be done from the side, or various angles from above and below (but let's forget about the 3rd dimension for now).

I've thought of some methods to decide if a bot can hit the player or not, but none of them are as good as I want. The best solution is probably to somehow calculate if the target player is facing an angle relative to the targeting bot that leaves the target exposed. I've almost completely forgotten my linear algebra so I have no idea how to calculate this, although it should be a simple calculation.

Imagine we look at the origin of targeting bot (B) and the target player with shield (T).

In two dimensional space (x,y) we can draw a line (L1) between origin B and origin T. We can also draw a line (L2) from where the bot is facing to some point forward of the bot (just imagine a short line pointing forward out from where the bot is facing). Now we can draw another line (L3) from origin B to the end point of line L2. This will form a closed triangle and we're interested in computing the angle inside the triangle located at origin T. If the angle is 0 (degrees) then the target cannot be hit (directly facing B), if the angle is 90 then the target's side is exposed, and if the the angle is 180 then the target's back is fully exposed and can be hit.

So anyone know of how I can compute this?


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut
  
Reply With Quote