Jump to content
Clayman

How to stop vehicles from using footpaths?

Recommended Posts

Is there any efficient way to keep AI vehicles from using the footpaths on Tanoa?

 

I have a bunch of AI controlled vehicles, which should move all over Tanoa on dynamic routs. Apart from all the usual AI driving issues like trees, streetlamps, buildings, crossroads, bridges, civilians and ambient animals, my biggest problem at the moment is the AI thinking it is a good idea to take a shortcut along those footpaths and, as a result, badly get stuck somewhere in the dense jungle.

 

While I have a (rather ugly but semi-reliable) workaround for most cases of stuck vehicles, it's quite difficult to get a vehicle out of the jungle in an acceptable manner, especially as the footpaths for some reason are considered as roads.

So, is there any way to tell an AI driver to stick to those roads that are actually suited for the vehicle he is driving? Any ideas are welcome.

Share this post


Link to post
Share on other sites

Hello,

 

You could try and download an ai driving mod like VCom Driving.

If they still dont stick to the road they should be smarter around objects.

Good luck!

 

Share this post


Link to post
Share on other sites

AFAIK no. I have the same issue and I had to heavy script waypoints to use main roads on convoys.

Share this post


Link to post
Share on other sites
On 9.5.2017 at 0:40 AM, Clayman said:

Is there any efficient way to keep AI vehicles from using the footpaths on Tanoa?

 

@Larrow has the solution in this post

Share this post


Link to post
Share on other sites

it's a known issue that is, for whatever reason, totally ignored by BI. me and others have brought it up several times right when Tanoa was first available, basically doing our job as free bug testers. yet for some reason this is not considered big enough of a problem, eventhough i personally would consider it game breaking, considering the game comes with an editor that let's you build your own missions and all that.

 

now to the fun part, which is finding crazy workarounds for stuff that would be easy to fix for the devs. aka arma scripting/modding :don9:

---rant over---

 

i think barbolani is spot on. you should be able to collect all roads at mission start using

 

https://community.bistudio.com/wiki/nearRoads

 

then you'd filter out the jungle paths. the tricky part would be building the path using the remaining roads. making the vehicle move there should be easy using one of those

 

https://community.bistudio.com/wiki/doMove

https://community.bistudio.com/wiki/commandMove

 

having them sorted in the right order however to have a logical path is another story.

 

 

i'd think it would be better to do another try of making BI aware of this. basically making a bug ticket and talk about the issue in the dev branch discussion thread for a bit linking to the ticket. pretty sure that everyone would be fine with those road objects simply being removed. cost benefit and all that. the only real purpose they serve is visual and i'd say it's worth way less than functional driving AI.

 

just my 2 (more like 200) cents

 

 

  • Like 1

Share this post


Link to post
Share on other sites

There is no known way to do this. 

 

If you wanted to experiment, I would try using hideObject + nearestTerrainObjects on paths, perhaps if its hideObject the vehicle wont use it for pathfinding.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the replies, guys.

 

isOnRoad looks quite promising so far. The is also the roadsConnectedTo command. When excluding the dirt roads it shouldn't be that hard to create dynamic routes.

Although for the complete map it might be quite heavy on performance.

 

I was thinking about using pre-placed waypoints at intersections and dynamically linking those together. Going to do some testing the next days.

I also like the hideObject idea, going to try it out just to see if it actually works.

 

And thanks again for the input.

Share this post


Link to post
Share on other sites

@bad benson
 Jungle paths are not roads. None of the roads command group know about these paths.

I've never seen ai drivers try to use jungle paths, so it is odd that clayman does.

Share this post


Link to post
Share on other sites
8 hours ago, Tankbuster said:

@bad benson
 Jungle paths are not roads. None of the roads command group know about these paths.

I've never seen ai drivers try to use jungle paths, so it is odd that clayman does.

 

spend more time on Tanoa, you will see it ;)

 

they are road segments as well.

 

the only reliable difference is that for jungle paths, roadsConnectedTo returns [].

 

the method I use to grab roads in an area and filter out the jungle paths:

 

