Jump to content
Tankbuster

c_van_02 sometimes doesnt follow setdriveonpath

Recommended Posts

Weird one this. I am finding that child vehicles of "Van_02_base_F" sometimes don't follow a route given to them by setdriveonpath.

 

Some background. I spawn, in a semirandom location, a roadblock (yes I know technically it's a TCP). The idea is that players are to man it and allow friendlies through but kill enemies. The mission chooses a vehicle type and an appropriate crew (ambulances are crewed by paramedics etc) and sends it towards the roadblock. It stops outside the RB if the gates are closed. The players then open the gates if they want the vic to drive through.

 

Note that I can't use waypoints here. The vehicles refuse to drive through the middle of the composition even though it's clear.

 

What this video shows are ALL civilian vehicles (though the final version spawns guers and blufors too), so they are all friendly. The vic stops at the pause point and waits for the gates to open. When they do, a function gives the vehicle 2 setdriveonpath positions, the first being in the middle of the roadblock and the other being on a road piece out the other side. The positions are shown by green arrows. When the vehicle gets to the last position, it sounds its horn and is given a move command to drive off into the distance. Another is then spawned. Rinse repeat.

 

What you'll see is all the non c_van_02s drive through without incident. Some of the vans do too, the first one does, but almost all of the subsequent vans get into some sort of trouble. It's not the driver, I've checked to see if the common denominator is the class of the driver - it isn't. Something I haven't exhaustively tested yet is the b_gen_van and the i_c_van. These aren't civilian and I'm wondering if this might be relevant. I'll try that tomorow. I've edited out the dull bits of waiting for the vehicles to spawn in the video.

 

In the meantime, does anyone have any thoughts as to what might be going on here?

 

 

 

Share this post


Link to post
Share on other sites

Note that the 6th and 7th vehicle, both van_02 do EXACTLY the same mistake. They drive to the right -relative to them- of the given path, then reverse in the same way before extricating themselves and driving off. Most odd.

Then the last one, again a van_02 drives through faultlessly, though the video ends a couple of seconds early when my GPU crashed.

Share this post


Link to post
Share on other sites

Did you try it without spawning arrows (perhaps this kind of "vehicle" (object) can be considered as obstacle?) Just an idea.

Share this post


Link to post
Share on other sites
11 hours ago, pierremgi said:

Did you try it without spawning arrows (perhaps this kind of "vehicle" (object) can be considered as obstacle?) Just an idea.

Yes, I only started putting the arrows in after this behaviour was seen. By the way, those arrows aren't entities, so I'm not even sure the AI can 'see' them.

Share this post


Link to post
Share on other sites

Ugh. LSV Prowlers are even worse. Every one of them crashed into the bar gate or the HESCO. Even a couple of offroads did too. BLUFOR and Indi Van_02s behaved just as badly as the civvy ones.

 

I'm looking at 7 months work going down the toilet here unless this can be fixed.

 

Next I'm going to try putting the setdriveonpath positions closer together.

Share this post


Link to post
Share on other sites

Try also to decrease the speed (in m/s so 3,6 * km/h in setDriveOnPath)

Share this post


Link to post
Share on other sites
1 minute ago, pierremgi said:

Try also to decrease the speed (in m/s so 3,6 * km/h in setDriveOnPath)

What speed to you suggest? I was using 20, but that made the vecs slow down, so I upped it to 30.

Share this post


Link to post
Share on other sites

Thanks mate. Trying it right now 🙂

Share this post


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

6 m/s, at least for passing the obstacle.

OK, I've tried a couple of times, 9 vehicles each time, about a third of which were van_02s and they do appear to be a bit more reliable, though it might just be random. As I said, some of the vans drive through no problem, others crash into stuff. I'm going to lower the speed down a little more, perhaps 4 and go again.

Share this post


Link to post
Share on other sites

There's no consistency in the results. Lowering the speed seems to make them drive more reliably over the first few setdriveonpath positions, but they usually miss the last one completely (after they've driven through then roadblock) and then ignore the move command that comes after.

