Jump to content
Sign in to follow this  

Harvester AI Pathfinding - Advanced detail on innate pathfinding logic

Recommended Posts


First read and follow Laubi's original tutorial on "Harvester AI Pathfinding" (W3Dhub link).  This tutorial has been around for a very long time.

The attached "harvtest_paths.zip" file contains three example .mix maps for you to try out, each one is mentioned in the appropriate sections below.  To play these you need to:

  1. Extract the .mix files to your Renegade/Data/ folder (typically C:\Westwood\Renegade\Data\)
  2. Start Renegade
  3. Choose "Host a LAN game"
  4. Change the settings to be:
    1. Max players = 1
    2. Dedicated = no
    3. Map rotation = any one of these three maps

Between the buildings on the map is a flying harvester that you can enter.  Flying above the map makes it easier to see what is going on.

You should be running an up-to-date copy of TT/scripts and the latest version of Leveledit (not the version shipped by Westwood, see the TiberianTechnologies website).  It contains several fixes that may affect how well you can follow the techniques in this tutorial.


We're on an island floating far above a lava ocean.  On one side of the island are the Nod & GDI bases, on the other far end is the tiberium field:


In between the two bases is a maze with many possible routes for the harvesters to take

First: setup your map as normal (and as per Laubi's tutorial), but don't create any waypaths for the harvesters just yet.  Make sure to place the "Human" pathfind generator and generate pathfinding sectors for your map.

In LevelEdit you can show the generated sectors using the menu item Pathfinding->Display Sectors:


Note the greeny-blue boxes that appear.  Each one is a 'zone' that objects can travel within, and each connects to the sectors that touch it.  Objects in the game work out how to get from point A to point B by following a chain of these sectors.

You do not actually need to create waypaths for your harvesters

Despite all of the traditional advice: harvesters do NOT need waypaths.  They can find their way to the fields and back all on their own using the pathfinding sectors.  The only waypaths you need on your whole map are the short ones exiting your Weapons Factory and Airstrip, so that vehicles drive out a little after being created.

By default harvesters always start in this 'self-navigating' mode once they leave the WF/Air.  They only start using waypaths when they "accidentally" encounter one whilst driving (and several other conditions are met, described later in this tut).

If you don't believe me: try it.  According to JonWil there is no special code (in Vanilla Renegade harvesters) for handling waypaths. My understanding is that they incidentally can use waypaths because the W3D engine's normal innate pathfinding code (used by all AI) handles using waypaths.

On the example map for this tutorial: harvesters are picking a non-optimal route when left to work things out on their own:
Try the map C&C_Harvpath_nopaths.mix to see this yourself.

How do harvesters "enter" a waypath?

(1) When a harvester is created: it uses the pathfinding sectors to find its own route to the tiberium field (or other destination) and starts on this route.

(2) Every time the harvester enters a new sector it checks to see if there are any waypaths that start in this sector.

A harvester will only follow one of these detected waypaths if multiples conditions are met:

  1. The path is of type 'innate'
  2. The end of the path is closer to the harvester's target than where the harvester currently is.
  3. (Possibly some distance or number-of sector metrics, unknown)

Once the harv starts following a waypath it will not leave it until the path ends.

How do I design my waypaths?

First find the path your harvesters take on their own.  Play your map in-game to find out.

Next create a path that starts from one of the sectors your harvester crosses.  End this path near (or closer to) the tib field:


Try the map C&C_Harvpath_Pathed.mix to see this working.  Both harvs end up getting caught by the one path in this example (but you generally want to add separate paths for each), and the path is not perfect so they start grinding against the walls.

You can use any type of waypath provided in LE, they're all the same:


I actually use the 'flying vehicle only waypath' just to make people feel unsettled.

The only requirements are that you change the waypath settings to enable 'Innate Pathfind' after you create it.  You get to this dialog by double-clicking a node on the waypath (not the line part of the path):


Two-way is an option that is legitimately accepted by the game and useful to consider.  The Human/Ground/Air fields appear to do nothing at all, you can even un-tick them and your harv will still follow the path.

You do NOT need to re-calculate pathfinding after making or changing any waypoints.  Waypoints are a separate part of the system that are handled during map export (to .MIX).  This feature may be buggy in older versions of LevelEdit.


Here's an example of a waypath that will NOT work.  Note that the path now starts in the doorway of the maze, rather than in the sector outside of it.  The harvesters never cross the pathfinding sectors in this doorway, so they never 'see' the path:


They may however 'see' this path on the way back from the tiberium field, assuming the path has been marked as Two Way.

Harvesters will use your path as long as (1) you start the path in a sector the harvesters already drive over, and (2) end the path closer to the goal than it starts.  This means that you can give them really stupid long routes and they will still follow them, such as this:


Try the map C&C_Harvpath_Stupid.mix to see this yourself.  Note that one of the harvesters takes a 'shortcut', I am uncertain of the exact logic behind this, but I believe it notices the nearby waypath nodes when it crosses sectors whilst leaving the Weapons Factory.

If we were to end the path at a position further from the tib field than where we started then the path will NOT be accepted/chosen by the harvesters:


(They could potentially choose this path on their way back, however, as its end may be nearer their "goal" (eg the GDI refinery) than their current position).


Confusions, comments or problems?  Ask below or on the main W3Dhub forums.

Areas that are still not understood:

  • Whether or not this 'innate pathfinding' is exactly the same for all AI in the game, or slightly different for harvesters.
  • What metric is used to make choices on route.  Eg minimising distance travelled OR number of sectors travelled through?
  • How harvesters start waypaths at points other than their ends (ie take shortcuts)


Edited by Veyrdite

Share this post

Link to post
Share on other sites

The innate pathfinding will be the same for all AI units since its a feature of the pathfinding code rather than anything harvester specific.


Share this post

Link to post
Share on other sites
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...