UDK game Prisoners/Guards

For school I need to make a little game with UDK, the concept of the game is:

The player is the headguard, he will have some other guard (bots) who will follow him. Between the other guards and the player are some prisoners who need to evade the other guards.

It needs to look like this

My idea was to let the guard bots follow the player at a certain distance and let the prisoners bots in the middle try to evade the guard bots. Now is the problem i'm new to Unreal Script and the school doesn't support me that well.

Untill now I have only was able to make the guard bots follow me. I hope you guys can help me or make me something that will make this game work.

Here is the class i'm using to let te bots follow me:

class ChaseControllerAI extends AIController;

var Pawn player;
var float minimalDistance;
var float speed;
var float distanceToPlayer;
var vector selfToPlayer;

auto state Idle
{
function BeginState(Name PreviousStateName)
{

Super.BeginState(PreviousStateName);
}

event SeePlayer(Pawn p)
{

player = p;
GotoState('Chase');
}
Begin:

player = none;
self.Pawn.Velocity.x = 0.0;
self.Pawn.Velocity.Y = 0.0;
self.Pawn.Velocity.Z = 0.0;
}
state Chase
{
function BeginState(Name PreviousStateName)
{

Super.BeginState(PreviousStateName);
}
event PlayerOutOfReach()
{
Log("ChaseControllerAI CHASE Player out of reach.");

GotoState('Idle');
}
//  class ChaseController extends AIController; CONTINUED
// State Chase (continued)
event Tick(float deltaTime)
{
Log("ChaseControllerAI in Event Tick.");

selfToPlayer =  self.player.Location - self.Pawn.Location;
distanceToPlayer = Abs(VSize(selfToPlayer));

if (distanceToPlayer > minimalDistance)
{
PlayerOutOfReach();
}
else
{
self.Pawn.Velocity = Normal(selfToPlayer) * speed;
//self.Pawn.Acceleration =    Normal(selfToPlayer) * speed;
self.Pawn.SetRotation(rotator(selfToPlayer));
self.Pawn.Move(self.Pawn.Velocity*0.001); // or *deltaTime
}
}
Begin:
Log("Current state Chase:Begin: " @GetStateName()@"");
}

defaultproperties
{
bIsPlayer= true;
minimalDistance = 1024; //org 1024
speed = 500;
}

• Have you looked into something like steering behaviors at all? There are some relatively simple things you can do like for seeking points and fleeing from points that might be relevant: red3d.com/cwr/steer/SeekFlee.html – Tetrad Jan 13 '12 at 16:58
• Can you give us one atomic thing that you would like to accomplish but haven't? "I would like to make the prisoners attempt to escape from the guards when they see x kind of opportunity." Something like that? – user9485 Mar 12 '12 at 22:43
• "self.Pawn.Velocity = Normal(selfToPlayer) * speed;" is this the pawns moving directly towards the player? that would let the prisioners escape. Is best if pawns move to some desired location that is positioned relative to other point, and make that point the same for all paws. Possible make that point the "center of mass" of all prisioners. You can also make so the "desire to move near this point" is limited by the distance from pawn to pawn. If the distance from pawn to pawn is bigger than the prisioner size, the pawns will want to move to the center.. – Tei Apr 27 '12 at 13:01
• What you are doing here is similar to a wolfpack hunting. – Tei Apr 27 '12 at 13:02

Assuming that the idea is that prisoners want to escape the circle of guards, trying to avoid them, what you could try is to apply something like the potential fields approach: http://aigamedev.com/open/tutorials/potential-fields/ With potential fields, guards will apply a repulsive force to the prisoners that come too close to them, and this will change the path prisoners will try to follow, apparently trying to stay away from them. I suppose prisoners will try to move to a position outside the circle of guards: in a simple way, if your prisoner is moving in the direction of a point outside the circle, at each update (or less frequently) you can check if it is close enough (sees) to any guard, and in the update do:

self.Velocity = Normal(self.Velocity) * speed;

// distance is the distance between this Prisoner and the closest Guards,
// minDistance is the distance at which if
if (distance < minDistance)
{
vector rp = Normal(guard.RepulsiveForce) * (minDistance / distance);
self.Velocity += rp;
}
`

Of course the Guard class needs a RepulsiveForce vector that will indicate the direction to which he will try to push close Prisoners: this vector will modify the current velocities of Prisoners that get close enough, and they will look like they will try to avoid them. But again, what you should also do is running a path planning algorithm (like A* star) for the prisoners to find a path and, while running the A*, treat the Guards (probably with a bigger influence circle) as obstacles.