AI Pathing and Bridges (Help)

Moderators: GSH, VSMIT, Red Devil, Commando

APCs r Evil
Sabre
Posts: 299
Joined: Sat Feb 19, 2011 4:13 am

AI Pathing and Bridges (Help)

Post by APCs r Evil »

I'm currently trying to get the AI (Hover/Walker/Tracked) to path under a bridge that is a very important feature of a map I just started fiddling with. Problem is, they prefer trying to scale sheer cliffs over traveling a few meters under the bridge. It's not a terrain issue, either, since when the bridge is erased the AI behaves perfectly.

I seem to recall someone fixing this problem a while back with an ODF tweak so I'm hoping someone knows what the problem is.

Here's the bridge segment's ODF.

[GameObjectClass]
geometryName = "ibbseg00.xsi"
classLabel = "i76building"
collisionRadius = 1.0
unitName = "Bridge"
isAssault = 1
canInteract = 0

[BuildingClass]
tunnelCount = 2
bldEdge = "wwww"
CanDemolish = false

tunnel01X0 = 1
tunnel01Z0 = 0
tunnel01DX = 2
tunnel01DZ = 4
tunnel01Edge = "fwfw"

tunnel02X0 = 0
tunnel02Z0 = 1
tunnel02DX = 4
tunnel02DZ = 2
tunnel02Edge = "wtwt"
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: AI Pathing and Bridges (Help)

Post by MrTwosheds »

As you know pathing is effectively 2d. The tunnels tell a unit it can go in/out the ends and not off the sides. So if it goes under it it gets stuck.
The only way I know of (means nothing) to make a bridge that works both ways is to not use tunnels at all and use the
[BuildingClass]
justFlat = 1
Which tells the ai that the bridge isn't there effectively. units will drive across it, under it both the right and wrong ways and off of the side of it. Not a perfect solution.
APCs r Evil
Sabre
Posts: 299
Joined: Sat Feb 19, 2011 4:13 am

Re: AI Pathing and Bridges (Help)

Post by APCs r Evil »

Didn't work. With that flag the AI goes to great lengths to avoid using the bridge.
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: AI Pathing and Bridges (Help)

Post by MrTwosheds »

works with classLabel = "terrain"
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: AI Pathing and Bridges (Help)

Post by General BlackDragon »

tunnelCount = 2 // Pathing on this is a nightmare from hell.
bldEdge = "tttt"

tunnel01X0 = 1
tunnel01Z0 = 0
tunnel01DX = 2
tunnel01DZ = 16
tunnel01Edge = "twtw"

tunnel02X0 = 0
tunnel02Z0 = 2
tunnel02DX = 16
tunnel02DZ = 12
tunnel02Edge = "wtwt"



I have that on one of my bridges, it seemed to work okay...OR I gave up and havn't touched it since 2010....i can't remember which.


Basically, your bldedge saying WALL WALL WALL WALL Tells the AI the bridge is a box they can't get it. Try telling the AI It's 4 sides are: TUNNEL TUNNEL TUNNEL TUNNEL, it might work...

also might try FFFF

Shift + F9 is your friend.
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: AI Pathing and Bridges (Help)

Post by Nielk1 »

/me takes one looks, sees exactly what GBD did and wonders how 2Sheds missed it.

Wall is impassable.
Tunnel is linked to another tunnel.
Some third one, I think F, is an opening.

Tunnels don't work unless they attach to other tunnels. Thus a stock bridge segment says that it has a tunnel from one end to the other with walls on either side for the top, but an opening on either side with walls in the tunnel code for the bottom. This is because the tunnel under goes from open world to open world.

As a side note, that means that to make bridges that are used by AI despite not using the entrance/exit struts, even with the stock bridges, you will need a custom ODF to tell the AI that it can jump right on.
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: AI Pathing and Bridges (Help)

Post by MrTwosheds »

