I'm working on a Tower Defense game with my team, and I've been trying to get bots to path through the level to a goal line, where they make a noise and are destroyed.
I'm in prototyping phase, and I have them running in a squiggly line through the level, using Kismet Move-tos to work from one path node to another.
However, they bunch up at the first or second nodes, and sometimes one will skip ahead to much farther down the line of nodes and take a short cut, and then a few others will jostle for positions at various nodes; usually, only one will finally make his way through the whole system and trigger the goal.
I personally have tried:
- Using Pylons (I set up four to cover the map, made sure they didn't overlap, and tried using both the sequence of path nodes and just telling them to try to find the goal zone)
- Using different AI controllers (None, UT, UDK, and basic AI) but they all behave similarly or poorer than UTBot
- Moving the nodes around to clarify the lines of sight but no luck there
- Creating 7 empty variables (one for each bot) instead of just one, but no luck
I also took a look at the script for the Dungeon Defenders UDKRTSAIController, which apparently can find its way using just a pylons-based navmesh, but am not sure I get it. It extends AIController, and included this helpful-looking code:
But I'm not sure how that'll be helpful, especially because the UDKRTSAIController is 1,439 lines long. The Developer also includes some additional code in his diary, about which he says "These few bits of code are essentially all it takes for an AI Controller to walk through navigation results from a Nav Mesh." The few bits of code follow:
function MoveToPoint(Vector MovePoint, optional bool DisableAutomation)
// If disabling automation, clear the WhatToDo timer
if (DisableAutomation && IsTimerActive(NameOf(WhatToDo)))
// Move to a point in the world
Destination = MovePoint;
FocusSpot = MovePoint;
Resource = None;
It would be great if we could drop a pawn into a simple navmesh and tell them to find the goal line and go there, but I'm not 100% sure how this would be accomplished.
if( NavigationHandleClass != None && NavigationHandle == none )
NavigationHandle = new(self) class'NavigationHandle';
event vector GeneratePathToActor( Actor Goal, optional float WithinDistance, optional bool bAllowPartialPath )
local vector NextDest;
//set our return value equal to our destination Actor’s Location.
//In case it’s directly reachable or pathfinding fails, we’ll just return this.
NextDest = Goal.Location;
if ( NavigationHandle == None )
//if the Actor isn’t directly reachable, then try to find the next navigation point towards it.
//Otherwise we’ll just return its location to go there directly.
class'NavMeshPath_Toward'.static.TowardGoal( NavigationHandle, Goal );
class'NavMeshGoal_At'.static.AtActor( NavigationHandle, Goal, WithinDistance, true );
if ( NavigationHandle.FindPath() )
Can anyone offer any help? I am sadly not a great programmer.