| 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.

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

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.

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;
        }
      }
   }
}

Ironblayde: I'm just getting started in UnrealScript. As it happens, I picked CTFGame to start working through and tinkering with, and I found this today as well. If I'm interpreting it correctly, AlternatePath selection will work correctly if there are no Return Only AlternatePaths of the relevant color. Otherwise, since Return Only pathnodes are included in the search to find a destination, you could have a situation like this. Suppose a red bot is spawning and has four blue AlternatePaths to choose from:

AltPath0 – Weight 1.0

AltPath1 – Weight 1.0 – RETURN ONLY

AltPath2 – Weight 1.0 – RETURN ONLY

AltPath3 – Weight 1.0

Since only the first and last paths are included in the computation of TotalWeight, we'll get TotalWeight = 2.0, thus Selection will be on [0.0, 2.0), meaning that the choice will be 50/50 between AltPath0 and AltPath1, even though the latter should theoretically not be used.

This is the only place that an AlternatePath is assigned to an attacker, isn't it? I only found one other instance of an AlternatePath being assigned, and it was in CTFFlag where one is assigned to someone returning with a flag. Am I reading the code right, i.e. is this confirmed to be a mistake in the code? Forgive me if I'm a few years behind. ;)

Also, does anyone have any idea why an AlternatePath would only be assigned 80% of the time? I assume that in the other 20% of cases, bots will just take the most direct route to the flag?

Sorry for the long thread mode remarks... I promise I'll refactor this page as soon as I'm certain what's going on here. ;)

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

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In