Share this post


Link to post
Share on other sites

I wondered if the setdriveonpath command is supposed to use an ASL, but that made no difference. It was a long shot, there's no real reason why it should.

So I increased the number of positions passed to the command and there is some progress. This video is typical of the 20 or so run-throughs I've done so far. It is not perfect, I've still had a few go rogue on me, but it is improving.

 

I suppose I should just add more positions for even more reliability.

 

Added more positions, slight increase in reliability, also changed the speed sent to the setdriveonpath command to 10 m/s, that seems to help a little.

 

Still occasionally I see odd behaviour, vehicles not follwing the path and sometimes ignoring the speed set in the command. Ho hum.

Share this post


Link to post
Share on other sites

I know this is several days later - did you notice any difference between using agents as drivers instead of standard AI? If I recall in my previous testing - agents seemed to perform better in situations with setdriveonpath 

  • Thanks 1

Share this post


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

I know this is several days later - did you notice any difference between using agents as drivers instead of standard AI? If I recall in my previous testing - agents seemed to perform better in situations with setdriveonpath 

That's a good call, no, I haven't tried using agents. I'll have a go later.

I have put in a brute force 'fix', but it looks nasty. I bet for remote clients it's going to look even worse! Video below

 

 

Share this post


Link to post
Share on other sites

