Jump to content
Tankbuster

AI convoy. Best practices?

Recommended Posts

Guys,

I wonder if we could pull together some info about AI convoys, and how to make them, here? Back in A2 and Arrowhead days, AI convoys were prety reliable and I even have some footage of a bunch of Ifrits barrelling along the roads of Stratis.

 

But I read all is not well at the moment. I reckon we'd need to examine how wheeled and tracked vehicles work in convoy and perhaps when there's a mix of the two.

 

So far, I'm finding that making a number (2 to 6) of wheeled vehicles on consective road pieces, drivers all in different groups then giving them all the same doMove seems to work reasonably well.

 

I'm thinking waypoint settings, group settings, AI skills, mod or no mod, etc etc

Share this post


Link to post
Share on other sites
1 hour ago, AZCoder said:

Wow, that was literally my first thought when I saw the thread title.

 

Have you looked at Devastator's convoy? https://forums.bistudio.com/topic/197732-devas-convoy-release/

I have not tried it myself.

Actually, no, I haven't seen or tried this. Let's have a go...

  • Like 1

Share this post


Link to post
Share on other sites

The only thing you'll get in terms of reliability and AI convoys is, they'll be reliably chaotic every time.

4 quadbikes, lined up perfectly.

Explosions took place 30s after that video.

Seriously don't.

 

Cheers

  • Haha 4

Share this post


Link to post
Share on other sites
21 minutes ago, Grumpy Old Man said:

Seriously don't.

Haha.  Grumpy be seriously grumpy today.  @Tankbuster, I say take up the challenge dude!   Bending AI to your will is always very gratifying and never frustating [/sarc].  Your idea to put each driver in a different group might work out.  And for followers you can run a loop on them that uses SetVelocityModelSpace to reduce speed if they get too close to the vehicle they are following.  And try staggering the starting times of each vehicle, so lead vehicle calculates his path and gets underway before following vehicle does same.  That way following vehicle hopefully isn't considering lead vehicle an obstacle for path finding.

 

I'm using that technique for  a chase sequence where player vehicle is following/chasing an AI vehicle, but I don't want player to overtake it, and its working pretty good.  I'm also using it to force AI driven vehicle to accelerate in straight road sections via a presence trigger (when in trigger increase velocity via SetVelocityModelSpace, and stop doing that when they exit trigger).  This moves them along quicker and feels more like they are trying to get away rather than slowing down like retards (but they still slow down too much when turning on their own in an intersection).  Note you can't use SetVelocityModelSpace near turns in roads, as it forces vehicle forward in current direction, not direction AI is steering.

Share this post


Link to post
Share on other sites

if a full head of not-grey hair, and a good nights sleep, sound like nice things to you, then yea dont.

 

a different story if we could edit the underlying code, but when the studio refuses to fix even basic bugs or spend a few days taking care of the critical issues, then i would call it being a sucker, to attempt to layer a fix ontop of a broken foundation that we’re not allowed to touch.

  • Like 4
  • Haha 1
  • Sad 1

Share this post


Link to post
Share on other sites

I'm a time traveler. Trump&co didn't nuked the planet but in 2049 the cyborg BI devs still have AI driving issues with the current (Arma 37) version. They said for Arma 38 they gonna try something new and use a hive mind to control every AI.

  • Like 2

Share this post


Link to post
Share on other sites
45 minutes ago, johnnyboy said:

Haha.  Grumpy be seriously grumpy today.  @Tankbuster, I say take up the challenge dude!   Bending AI to your will is always very gratifying and never frustating [/sarc].  Your idea to put each driver in a different group might work out.  And for followers you can run a loop on them that uses SetVelocityModelSpace to reduce speed if they get too close to the vehicle they are following.  And try staggering the starting times of each vehicle, so lead vehicle calculates his path and gets underway before following vehicle does same.  That way following vehicle hopefully isn't considering lead vehicle an obstacle for path finding.

 

I'm using that technique for  a chase sequence where player vehicle is following/chasing an AI vehicle, but I don't want player to overtake it, and its working pretty good.  I'm also using it to force AI driven vehicle to accelerate in straight road sections via a presence trigger (when in trigger increase velocity via SetVelocityModelSpace, and stop doing that when they exit trigger).  This moves them along quicker and feels more like they are trying to get away rather than slowing down like retards (but they still slow down too much when turning on their own in an intersection).  Note you can't use SetVelocityModelSpace near turns in roads, as it forces vehicle forward in current direction, not direction AI is steering.

Why are you not using Unitcapture/Unitplay, works well for a chase scene?

Share this post


Link to post
Share on other sites

@Alert23 - Maybe but only for set route.

Share this post


Link to post
Share on other sites
Just now, Alert23 said:

Why are you not using Unitcapture/Unitplay works well for a chase scene?

