Jump to content
Sign in to follow this  
Heeeere's johnny!

AI path finding - bumps into stones and walls when driving a car

Recommended Posts

Hi there,

has someone else had the problem that NPCs (i.e. AI soldiers) were not very good in finding a path around stones when driving through the "wilds"?

I've made that experience a lot now since I was trying to get an AI soldier to drive an SUV from somewhere in the hills into a certain place of Kavala. Whereever I placed him and the car, sooner or later he bumped into a stone, destroying at least one front tire. Maximizing his skill value does not seem to make any difference. When I start the mission with everything in the same spot, he always bumps into the same stone.

This is basically the code which makes it all rollin' (no details):

_driver assignAsDriver _suv;
_driver orderGetIn true;
_driver move _destinationMarkerPosition;
//...and then he starts driving

I'm still working on finding out the differences between all those "move" commands. Right now, I only know that moveTo cannot be used for vehicles (as the wiki already says it's for persons).

Is there a way to make the AI drive more carefully or to plan the path sort of "better", so they keep larger distance to stones and walls? This would be very helpful!

Best regards,

waltenberg

Share this post


Link to post
Share on other sites

The driving AI is shocking, it's true.

It seems that some vehicles are worse than others so the actual problem might be related to the vehicle rather than the driver. For example, Ifrit drivers seem to be forever crashing into corners, they seem to turn in too early for the corner.

Anyway, for a possible solution, try putting an animal directly in front of the rock, or perhaps, inside it. Rabbits work quite well, the drivers avoid them. You might need to disable some of the AI functions of the rabbit to stop it running away.

Share this post


Link to post
Share on other sites

The problem is that I want the AI to start from various different places, not only one and the same spot. So placing a rabbit in front of that one rock won't help much.

But thank you for the idea!

What just came to my mind and I haven't checked it yet, was to set a speed limit. As I don't know if the problem is caused by bad path finding or too fast driving, I'm wondering if that has an influence. Any experiences?

EDIT: In that same thought, is it possible to get the positions of the waypoints the IA will drive through when finished path finding?

Share this post


Link to post
Share on other sites

As far as I know, there's no way of getting or predicting their route. A speed limit might help, I've never though of that. Give it a try.

Share this post


Link to post
Share on other sites

Could give expectedDestination a try for predicting the AI's path.

I remember trying this command with soldiers once and it kept giving a point about 50 meters infront of them that was constantly changing, sort of a predict where they would be in 2 minutes time.

Maybe cobble this together with an intersects or near objects for example. If there is something close inject, a waypoint and set it as current.

Just an idea off the top of my head..

Share this post


Link to post
Share on other sites
As far as I know, there's no way of getting or predicting their route. A speed limit might help, I've never though of that. Give it a try.

A set speed max limit does help.

I use it all the time,set most armour veihicles to speed 9-11kmh. 9 Will keep same pace with infantry,good for "rolling attacks"

simply restrict limit speeds through triggers when part of the map has town etc,then set trigger to increase speed when out of town/built up area.Works well.

An unstuck command can help with sqaud vehicles.

Share this post


Link to post
Share on other sites

Uhm, I allways thought this would be the no1 bugfix to be done. It's absolutely a stopper of good City scenario building. But seems it's not the priority...

Nice idea the bunny one.

Share this post


Link to post
Share on other sites
A set speed max limit does help.

I use it all the time,set most armour veihicles to speed 9-11kmh.

How does it work? What is the code you enter?

Share this post


Link to post
Share on other sites

Would there be a way to apply a global speed limit to all vehicles of a certain side? To be specific, I use BangaBobs COS system for civil populations but their drivers are batshit lunatic and often run over fellow civvies, is there a quick way to script all civilian drivers to say never exceeed 25kph?

Share this post


Link to post
Share on other sites

The AI drivers in arma 2 were the same ,And that was never corrected after some years so lets hope something comes up for Arma 3

Share this post


Link to post
Share on other sites

Don't forget that limitSpeed must be applied continiously, e.g. in a loop. Otherwise the AI will change the limit again immediately. As for the topic: If the player doesn't see this car or is on a passenger seat just teleport it to a close-by road, wait a reasonable amount of time and then let him move on. Saves you a lot of work and some nerves. I've had my own troubles with AI driving. Worst thing are the tanks that always get stuck on these little stone walls, makes tank assault missions virtually impossible.

Share this post


Link to post
Share on other sites

As a workaround, you could make the vehicle invincible until it arrives at its destination...

Share this post


Link to post
Share on other sites

But that won't prevent it from stucking I guess.

Share this post


Link to post
Share on other sites

No, but you could put a physx EH on it and perhaps jiggle the vehicles position when the EH fire and the vehicle speed is < 1?

Share this post


Link to post
Share on other sites
Don't forget that limitSpeed must be applied continiously, e.g. in a loop. Otherwise the AI will change the limit again immediately. As for the topic: If the player doesn't see this car or is on a passenger seat just teleport it to a close-by road, wait a reasonable amount of time and then let him move on. Saves you a lot of work and some nerves. I've had my own troubles with AI driving. Worst thing are the tanks that always get stuck on these little stone walls, makes tank assault missions virtually impossible.

From https://community.bistudio.com/wiki/limitSpeed

A3 1.24 we don't need loop for a continus effect, limitSpeed alone is enough.

Share this post


Link to post
Share on other sites

Oh, a change in 1.24. Didn't know about that, thanks for the heads-up!

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
Sign in to follow this  

×