Hi TankBuster.  This is very cool.  You might be able to make the drive thru the checkpoint smoother by using setVelocityModelSpace.  In the chase sequence in my Razing Cane mission, I forced AI to accelerate smoothly in all straight sections of road by putting a trigger at the beginning of the straight section to start this script, and at the end of the straight section to stop the acceleration script.  It worked well, AI could not deviate from straight path while script running.  The script below controls speed for 2 vehicles at the same time (the AI vehicle, and the player driven chase vehicle (I was using this to prevent player from overtaking or ramming AI vehicle).  You can ignore the chasing vehicle part of the script.

 

Note: If you want to try this, you might want to relocate your road block a bit so it is in the center of a straight section of road, so AI can drive thru it in a straight line (currently, the AI has to turn slightly in middle of road block).

 

Hope this helps man!

Spoiler

// chaseCruiseControl.sqf
// Only use this when vehicle is traveling straight.
// _nul = [heistTruck,vehicle player,50] execVM "Scripts\chaseCruiseControl.sqf";};
params["_veh","_chaseVehicle","_cruiseSpeed"];
//hintc "in vehicleCruiseControl";
CruiseControlAbort = false;  // set this true externally to stop cruise control
CruiseControlOn = true;      // toggle this externally to control when setVelocityModeSpace is applied to vehicle
CruiseVeh = _veh;
CruiseVeh setVariable ["cruiseSpeed", _cruiseSpeed, true];
ChaseVehicle = _chaseVehicle;

_veh addEventHandler ["animDone", 
{
	pos1 = pos2; 
	pos2 = pos2 vectorAdd [0,0,0.75]
}];
onEachFrame
{
    _veh = CruiseVeh;
    _chaseVehicle = ChaseVehicle;
    _cruiseSpeed = CruiseVeh getVariable "cruiseSpeed";
    _forwardY = 0;
    if (!alive _veh or CruiseControlAbort) then 
	{
		onEachFrame {}; 
		_veh removeAllEventHandlers "animDone";
	};
	if (alive _veh and CruiseControlOn) then 
	{
        // accelerate vehicle to cruise speed
        if (speed _veh < _cruiseSpeed) then
        {
            _veh setVelocityModelSpace [0, (velocityModelSpace _veh select 1)+.04, 0];  // accelerate incrementally to reach cruise speed
        };
        // decelerate chase vehicle if too close
        if (_veh distance _chaseVehicle < 40) then
        {
            _forwardY = velocityModelSpace _veh select 1;
            _chaseVehicle setVelocityModelSpace [0, _forwardY *.9, 0];  // accelerate incrementally to reach cruise speed
        };
    };
    //systemchat format ["speed _veh=%1",str (speed _veh)];
};

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Johnny, thanks for looking.

So what I'm doing in the video above is using an inArea command and giving it a narrow box right along the middle of the road. When the vehicle leaves the box, I'm using both setVectorDir and setVelocityModelSpace. When I watch it closely, it's amusing to watch the driver fight as his vehicle is pushed back toward the middle of the road.

About roadblock positioning, yes, this is in the pipeline. The actual location chosen is dynamic (not near the coast, quite flat, no buildings nearby, no junctions and straights(ish) roads) and chosen in-script and I'm going to tighten up the part of the routine that checks for bends in the road.

The problem is that on my test client, it looks even more jerky than you can see in the video, which is captured from the local server host.

Also, see this page, we might get to play with these in upcoming game builds.

Share this post


Link to post
Share on other sites
52 minutes ago, Tankbuster said:

So what I'm doing in the video above is using an inArea command and giving it a narrow box right along the middle of the road. When the vehicle leaves the box, I'm using both setVectorDir and setVelocityModelSpace. When I watch it closely, it's amusing to watch the driver fight as his vehicle is pushed back toward the middle of the road.

Cool, we have similar approaches.  Maybe the driver won't jerk around if you temporarily disableAI "PATH" and "FSM" for the driver while in Area.  Worth a try.  You could even enableSimulation false the driver (maybe).

  • Like 1

Share this post


Link to post
Share on other sites

@genesis92xmy agents won't drive. They just sit in the drivers seat, they don't even start the engine. I've given him a domove, he doesn't do anything. I've joined him to the group and given him a waypoint, same result.

Share this post


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

Cool, we have similar approaches.  Maybe the driver won't jerk around if you temporarily disableAI "PATH" and "FSM" for the driver while in Area.  Worth a try.  You could even enableSimulation false the driver (maybe).

I should clarify. As most of the vehicles get through just fine, my fixer only kicks in if the vehicle leaves the box. Offroads, LSVs, Trucks, Hatchbacks, SUVs  and Van_01, they all follow the setdriveonpath brilliantly. It's only Van_02 that have a mental.

Share this post


Link to post
Share on other sites

You can see one little twitch at the start as the fixer turns the van but then it's quite smooth. I wish the bar gate came in a wide version as well. There's a lovely new bar gate that comes with contact, but it's even narrower than this.

Edit; PS, I've reverted to createUnit for making the drivers here. Agents didn't do anything.

  • Like 2

Share this post


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

It's only Van_02 that have a mental.

Oh Arma...that is completely insane that one particular vehicle behaves differently.  :face_palm:

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites
5 hours ago, johnnyboy said:

Oh Arma...that is completely insane that one particular vehicle behaves differently.  :face_palm:

Yes, it is so frustrating. It means the ultimate fix is to remove all the van_02s from the array of vehicles this particular secondary mission uses to generate its assets. Its such a pretty model too.

Share this post


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

@genesis92xmy agents won't drive. They just sit in the drivers seat, they don't even start the engine. I've given him a domove, he doesn't do anything. I've joined him to the group and given him a waypoint, same result.

Ah right. DisableAI FSM and moveto. 🙂

Share this post


Link to post
Share on other sites
On 11/8/2019 at 1:54 PM, Tankbuster said:

@genesis92xmy agents won't drive. They just sit in the drivers seat, they don't even start the engine. I've given him a domove, he doesn't do anything. I've joined him to the group and given him a waypoint, same result.

 

On 11/9/2019 at 8:26 AM, Tankbuster said:

Ah right. DisableAI FSM and moveto. 🙂


Yeah, you got it 🙂

  • Thanks 1

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

×