1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.32 Bug Reporting thread
    Solutions and more information may already be available.

How to make the AI path not make an intersection when crossed.

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Danny Werewolf, May 2, 2017.

  1. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268

    Attached Files:

    • screenshot_00011.png
    • screenshot_00012.png
  2. retrospek

    retrospek
    Expand Collapse
    BeamNG Team

    Joined:
    Feb 23, 2016
    Messages:
    19
    Hey Daniel :). What is it that you would like to achieve?
     
  3. Octothorp Obelus

    Octothorp Obelus
    Expand Collapse

    Joined:
    Jan 24, 2014
    Messages:
    268
    Well it's none of my business, but I believe he wants to prevent the creation of autojunction nodes so the AI path is a complete circuit for tracks or racing of such.
     
  4. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268
    Yeah, that's what I wanted, a little hard for me to explain ;/
     
  5. retrospek

    retrospek
    Expand Collapse
    BeamNG Team

    Joined:
    Feb 23, 2016
    Messages:
    19
    Hey Daniel,

    you can manually specify the exact path (along with other parameters) that you would like an AI vehicle to follow by using the following API in the in-game console (which you bring up by pressing "~" while on a map):

    Code:
    ai.driveUsingPath(arguments)
    
    where "arguments" is a Lua table with the following entries
    
    arguments = {
        wpTargetList -> 'a table of waypoint names (i.e. strings)'
        noOfLaps -> 'a number value'
        aggression -> 'a number value'
        driveInLane -> 'on' or 'off'
        routeSpeed -> 'a number value'
        routeSpeedMode -> 'limit' or 'set' }
    Now lets go through them to explain exactly what each one does:

    ### wpTargetList (a Lua table)
    A list of the waypoints specifing the path the AI vehicle should follow
    Example: wpTargetList = {'wp1', 'wp2', 'wp3', 'wp4'}

    Where you should replace 'wp1', 'wp2', etc. with the choosen waypoint names of your map.
    For example in your map in the picture you shared 'autojunction_1' is one of the waypoint name.

    NOTE:
    The AI will choose the shortest path between any two consecutive waypoints in 'wpTargetList'.
    If you find that despite the fact that you have specified a route the AI is not following it as you would like, you should constrain it further by adding more waypoints in 'wpTargetList'.
    If you would like to create a closed circuit as would be the case for a race on a race track you should have the first and last waypoints in the wpTargetList be the same

    ### noOfLaps (a number value)
    Specifies the number of laps the AI will do on a closed (!!) circuit (reminder: a closed circuit is one in which the first and last waypoints in 'wpTargetList' are the same)
    Example: noOfLaps = 5
    (If the circuit is not closed specifying the number of laps will have no effect. The AI vehicle will just follow the path from the first to the last waypoint and stop there.)

    ### aggression (a number value between 0.42 and 1.44, this range is possibly subject to change in future updates)
    This is exactly the same as the Risk parameter you find on the AI app and it specifies how close to the traction (see tire friction) limits the AI vehicle will attempt to drive. A higher aggression value will push the AI vehicle to drive faster i.e. brake harder, accelerate harder, make turns at higher speeds and generally come closer to its traction limits at the same time making it more risky. Higher values means riskier.
    Example: aggression = 1.3

    ### routeSpeed (a number value) and routeSpeedMode ('limit' or 'set')
    When routeSpeedMode = 'limit' then the AI vehicle will not exceed the speed specified by routeSpeed (in meters/sec). When routeSpeedMode = 'set' the AI vehicle will act to meet the speed specified by routeSpeed (meters/sec). (Again these settings can also be found on the AI app).
    Example: routeSpeed = 5, routeSpeedMode = 'limit'

    Putting all the above together in an Example:

    Code:
    ai.driveUsingPath{ wpTargetList = {'wp1', 'wp2', 'wp3', 'wp4', 'wp5', wp1}, noOfLaps = 5, aggression = 1.3 }
    In this example the AI vehicle will follow the route from 'wp1' through 'wp2'-'wp5' and back to 'wp1', doing 5 laps around the specified route.

    To use this press "~" (without the quotes) while on a map. This will bring up the in-game console. At the bottom left corner of the console you will find a drop down list with four options. Go ahead and select BeamNG - Vehicle Lua.



    To the right of that you will see a blank space with a blinking cursor. Go ahead and paste (or input) the above command replacing the arguments with your own options as you would like them.

    Alternatively, you can save the above command in a file, for example my_route.txt, in the beamNG game folder.

    And in the in-game console window (under BeamNG - Vehicle Lua) write dofile('my_route.txt') (Notice the quotes around the file name!). You can change (and save) the file at any time and re-run it at any time.

    If anything of the above is still unclear please let me know and I will be happy to go through it and clarify :)
     
    #5 retrospek, May 5, 2017
    Last edited: May 5, 2017
    • Like Like x 2
  6. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268
    K, i'll go through it tomorrow, been up all night cuz that's how I am.
     
  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