/me takes one looks, sees exactly what GBD did and wonders how 2Sheds missed it.
I didn't miss it as such, I was telling him how to make a different type of bridge that does not use tunnels.
I think what ever you do with them units will always get confused going under in the wrong direction.
User avatar
S.cavA.rmyG.en
Sabre
Posts: 296
Joined: Fri Mar 04, 2011 3:15 am
Location: ISDF Junk Yard
Contact:

Re: AI Pathing and Bridges (Help)

Post by S.cavA.rmyG.en »

can't help but think of my flying buildings here.
but I am not sure there ODF settings will work with your model with out some chages.
1. dose it have a train pate the stock model dose not and this can mess with the AIs small mines.
2. dose the AI have to use it latter on becouse if it dose you mite need to mod the collision model to stop AI units form falling off the sides.
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: AI Pathing and Bridges (Help)

Post by Zero Angel »

I don't think FFFF will work. F means 'linked' -- its a setting used to link tunnel segments to other tunnel segments, to ie: prevent units from driving off of bridges.T means 'tunnel entrance/exit' and tunnel02 in that ODF is the one that is supposed to allow the AI to path underneath it.

Furthermore, I tested the ODF you posted to me in the editor (1.3.6.2), and the scout and walker were both able to path through the bridge segment without problems. They would even try to force their way through as the bridge was placed directly at ground height. This seemed to work when the bridge was properly set up (ie: linked to a bridge strut), and I think it worked even when the segments were not attached to a strut.

Another thing I tested was running the bridges parallel to each other with no gaps in between (AKA: double bridges), and this caused the pathing issues you described. T (entrance/exit) segments cannot be directly connected with other T segments. You can get around that limitation by making one of the passthru tunnel entries an F one, and then rotating the bridge 180 degrees for the parallel one. So that the layout is like this:

Code: Select all

-----------------
|- T T -|- T T -|
|- - - -|- - - -|  [ bridge strut x2 ]
|- - - -|- - - -|
|- F F -|- F F -|
-----------------
|- F F -|- F F -|
|T - - F|F - - T|  [ bridge segment x2 ]
|T - - F|F - - T|
|- F F -|- F F -|
-----------------
|- F F -|- F F -|
|T - - F|F - - T|  [ bridge segment x2 ]
|T - - F|F - - T|
|- F F -|- F F -|
-----------------
|- F F -|- F F -|
|T - - F|F - - T|  [ bridge segment x2 ]
|T - - F|F - - T|
|- F F -|- F F -|
-----------------
|- F F -|- F F -|
|- - - -|- - - -| [ bridge strut x2 ]
|- - - -|- - - -|
|- T T -|- T T -|
-----------------
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: AI Pathing and Bridges (Help)

Post by Zero Angel »

Another tidbit, AI passes around underground tunnels freely because bldEdge is not present in the ODFs of the underground tunnels. However, because the entrance+linking tunnels are typically in place, the AI will still use the underground tunnels properly if it enters an entrance (T) and stays in the linking system of the tunnel.

If I couldnt get bridges to otherwise work properly, what I would do is comment out the bldEdge ODF entry, as well as the tunnel02 entries, and then set the tunnel count to 1. This would be a last resort, if I exhausted all other options.
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: AI Pathing and Bridges (Help)

Post by MrTwosheds »

An excellent description from ZA, none of this becomes clear when you just look at various odf's.
User avatar
Ded10c
Recycler
Posts: 3815
Joined: Sun Feb 20, 2011 11:05 am
Location: Stoke-on-Trent
Contact:

Re: AI Pathing and Bridges (Help)

Post by Ded10c »

Thank you for that, ZA, tunnels make much more sense now.
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: AI Pathing and Bridges (Help)

Post by Nielk1 »

AH, I got the T and the F swapped in my post.
User avatar
Ded10c
Recycler
Posts: 3815
Joined: Sun Feb 20, 2011 11:05 am
Location: Stoke-on-Trent
Contact:

Re: AI Pathing and Bridges (Help)

Post by Ded10c »

If that AH means me rather than a sudden realisation; your post was completely and utterly useless to me. :P
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: AI Pathing and Bridges (Help)

Post by Nielk1 »

Sudden realization with a Shift key that was stuck.
Post Reply