In my experience UnitPlay works well only for boats and air vehicles.  Land vehicles don't spin their wheels and look goofy (unless that has been fixed in some recent update).  Is UnitPlay working well now for land vehicles?

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, johnnyboy said:

In my experience UnitPlay works well only for boats and air vehicles.  Land vehicles don't spin their wheels and look goofy (unless that has been fixed in some recent update).  Is UnitPlay working well now for land vehicles?

its not fixed for vehicles but  i managed to make them spin.

Share this post


Link to post
Share on other sites
2 minutes ago, johnnyboy said:

In my experience UnitPlay works well only for boats and air vehicles.  Land vehicles don't spin their wheels and look goofy (unless that has been fixed in some recent update).  Is UnitPlay working well now for land vehicles?

 

It can be done! You have to get the AI driving first (off camera) then run the unitplay. BUT only for limited uses. I used it in the upcoming campaign for about 5 seconds just to lock the brakes on a truck and turn sideways. I also used it in a long scene in Shadow Fall with mixed results, the Hand Over jumping scene.

  • Like 1

Share this post


Link to post
Share on other sites

i noticed that when you Unitplay a unitcaptured scene on an AI in a vehicle that the AI is permanently pressing the breaks causing the wheels not to spin.

so i unitcaptured myself driving a vehicle and after capturing i saved all data and changed only 2  vehicle settings in the config.bin to:

maxBrakeTorque=0

maxHandBrakeTorque=0

 

(using PBOManager and BINToCPP / CPPToBin)

 

than i unitplayed the captured data on an AI and the AI wasent able to brake which allowed the wheels to spin =)).

worked very well and easy.

  • Like 3

Share this post


Link to post
Share on other sites
16 minutes ago, Alert23 said:

i noticed that when you Unitplay a unitcaptured scene on an AI in a vehicle that the AI is permanently pressing the breaks causing the wheels not to spin.

so i unitcaptured myself driving a vehicle and after capturing i saved all data and changed only 2  vehicle settings in the config.bin to:

maxBrakeTorque=0

maxHandBrakeTorque=0

 

(using PBOManager and BINToCPP / CPPToBin)

 

than i unitplayed the captured data on an AI and the AI wasent able to brake which allowed the wheels to spin =)).

worked very well and easy.

100% working!

Share this post


Link to post
Share on other sites
1 hour ago, johnnyboy said:

Haha.  Grumpy be seriously grumpy today.  @Tankbuster, I say take up the challenge dude!   Bending AI to your will is always very gratifying and never frustating [/sarc].  Your idea to put each driver in a different group might work out.  And for followers you can run a loop on them that uses SetVelocityModelSpace to reduce speed if they get too close to the vehicle they are following.  And try staggering the starting times of each vehicle, so lead vehicle calculates his path and gets underway before following vehicle does same.  That way following vehicle hopefully isn't considering lead vehicle an obstacle for path finding.

 

I'm using that technique for  a chase sequence where player vehicle is following/chasing an AI vehicle, but I don't want player to overtake it, and its working pretty good.  I'm also using it to force AI driven vehicle to accelerate in straight road sections via a presence trigger (when in trigger increase velocity via SetVelocityModelSpace, and stop doing that when they exit trigger).  This moves them along quicker and feels more like they are trying to get away rather than slowing down like retards (but they still slow down too much when turning on their own in an intersection).  Note you can't use SetVelocityModelSpace near turns in roads, as it forces vehicle forward in current direction, not direction AI is steering.

Thanks JB. As it happens, I have written an AI system for making hostages follow their rescuer and other associated stuff. It works fine and is way better than putting the hostages into the rescuers group.

I've often thought how we could, in SQF, fix up some aspects of AI driving like stopping them crashing into other vehicles and buildings. To be honest, I worry this would be well beyond me and would be a huge investment of time and effort for relatively little product.

  • Like 1

Share this post


Link to post
Share on other sites

you can try my convoy script. It was working in the past and I think it still does (as nobody reported issue in its thread)

  • Like 3

Share this post


Link to post
Share on other sites
21 minutes ago, Devastator_cm said:

you can try my convoy script. It was working in the past and I think it still does (as nobody reported issue in its thread)

 

I already pointed him there :f:   Don't know if he tested it as of yet.

 

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Alert23 said:

i noticed that when you Unitplay a unitcaptured scene on an AI in a vehicle that the AI is permanently pressing the breaks causing the wheels not to spin.

so i unitcaptured myself driving a vehicle and after capturing i saved all data and changed only 2  vehicle settings in the config.bin to:

maxBrakeTorque=0

maxHandBrakeTorque=0

 

(using PBOManager and BINToCPP / CPPToBin)

 

than i unitplayed the captured data on an AI and the AI wasent able to brake which allowed the wheels to spin =)).