_onlyRealRoads = (<position> nearRoads <radius>) select {((_x isEqualType objNull) && (!((roadsConnectedTo _x) isEqualTo [])))};

 

Share this post


Link to post
Share on other sites

I've been running around Tanoa for some time this morning, staying on the paths deep in the jungle.

 

isOnRoad player has never returned true and roadAT player has always returned null when I'm on paths. Sometimes player nearRoads 5 returns an object or two, but not often.

  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, Clayman said:

Thanks for the replies, guys.

 

isOnRoad looks quite promising so far. The is also the roadsConnectedTo command. When excluding the dirt roads it shouldn't be that hard to create dynamic routes.

Although for the complete map it might be quite heavy on performance.

 

I was thinking about using pre-placed waypoints at intersections and dynamically linking those together. Going to do some testing the next days.

I also like the hideObject idea, going to try it out just to see if it actually works.

 

And thanks again for the input.

 

Run the code at the start of the mission and store the roads collected. For example, I use:

/*
	Function: TAG_fnc_getRoads
	Author: HallyG (Larrow for the finding trails part)
	Returns all roads/trails within a certain radius of the provided centre.

	Arguments(s):
	0: Centre <MARKER, OBJECT, LOCATION, GROUP, TASK, POSITION>
	1: Radius <NUMBER>
	2: Roads or Trails (True - Roads, False - Trails) <BOOL>

	Return Value:
	<ARRAY>
	
	Example:
	[
		[worldSize/2, worldSize/2, 0],
		worldSize * sqrt 2,
		true
	] call TAG_fnc_getRoads;
__________________________________________________________________*/
params [
	["_centre", objNull, [objNull, grpNull, "", locationNull, taskNull, []]],
	["_radius", 1000, [0]],
	["_roads", true, [false]]
];

_centre = _centre call {
	if (_this isEqualType objNull) exitWith {getPosASL _this};
	if (_this isEqualType grpNull) exitWith {getPosASL (leader _this)};
	if (_this isEqualType "") exitWith {getMarkerPos _this};
	if (_this isEqualType locationNull) exitWith {locationPosition _this};
	if (_this isEqualType taskNull) exitWith {taskDestination  _this};
	if (_this isEqualType [] && {_this isEqualTypeArray [0,0] || _this isEqualTypeArray [0,0,0]}) exitWith {_this};
	[0,0,0]
};

if (_centre isEqualTo [0,0,0]) exitWith {[]};

(_centre nearRoads _radius) select {
	if (isOnRoad getPos _x || (toLower (getModelInfo _x select 0) find toLower "bridge" > -1)) then {
		_roads;
	} else {
		[
			false,
			!_roads
		] select (getModelInfo _x select 0 == "");
	};
};

 

So call this function, to return roads or trails, and then store the result. The result can then be used later to filter any of your dynamic routes etc
You could also add in a roadsConnectedTo check too.

Share this post


Link to post
Share on other sites
3 hours ago, Tankbuster said:

I've been running around Tanoa for some time this morning, staying on the paths deep in the jungle.

 

isOnRoad player has never returned true and roadAT player has always returned null when I'm on paths. Sometimes player nearRoads 5 returns an object or two, but not often.

 

go to the link posted above. we're not making this up. i've seen my ambient AI traffic script not only pick these as starting points but also AI deliberately using them in their path planning. unless BI changed something all this is still valid. the fact some road evaluation commands don't return stuff is known and used in the thread linked to above.

 

here:

On 11.5.2017 at 3:36 AM, Nikander said:

 

@Larrow has the solution in this post

 

  • Like 1

Share this post


Link to post
Share on other sites

I believe you of course. I see that Larrow's script looks of isonroad OR the output of the modelinfo comand. Clearly, the road finding engine routines don't use the same systems and commands we do

  • Like 1

Share this post


Link to post
Share on other sites

But I still can't get them to drive on paths. I've spent ages sitting in the passenger seat of a Prowler with an AI driver, ordering him around and not once has he tried to drive up a trail. I've even started us at one end of a trail and told him to drive to the other and he drove the long way around, sticking to the roads, occasionally getting confuzzled by bridges.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×