Announcement

Collapse
No announcement yet.

Moving GameObjective

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

    Moving GameObjective

    I'm coding the TeamAI and SquadAI for my gametype and I'm having a problem getting bots to target a moving objective.

    I have a class derived from GameObjective with bStatic set to false so that I can dynamically spawn them during play. The Objective is attached to an object that moves around. When I set the Objective as a squads SquadObjective (by returning the objective in GetPriorityAttackObjectiveFor) the bots recognize it as their objective, but are unable to path to it.

    I know bots can path to moving objects (they chase the flag in CTF) but I can't figure out why they won't path to the GameObjective. Could it be that since it's a GameObjective they are looking for predetermined paths made during compiling the map?

    I've tried overriding TellBotHowToDisable and SpecialHandling to return a path to the actor the Objective is attached to, but that doesn't seem to work either.

    #2
    Do you need to use AddToNavigation to get bots to notice the new navigation node?

    Comment


      #3
      That function is part of the Pickup class, I'm deriving from GameObjective. Thanks for the guess though, I didn't know of the function until you mentioned it. Thankfully I've solved the issue for now.

      The problem ended up being due to the way the pathing was set up on the map. Since the gametype uses vehicles, RoadPaths were used in some areas. Roadpaths can see eachother from farther apart than regular path nodes. If the Objective was dropped somewhere in between two RoadPaths then the bots couldn't path to it because it was too far from both of them. This could also happen on a regular map if the paths don't extend into little used areas (corners of rooms, etc..).

      I've solved the issue by overriding TellBotHowToDisable() and first checking if the Objective is in sight, if so I tell the bot to StartMoveToward() the Objective. If it's not in sight we try to path to it with FindPathToward(), if that works than we return FindPathToObjective() which calls FindPathToward(). If FindPathToward() is unable to path to the Objective than I iterate through the navigation points and find the nearest one to the Objective. I send the bot on it's way there, and once it's close enough it will be in the line of sight to the Objective and the StartMoveToward() will be called.

      This seems to work so far, except for some instances where the nearest navigation point was on the other side of a wall, so I've added a FastTrace check from the Objective to the nearest navigation point. I've also done some caching where if the Objective hasn't moved than we don't check for the closet nav point again, we use the old one.

      Comment

      Working...
      X