worked very well and easy.

Very inventive.  That would never have occurred to me.

2 hours ago, AZCoder said:

It can be done! You have to get the AI driving first (off camera) then run the unitplay. BUT only for limited uses. I used it in the upcoming campaign for about 5 seconds just to lock the brakes on a truck and turn sideways. I also used it in a long scene in Shadow Fall with mixed results, the Hand Over jumping scene.

Good to know.  That makes sense to me now, because it is similar to how I use setVelocityModelSpace.  AI must be moving before you use it to have wheels spinning.

Share this post


Link to post
Share on other sites
1 hour ago, AZCoder said:

 

I already pointed him there :f:   Don't know if he tested it as of yet.

 

Not yet. Will get to it in a day or two.

Share this post


Link to post
Share on other sites

while the driving is abysmal, here's an example of what is/was possible with the driving, using the "setDriveOnPath" command. Mind you, it takes a lot of micromanagement and probably isnt suitable for sandbox driving (you cant tell the vehicle to reverse for instance).

 

Basically a scripted police chase with AI interceptor, with pursuit speeds up to 150km/h

 

 

Share this post


Link to post
Share on other sites

Doubt that this will be possible anymore, since the last AI driving changes it's almost impossible for AI to stay in the same lane and not swerve across the entire road, especially on curvy roads (which is basically any road besides 2 straights on altis).

 

Forcing a convoy to drive behind each other, or at least force the following vehicle to move to the leader vehicles position with a delay could work, but sure has its own drawbacks.

You can't prevent AI from swerving across the road, depending on your mission this could mean some Zeus has to step in and correct eventual collisions, if there's a lot of traffic on the roads.

Then AI are prone to swerve heavily in turns for no apparent reason.

They also like to swerve if there's anything on/near the road, other units or animals.

Animals will be on the road 100% of the time if there's a player inside one of the convoys vehicles, since BI think it's funny to spawn animals always within 100m in front of the player.

 

Try it out with this:


addMissionEventHandler ["Draw3D", {
	{

		_pos = ((getposatl _x) vectoradd [0,0,2]);
		drawIcon3D ["", [1,1,1,1], _pos, 0.8, 0.8, 0, (typeof _x), 1, 0.0315, "EtelkaMonospacePro"];
	} forEach (player nearentities 150);
}];

Will put a text above every entity within 150m of the player.

Mind this was the case last time I goofed around with AI driving, animals might no longer cause them to swerve or they no longer spawn straight in front of the player, didn't test this in a while.

 

What you also can test is to see how many head-on collisions oncoming traffic might cause. My last rate was 1 collision every 3km driven. Resulting in blown tires 90% of the time using the prowler.

Even with the messed up, way too big boundingboxes, go figure...

This little snippet will generate oncoming traffic, using the same vehicle as the player:

_spawn = [] spawn {

	while {alive player} do {
		_vehicle = objnull;
		_frontpos = (player getpos [300,direction vehicle player]) nearRoads 100;
		if (speed vehicle player > 3 AND count _frontpos > 0) then {
			_vehicle = typeof vehicle player createVehicle (getposatl (_frontpos select 0));
			createVehicleCrew _vehicle;
			_vehicle setdir ([_vehicle,player] call BIS_fnc_dirto);
			_vehicle move getposatl player;
			_delete = _vehicle spawn {sleep 30;{deletevehicle _x} foreach crew _this + [_this]};
			sleep 5;
		};
		sleep 1;
	};
};

Only use this if you can handle the frustration.

 

Cheers

 

  • Like 1

Share this post


Link to post
Share on other sites


This is a really long video of a mission build, but one of the first things he does is set up a convoy. I've found if you use his technique and focus on specifically adjusting the drivers fleeing levels, and skills as well as setting them to safe etc etc you can actually get a fairly reliable convoy happening that will make it from point a to point b almost all the time.

  • Like 3

Share this post


Link to post
Share on other sites

This is excellent news. I will check it out. Thanks

Share this post


Link to post
Share on other sites

@JD Wang, @Tankbuster:  JD's link above is to a large collection of videos, the specific one you want is the one below.  I watched most of it and learned alot (Thanks JD!).  Dayz Medic succeeded in getting a convoy to do the following:

- 9 Vehicle Convoy

- Convoy drove through a town successfully making at least 5 turns before getting to main highway.

- Convoy drivers kept driving when under fire from multiple enemies.  Vehicles did not stop unless disabled or driver killed.

- When lead vehicle destroyed, 2nd vehicle became leader and detoured a bit, and resumed driving to next waypoint, and the convoy followed.

As JD said, its a long video, but I definitely learned some good stuff (like using Layers for caching units, and triggers for activating units in Layer).

 

  • Like 2

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

×