Announcement

Collapse
No announcement yet.

Bot Targeting/Aim problem in BR game

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Bot Targeting/Aim problem in BR game

    I'm posting this question here in hopes of getting better response (original can be found @ http://forums.beyondunreal.com/showthread.php?t=127292).

    [original post follows]
    I'm working on creating a new controller class that will play bombing run (hopefully) better.

    One technique I want the bots to use is to shoot the ball while in the air with a shockrifle class weapon. I do a check based upon bot location relative to the goal and ball, weapon type, etc. in my ShootAtBall() function. If everything looks good, it returns true.

    Code:
    function Tick(float deltaTime)
    {
    	Super.Tick(deltaTime);
    	
    	if(ShootAtBall())
    	{
    		Target = BombingRunSquadAI(Squad).Bomb;
    		Enemy = Pawn(ShotTarget);
    		Log("ShotFiredAtBall="$Pawn.Weapon.StartFire(0));
    	}
    }
    If I use the previous code, the bot will shoot the ball fairly regularly, however, if I make the following modifications, the bot will hit the ball often enough to "juggle" it. (I think this is more desirable because I will be able to grant a greater range of skill to the bots).
    Code:
    function Tick(float deltaTime)
    {
    	Super.Tick(deltaTime);
    	
    	if(ShootAtBall())
    	{
    		Target = BombingRunSquadAI(Squad).Bomb;
    		//Enemy = Pawn(ShotTarget);
    		//Log("ShotFiredAtBall="$Pawn.Weapon.StartFire(0));
    	}
    }
    I've also checked the bot state and it seems that it is almost always in the fallback or roaming state.

    Given these observations, I have three concerns:
    1). I am not sure that tick is the best place for this check but am unaware of a better solution. The Shock combo is done through a Monitor function in the ShockRifle's tick function, but I'm not sure I need to be that precise. Perhaps I could use a timer in a new state*?
    2). If I do not control when or how often the bot shoots (as in example 2), I am unable to effectively scale the bot's abilities based upon skill levels.
    3). In my trials, the bot never fails to hit the ball. How do I attach the aimError function to the shot attempt?

    Any insight is greatly appreciated.

    *[edit]A link or example (for constructing a timer or applying the aimerror) would be appreciated.[/edit]

    #2
    Hmm, I don't think you'll get an answer here either.

    I can't seem to make out what you want the bot to do, be more accurate at shooting the ball?

    If thats the case, you'll need to decrease their aimerror when target or enemy = the ball, and reset it back when they change enemy from the ball, but that will be very very hard, as each weapon fire mode has it's own aimerror.

    You could:

    Code:
    function float AdjustAimError(float aimerror, float TargetDist, bool bDefendMelee, bool bInstantProj, bool bLeadTargetNow ){
    Super.AdjustAimError(aimerror,TargetDist,bDefendMelee,bInstantProj,bLeadTargetNow );
    if (Target == BombingRunSquadAI(Squad).Bomb) {
     return 0.0;
     }
    }
    That may work.

    Comment


      #3
      Thanks for the reply, Morphias,

      It seems that aimerror is zero already -- that is, I've never seen them miss a shot at the ball. I'll have to look around the AdjustAimError call (in the Bot? or ShockRifle?) to see if I can find out more about what is going on. I might be able to do something similar to what you mentioned (that would actually apply some error to the shots).

      Do you think that Tick() is the place for this sort of thing? Seems like I shouldn't need them shooting the ball multiple times -- I could also restrict this somewhat using a distance measure. I'll have to keep looking ...

      Comment


        #4
        This is cool. Bots combo-juggling the ball

        One thing you would be wise to add is Puck Combo-ing, i.e. a bot launches his translocator beacon towards where he wants to go, combos it, then translocates. Also, launching the puck with a hammer/shieldgun... looks like you've got the code for it already.

        As far as where to put the function call, yeah, tick isn't the best, but it's a b**** to find a better spot. States maybe?

        Comment

        Working...
        X