| Home Page | Recent Changes | Preferences

AlternatePath

UT :: Actor (UT) >> NavigationPoint (UT) >> AlternatePath (Package: Botpack)

The AlternatePath actor tells the bots where to go to reach an enemy flag in a CTF level when there are more than one distinct paths available. Place AlternatePath actors at the 'start' of each possible path.

Tarquin: where is the "start" of a path? CTF-EternalCave has them about 4 pathnodes beyond the forking point.

EntropicLqd: There is no "start". Routes are calculated from wherever the bot happens to be to wherever they feel like they should be going.

Tarquin: so... a bot always looks for the quickest route to the flag. If that route & another possible route both contain an AlternatePath actor, it considers both of those to be of equal length & picks according to SelectionWeight?

The plot thickens: forum snip from ChrisToth.Hu:

Alternatepath actors are used for marking the ENTRANCES to the enemy base. It should belong to the team whose base the path leads into. The selectionweight value should balance the lenght of the different routes. So if one path is longer and the bots don't like to use it, then raise the SW value.

and a snip from the UT AI article:

AlternatePaths are used to indicate alternate routes that bots can use to enter an opponent's base. The AlternatePath's team attribute should be the same as the team of the FlagBase for which the AlternatePath is pointing out a route. The AlternatePath's SelectionWeight is used to modify the likelihood of bots using that path. Bots use AlternatePaths by first moving along the shortest route to the AlternatePath they have chosen, and then moving along the shortest route from their to the FlagBase. If the AlternatePath is set up so that the shortest route to the AltermatePath involves running right by the FlagBase, bots will do that (a bad thing!). The location of AlternatePaths may need to be adjusted to provide the desired results. AlternatePaths with the bReturnOnly flag set true are used by bots with the same team number returning to their base with a flag.

This seems to be saying:

  • Team = Red: blue bots use this to attack the red base
  • Team = Red, bReturnOnly = true. Red bots use this to go home.

Arg! Though I suppose it sort of makes sense: an AltPath's Team gives the base it leads to.

I presume there can't be several tiers of AltPaths.

Refactor Me

Properties

Team
AlternatePath actors are team specific and this must be set here. For a normal CTF map the value of the Team property is the number of the team that should be using the path. For a CTF4 map, the Team property should be set to the number of the team the path goes to.
  • 0 = Red Team
  • 1 = Blue Team
  • 2 = Green Team
  • 3 = Gold Team
SelectionWeight
this changes the selection 'weight' of a given AlternatePath to make that direction more/less desirable.

Tarquin: I'm fiddling with this value to try and make bots use one of my altpaths. Current setting is 500, and they are still not taking it (other paths are set to 1 (default), 10 and 15. What do these damn bots want?

SabbathCat: I'm was having quite serious problems getting bots to follow certain parts in a map I'm working on, so I made a test map with 3 paths for each team and set up alternate paths with values of -1, 0 and 1. The paths the bots took the most seemed to be the middle , which was a value of 1! I'm confused. The paths are all equidistant from the flag, which really boggles me.

One thing I found that does appear to work is ExtraCost on PathNodes, I exchanged all the altpaths for PathNodes with values of 2560,1024 and 512. and the bots all steered towards the shortest (in ExtraCost terms). :)

[Here are the two test maps I created] if you're interested :)

EntropicLqd: I've been looking through the AlternatePath coding in Botpack.CTFGame (UT) - and the code is very odd. It uses the sum of all of the alternate path weightings (that are not return only types) to get a total of the weightings. This total is then used to pick an AlternatePath. The curious thing is that when selecting the AlternatePath to use, return only Alternate Paths are also used. Here's the code snippet.

function bool RestartPlayer(Pawn aPlayer)
{
  // Prior code snipped - post code slightly reformatted from original
  if ( FRand() < 0.8 )
  {
    for ( N=Level.NavigationPointList; N!=None; N=N.nextNavigationPoint )
    {
      if ( N.IsA('AlternatePath') &&
           (AlternatePath(N).team != B.PlayerReplicationInfo.team)
           && !AlternatePath(N).bReturnOnly )
      {
        TotalWeight += AlternatePath(N).SelectionWeight;
      }
    }
    selection = FRand() * TotalWeight;

    for ( N=Level.NavigationPointList; N!=None; N=N.nextNavigationPoint )
    {
      // Look - all alternate path nodes are counted - weird.
      if ( N.IsA('AlternatePath') &&
           (AlternatePath(N).team != B.PlayerReplicationInfo.team) )
      {
        B.AlternatePath = AlternatePath(N);
        PartialWeight += AlternatePath(N).SelectionWeight;
        if ( PartialWeight > selection )
        {
          break;
        }
      }
   }
}

Related Topics


Category Class (UT)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In