Game Development Community

Getting AI character to follow in game paths

by Dennis Kelch · in Hardware Issues · 05/26/2009 (11:18 am) · 6 replies

What do you have to do to get AI characters to follow paths set in game in the World Constructor?

#1
05/27/2009 (2:11 pm)
There is a great example in the starter.fps game. Look in the mission file for "Paths" and see how they did it.
#2
05/27/2009 (3:07 pm)
There is also an old "Bot Path-finding" tutorial, and other useful tutorials that are still relevant today found on the CodeSampler.com

But basically and since I've answered this question a dozen times:

For the paths to work correctly with the code that is in aiPlayer.cs you'll use the Mission Editor to place a series of numbered path markers that make up a path.

  • 1: create a new SimGroup called "Paths" -- SimGroup(Paths)
  • 2: inside this SimGroup you will place a "Path" object. Call it "Path1".
  • 3: create a series of "PathMarkers" under the Path object, still inside the SimGroup. Place these "PathMarkers" where you want them.

  • Each PathMarker will need to have it's own "seqNum" field. This is the order in which the bot will follow the nodes(markers) on the path, 1 - 2 - 3 - 4 - etc, etc so on and so forth then back to marker #1 ad infinitum. All other fields are self-explanatory or should only take a little bit of experimentation to understand what they do/mean.

  • 4: Save the mission. Reload.

  • If all steps are performed correctly you will then see a "dumb" bot following the path you just laid out.
    #3
    05/29/2009 (2:14 pm)
    ...and this isn't a hardware issue. Sorry to be useless, but it's a pet peeve of mine :P.

    And like Michael said, once you've got a path in the mission, check aiPlayer.cs to see an example of how the AI actually follows the path.
    #4
    06/02/2009 (2:56 pm)
    Thanks for the help. I got one to work.
    #5
    06/02/2009 (4:28 pm)
    Nevermind. It stopped working for no apparent reason. Any idea why that happened?
    #6
    06/02/2009 (4:33 pm)
    Quote:Nevermind. It stopped working for no apparent reason. Any idea why that happened?
    Might need a few more details for anyone to help