1. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice

Tutorial - Creating and setting up custom AI paths

Discussion in 'General Discussion' started by VeyronEB, May 8, 2015.

  1. VeyronEB

    VeyronEB
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,539
    Adding and Assigning AI paths​



    As this has been a pretty discussed topic over the last few days and I found this to be a really nice thing to know, I decided to do this quick tutorial on how to add AI paths to pre-existing roads as well as create your own decal roads for the AI to follow.

    Assigning AI to pre-made decal roads

    First off you want to load up a level, this should be a level that has some sort of decal road system already in place, for this example I have used the Dunsfold Areodrome. You can also create decal roads on maps that do not have then already, but I will cover this later in the custom paths section.

    Once you have loaded up the level you want, add the AI control app from the UI editor. To do this open the esc key menu and go to UI Editor>Add-App>AIControl


    (imported from here)

    Now you need to open up the World Editor (F11). While in object editor mode go to the scene tree on the right hand side. Open up the Mission Group folder (some maps may be organised a little differently) and find the decal road(s) you want to add a path to.


    (imported from here)

    Select the road(s) (use ctrl to select multiple or shift to select a row). Now in the inspector window under the Pathfinding tab you will see a driveability value, change this from the default -1 to 1.


    (imported from here)

    Now we need to exit the editor and tell the AI to follow the path. To do this first press ctrl+L to reload the scripts then change the AI Mode on the AIControl app which you added earlier to "Random". Optionally you can turn on Navi Graph in the Global debug drawing if you wish to see the path the AI will follow, this can be useful if you are having issues with the path.


    (imported from here)

    Now that is setup your AI should now automatically follow the decal road!


    (imported from here)

    Debugging tips:

    - Choosing the correct road: If you have problems finding which road is which, you can set them to hidden in the inspector window under the editing tab, this is an easy way to see which road it is and were it goes:

    (imported from here)

    - Visual debug tools in the AIControl app can be enabled when in the world editor to help see which roads have AI assigned


    Creating new AI paths

    Creating new paths for AI to follow is quite useful for map makers, or for simply adding them to maps which don't have any roads by default e.g Gridmap.

    To start off load your chosen level, add the AIControl app and open the world editor as shown in the beginning of this tutorial.

    This time we need to go to the decal road editor on the top bar
    (imported from here)

    Now draw a decal road for the AI to follow, this can be done by left clicking to add a point in the direction you wish the AI to follow.


    (imported from here)

    Now as before we need to go back in the object editor tab
    (imported from here) and select the decal road we just added and change the driveability to 1, this road should be at the bottom of the list as it is the most recently added.

    Set the AI mode to random and press ctrl+L as we did before and the AI should follow your path.

    Now the whole "No material" road is a bit ugly, now while you could add textures to this it may be better to have it completely invisible in some cases. To do this simply select the decal road in the editor and change the distance fade to 1. This means you can use your roads purely as paths for the AI in any location


    (imported from here)


    Now you should have basic AI paths setup :D

    If you have any feedback and feel there is anything I should add to this tutorial feel free to suggest :)

    Anyways good luck with your AI endeavors :p
     
    #1 VeyronEB, May 8, 2015
    Last edited: May 8, 2015
    • Like Like x 3
    • Informative Informative x 1
  2. NistingurA

    NistingurA
    Expand Collapse

    Joined:
    Nov 22, 2013
    Messages:
    2,086
    Nice :) Like that
     
  3. Aboroath

    Aboroath
    Expand Collapse

    Joined:
    Aug 25, 2013
    Messages:
    3,807
    Thanks for this! Haven't done any AI stuff yet but this will probably change that.
     
  4. RGoody

    RGoody
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    26
    I never wanted to mess with AI because it looked so complicated. Now I see that it isn't really that bad! Thanks!
     
  5. Nothanks

    Nothanks
    Expand Collapse

    Joined:
    Nov 4, 2012
    Messages:
    108
    Thank you!
     
  6. CrashCarAlex

    CrashCarAlex
    Expand Collapse

    Joined:
    Dec 20, 2015
    Messages:
    311
    Akron Motor Speedway doesn't have road decals..? I look in every single place you can look.

    (Dat Grammar)
     
  7. squidiskool

    squidiskool
    Expand Collapse
    Banned

    Joined:
    Apr 6, 2016
    Messages:
    44
    help me the car won't follow the track engine is still on and i put drive thing to 1 and put ai to random and still won't follow!!!!!!!!!!!!!!!!!!!!!!!!! :mad:
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice