I have noticed that in Controller.uc there is a var for bSeeFriendly:
/** Do visibility checks, call SeePlayer events() for pawns on same team as self. Setting to true will result in a lot more AI visibility line checks. */
var bool bSeeFriendly;
It states that setting this to true results in a lot more AI visibility line checks.
In my game, all my bots see each other (triggers SeePlayer or SeeMonster), so I’d quite like to reduce these necessary line checks.
How would I limit my bots to only see a particular pawn type?
I’ve extracted the basis for how I do it, I don’t use the See events.
When I want my Bot to move or look for a target they search on each class then add to an array and randomly choose a bot at the end. With a bot selected you can then gets it location and use moveto or fire or whatever … you’d add a sleep or get them to do another action if they cannot select a target.
ForEach AllActors(class'MyClassOfBot', zp)
{
if (zp.IsAliveAndWell())
{
farAway = vsize(Pawn.Location - zp.Location);
if (farAway < SightDistance)
{
i+=1;
PList.AddItem(zp);
}
if (farAway < MelleeDistance)
{
m+=1;
MelleeList.AddItem(zp);
}
}
}
// repeat above for each class you want to find
// then at end the end randomly choose 1 from an array and get its location
// and use that location to get the Bot to move to it
I’m primarily talking about the overhead in the native controller code that is continually checking visibility. There are certain bots on my map that I’d actually like to completely disable their sight.
Does anyone know how I would do this?
Thats what I do, I don’t use sight, I code it myself and maintain control over what Bots I want to process …
Sorry @Yummy-Vegatables, i’m not sure what you mean. So you don’t extend from Controller.uc? Because if you are, then your bots are continuously doing trace line checks. Unless you’ve somehow disabled their sight.
The
ForEach AllActors(class'MyClassOfBot', zp)
you mention; which actor is this running in?
That bool bSeeFriendly does the traces if set to true. I extend off AIController which does extend from Controller.
What I understood is you wanted to find a way to detect specific bots and do some action only on those specific bots and not have to rely on the see events and set the bSeeFriendly to true as it does extra checks if set to true.
The ForEach AllActors(class’MyClassOfBot’, zp) is looking at the AI’s pawn class. I do this check periodically, I add a sleep with a variable time which is configurable in the game. Obviously the lower the sleep value the greater the likelihood of more subsequent actions for the bot. For example if nothing is within a specific range then sleep for a long period otherwise reduce the interval based on distance and what it is you want the AI to do.
That way you can control reactions of the bot as I suspect the reactions and sleep values for close in combat or if its a sniper and target has just come within range would differ.
That’s fine for SP game, but mine is multiplayer. I’m really just looking for a way to disable line-of-sight traces being drawn in the controller every tick.