1. Stuck, Having problems with creating your mod? Let us help you: Mod Support

Does AI Path width matter?

Discussion in 'Content Creation' started by krallopian, Jan 11, 2019.

  1. krallopian

    krallopian
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    445
    Sometimes I think it does sometimes I think it doesn't.

    Does making the path THIN make the AI try harder to hit the points, or is it simply "get as close to each point as you can, regardless of how big it is?"

    Cheers =)
     
  2. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    1,948
    I don't think that matters. I'm pretty sure with wide roads, the AI would drive a foot (comparison with the vehicles) or two away from the side of the road with the lane mode on. Looking at Trajectory and Speed in the AI menu, it looks like the system calculates the middle of the road still, yet the AI simply follows just right of the road. Also, I have rarely seen the One-Way road thing work.

    Take this with a grain of salt, I just use the AI a lot...
     
  3. krallopian

    krallopian
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    445
    Yeah I've been using it forever and it's one of those, "wait it DOES work" "nope, no it doesn't" "No it DOES!!" things it seems, figured I'd ask. *cheers =)
     
    • Agree Agree x 1
  4. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    2,032
    One way roads only work with manual destination mode as of current. It's awful that it only follows it that way, I can't figure out the reason for it and have questioned the ethics of said reasoning many times. *shrugs and looks blankly*
    Lane width doesn't matter too much aside of how close you want vehicles to follow the AI route. Making them narrower than a vehicle will slow the AI down, or could cause worse issues like the AI not completing it's path, or it may work fine. I am not 100% on this.
    Using AI routes that are the width of the lane, less about 6 inches to a foot, is usually good. So keep them 8 feet / 3 meters wide while your lanes are 9.5~12 feet wide depending on the speed of your road and the sharpness of corners involved (faster or sharper corners = wider lanes). Like-wise a 10 foot wide AI lane in a 12 foot wide roadway lane, would be just fine, too.
    The spacing of nodes seems to matter more than width in practice. Closer node spacing = better cornering at better speed and a higher speed in general over a hilly route.
    You can also 'cheat' the system by using invisible AI path decal roads to get them over bridges like I've done in Roane County map mod, by placing NO nodes under the bridge, just one at either end. That won't work for curved bridges, but for straight ones - and tunnels, it will work. The AI runs from node to node, regardless of what's in between the nodes. It just takes a straight line from one node to the next. If there's a wall or a giant pit in the road between the two nodes, it'll be none-the-wiser. This is sure easier than scripting waypoints in on map.json.
    My maps pioneered the use of one cohesive or even individual-lane AI routes, especially over large intersections of divided roadways, used in Nevada Interstate, the old So-Cal (now Los Injurus), and Roane County TN. I recommend using the ones for individual lanes, but do give the AI chance to merge if it's not a divided limited access roadway (it'll need them less often if it is limited access). If using it for racing only, you may find the AI provides better competition if you use the next method... If you are making a realistic roadway map, use one AI road for each set of driving lanes in each direction, so if it's a 2+2 highway (two lanes per side), use two AI roads, one for east-bound, one for west-bound, setting lanes to '2' (and set one-way). If you have a break in the AI lane somewhere, it will refuse to complete it's course, or may skip the impacted lane circuit altogether. Keep an eye out for malformed 'automatic' intersections where roads connect. The game will generally not automatically connect/intersect AI routes that are more than 5~6 meters of height difference (like when using the trick above to make overpasses viable for AI travel).
     
    • Informative Informative x 1
  5. estama

    estama
    Expand Collapse
    Developer
    Staff Member

    Joined:
    Aug 7, 2012
    Messages:
    233
    The way AI paths currently works is this.

    First it subdivides the map nodes segments that it is driving on. The closer to the car, the finer the subdivision will be. Then it'll treat them like they have elastic springs on every node that try to "open" the angles to full extend.

    Depending on aggressiveness parameter it'll be further or closer to the sides of the road. So if aggressiveness is high, it'll use a higher % of the road's width while elastically "optimizing" the path.

    Try the different AI vehicle debug visualization options (on the bottom right of the AI app) to see more of the internals of the AI.
     
  6. krallopian

    krallopian
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    445
    That's fascinating, I always put smoothness to 0 and detail to 1 so I can get a DIRECT line while pathing, but would having the smoothness on make it easier to visualize how the AI figures it out based on the tangents spingy stuff you're referring to estama?

    I'm sure we could all agree devs and users alike, that having a node specific "risk" factor would be pretty awesome! I.E. "This is a SHARP ASS CORNER SLOW DOWN" on that node, vs "NOW FLOOR IT HERE" or if you wanted to have a fast section, that slows, then speeds up.. I suppose that's what the new AI path recording function incorporates. Hmm, still have to try it :\
     
  7. krallopian

    krallopian
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    445
    Well one-hundred-thousand-billion percent, the ai path THICKNESS matters. I've been wracking my brain trying to figure out why my ai goes apeshit as soon as it goes off my pathway recently. BECAUSE I had redid it all as thickness 1 instead of the original 4 to 5 that I was using. As soon as it strayed off during the turn, it would hard turn and slam on the brakes, and usually just end up going straight to my target instead (while on chase.)

    So I redid the whole path at 5 thickness and it works 100% again, and they don't randomly give up anymore. Sheeesh
    --- Post updated ---
    Also, putting less points in a tight corner made a hell of a difference, now it takes it no problem! Man... thought my level was trashed but now it's working better than ever with THICK ai paths and limited nodes across a tight corner. I went from 30 nodes to 5 and the bus takes the corner like a champ, where before it would floor it and lose control every single time, give up, then just head straight to the target.
     
  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