klamacz 448 Posted June 10, 2016 They told me to explain what is new AI driving and how it works. We've been working on it for many months, in almost complete secrecy (excluding occasional Oukej talking about vacuum cleaners).It is mandatory to mention, that it is still Work In Progress, has few bugs I know and many which I don't know about yet. Also, currently this new AI driving works only for wheeled vehicles, otherwise known as Cars.Now let me try to convince you that it was worth waiting for. Motivation, so why we even bother Main issue we wanted to fix was AI's inability to drive the car through narrow streets of most of the cities without crashing, especially on tight corners and complicated junctions. Trying to solve those issues in broad aspect of driving behavior we found out, we need also to refactor big part of code, basically everything related to AI driving. This led to creation of new component class, which can be added and configured for each Car, and many other changes, movements, improvements and optimizations.Finally, the purpose is to give us and mod-makers better ways to configure AI driving behaviors per vehicle, easier and more flexible ways for mission makers to control their AI, and precise and competent drivers for players to encounter. Execution, so how it is done Main point of new technology is a new component (AICarSteeringComponent), which encapsulates all related algorithms which steers the car. We chose to make it a component of Car, not AI agent or his brain, as tweaking of parameters of Component can happen per vehicle. In sense it defines driving behavior attached to type of vehicle, not a type of driver.We managed to move and rework most of actions driver can do in game, simple path following, but also keeping formation, following in convoy, un-stucking himself or reacting to player direct commands. All of those had to be refactored, simplified, optimized and enclosed in mentioned component. In the heart of new driving, we have PID controllers, those are common but very flexible algorithms, for example used in engineering for temperature control, or in automated vehicles, for speed or altitude control. We use them for both speed and steering, also allowing modification of its parameters in config. Participation, so how you can use it As a player, you can join development branch users, run the editor and spawn yourself a Hunter and AI driver to command. You will see different driving style in any wheeled vehicle, be it a truck or tuned hatchback. Also, as it was enabled by default for all cars, vanilla or not, you should be able to see the new behavior in all old scenarios, missions wherever AI drives a car.As a mission maker, or scripter, or if you just want to experiment more, you can still use script commands like: vehicle limitSpeed 15;driver vehicle forceSpeed 40;As a mod maker, you can configure your own vehicle and experiment with the config values directly: class AICarSteeringComponent { steeringPIDWeights[] = { 2.0, 0.2, 0.0 }; speedPIDWeights[] = { 0.5, 0.2, 0.0 }; doRemapSpeed = true; remapSpeedRange[] = { 10.0. 90.0 }; remapSpeedScalar[] = { 1.0, 0.35 }; doPredictForward = true; predictForwardRange[] = { 1, 20 }; steerAheadSaturation[] = { 0.01, 0.4 }; speedPredictionMethod = 2; wheelAngleCoef = 0.7; forwardAngleCoef = 0.7; steeringAngleCoef = 1.0; differenceAngleCoef = 1.0; stuckMaxTime = 3.0; allowOvertaking = true; allowDrifting = false; allowCollisionAvoidance = true; maxWheelAngleDiff = 0.2616; minSpeedToKeep = 0.1; }; Iteration, so what next It is still very much work in progress, and few additional improvements are planned. We are also aware that you can encounter some issues, especially on the beginning. Problem of unstucking is still very much open, as it's a challenge to find perfect algorithm for all the situations. We also will be looking into configuring different vehicles, and also how modders will try to use it, your feedback is not only welcomed, it's crucial. Please, report all problematic situations and places, but don't forget important information: type of vehicle, map, exact location, waypoint, order or any other way you are making AI drive. Screenshot with map coordinates and explanation of route is like, minimal data, required for us to analyze what could go wrong. You can also try pushing the AI, for example with "unit forceSpeed 40" which essentially overrides usual safe upper limit of speed, you can send multiple convoys across your islands and test the madness that ensues after, just don't forget to share those missions with us. 53 1 Share this post Link to post Share on other sites
klamacz 448 Posted June 10, 2016 And inbefore you go with "its broken", yes, there was an issue with Physx vehicles, fix is incoming. I will unlock the thread once the fix safely lands on dev-branch the fix is imminent and I go to watch some football. 16 Share this post Link to post Share on other sites
R3vo 2654 Posted June 10, 2016 Well done, I placed a Hunter on Tanoa, placed a waypoint north of Tanoa, and just let the AI drive. Best taxi drive I've ever had - video will follow soon for those not on dev branch e.g ~0.14% of all players Two things I noticed during the drive: - AI likes to cut curves -> This sometimes leads to a collision with close to the street placed objects - They sometimes enter crossroads to fast, especially when the road went downhill before and the speed was very high (150kph) A question about configuration: How does the driver know the dimensions of the vehicle. In the past, the driver would try to avoid objects which were not even in the path of the vehicle, just very close, which would then lead to very strange accidents. Again, well done, enjoy your weekend ;) Video: 4 Share this post Link to post Share on other sites
Alwarren 2767 Posted June 10, 2016 First attempt at the new driving AI. SIngle Hunter GMG: It reached its destination and only hit one wall while doing so.. sometimes the AI goes offroad for now apparent reason, and in general they drive slower than before, but that's fine, they do hit the metal once they are on long straight paved roads. Convoy: Consisting of: Hunter GMG - HEMMT Medical - HEMMT Transport - Hunter HMG I have to say unfortunately this turned out to be a nightmare. The vehicles would constantly bump into each other, even pushing each other off road. At one point the two HEMMT were so colied up that I had to use Zeus to get the two apart (I'm aware how dirty that sounds). Again, AI would randomly swerve off road, especially the faster Hunter in the back, but even the lead hunter would do that from time to time (right in time to kill a telephone mast). Vehicles would not keep formation.Settings was "Relax" and "Do not engage", normal speed.I'll keep you posted. 1 Share this post Link to post Share on other sites
klamacz 448 Posted June 10, 2016 Convoy: Consisting of: Hunter GMG - HEMMT Medical - HEMMT Transport - Hunter HMG I have to say unfortunately this turned out to be a nightmare. The vehicles would constantly bump into each other, even pushing each other off road. At one point the two HEMMT were so colied up that I had to use Zeus to get the two apart (I'm aware how dirty that sounds). Again, AI would randomly swerve off road, especially the faster Hunter in the back, but even the lead hunter would do that from time to time (right in time to kill a telephone mast). Vehicles would not keep formation. Settings was "Relax" and "Do not engage", normal speed. I'll keep you posted. Yes, this needs tweaking, please try Safe, it will make them use Convoy algorithm. 4 Share this post Link to post Share on other sites
Varanon 892 Posted June 10, 2016 I can confirm what Alwarren said.Reported on the bugtracker here: https://feedback.bistudio.com/T117597 Test mission included 1 Share this post Link to post Share on other sites
Varanon 892 Posted June 10, 2016 Test mission included Setting them to safe helps. However, they still often bump into each other. They definitely need to watch their speed 1 Share this post Link to post Share on other sites
Alwarren 2767 Posted June 10, 2016 Yes, this needs tweaking, please try Safe, it will make them use Convoy algorithm. Roger that, will try. Share this post Link to post Share on other sites
R3vo 2654 Posted June 10, 2016 Tried to get a convoy going for 15 minutes, no luck, the issues already start with how one has to set up the convoy. From the editor there is no way to tell which vehicle drives at what position in the convoy, that creates alot of confusion, causing the AI to get in order/line first -> bumping into everything, except there is enough space -> Tanoa Airport I know this is not really related to your pathfinding improvements, but maybe you can pass this down to one of the Eden devs. 3 Share this post Link to post Share on other sites
cosmic10r 2331 Posted June 10, 2016 Great news that this is being looked!!! I will test with a ravage convoy script I have tonight... Excited for these changes... Loving BI right now :) 1 Share this post Link to post Share on other sites
HeroesandvillainsOS 1504 Posted June 10, 2016 This is really exciting! Thank you! The initial post seems to indicate it works with all "cars" by default, but then says it needs to be configured for every "car." I know this is a test for vanilla as these features are new. But will any and every car, including modded (assuming they use conventional vehicle making practices) inherit the new behavior? Or just vanilla for now? Share this post Link to post Share on other sites
Alwarren 2767 Posted June 10, 2016 No luck with SAFE, here's a video. Sorry about the shitty audio, I had my mic open and it recorded the vibrations of the computer it was lying on 7 Share this post Link to post Share on other sites
R3vo 2654 Posted June 10, 2016 No luck with SAFE, here's a video. Sorry about the shitty audio, I had my mic open and it recorded the vibrations of the computer it was lying on Already looks a million times better than on dev. Really hope there is still room for tweaks. 2 Share this post Link to post Share on other sites
klamacz 448 Posted June 10, 2016 This is really exciting! Thank you! The initial post seems to indicate it works with all "cars" by default, but then says it needs to be configured for every "car." I know this is a test for vanilla as these features are new. But will any and every car, including modded (assuming they use conventional vehicle making practices) inherit the new behavior? Or just vanilla for now? By default all vehicles inheriting from base class Car has enabled component with settings as I've pasted in first post. This means every car which does not change parameters, will have it working, vanilla or not. 3 Share this post Link to post Share on other sites
f2k sel 164 Posted June 10, 2016 I'm not getting much improvement at my end. Using Convoy and Safe mode they still seem to exhibit the same issues as previously seen, ramming and driving off road. Rather than use brakes they seem to want to swerve left and right until they eventually hit something. In single vehicle mode they do tend to get there as long as there are no oncoming or parked vehicles to avoid, when they do encounter such an object they go off road and it's just luck it they don't hit anything or get stuck. I also tried using forcespeed but this also has an odd behavior, at lower speeds it seems ok 15kph but at 40kph the vehicle starts to swerve left and right as if they're warming up their tyres for a race. This can get so bad they will over do it and hit road side objects. 1 Share this post Link to post Share on other sites
Greenfist 1863 Posted June 10, 2016 I also tried using forcespeed but this also has an odd behavior, at lower speeds it seems ok 15kph but at 40kph the vehicle starts to swerve left and right as if they're warming up their tyres for a race. This can get so bad they will over do it and hit road side objects. Forcespeed doesn't seem to force that exact speed, instead the driver uses the closest of the three possible speeds - slow/normal/turbo. No, I assumed the given value was in km/h, but it's m/s. My bad. The swerving looks fine to me. My chauffeur was just slaloming the road marker posts: :icon_twisted: 3 Share this post Link to post Share on other sites
Wiki 1558 Posted June 10, 2016 Yeah, that convoy AI is still a nightmare :(The only 2 solutions I found to make a proper convoy are: -either use unitcapture/unitplay -or make each and every vehicle independant but with limitspeed. you place each vehicle one after another, not grouped and put the same limitspeed to each of them and it should work (more or less). Share this post Link to post Share on other sites
f2k sel 164 Posted June 10, 2016 Forcespeed doesn't seem to force that exact speed, instead the driver uses the closest of the three possible speeds - slow/normal/turbo. The swerving looks fine to me. My chauffeur was just slaloming the road marker posts: :icon_twisted: Are you sure about forcespeed, mine try and drive at whatever speed it's set to 1kmp they are walking pace at 100kmp they are going mental hitting every thing they can. Can't do video as my connection it too slow and takes forever. 1 Share this post Link to post Share on other sites
kylania 568 Posted June 10, 2016 Drivers seem to try to take shortcuts even when it makes no sense. Like it'll take a slight mud road that shortcuts around a curve, driving through a village instead of around it on the road they were already on. In this case it ended up stopping the vehicle when the driver of an SUV tried to drive northeast up a hill to take a foot path to La Rochelle instead of staying on the major road and driving NW around the lumberyard: Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted June 10, 2016 I am still getting AI refusing to drive sometimes, on the current 1.63 build. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted June 10, 2016 Drivers seem to try to take shortcuts even when it makes no sense. Like it'll take a slight mud road that shortcuts around a curve, driving through a village instead of around it on the road they were already on. In this case it ended up stopping the vehicle when the driver of an SUV tried to drive northeast up a hill to take a foot path to La Rochelle instead of staying on the major road and driving NW around the lumberyard: Those 'mud shortcuts' are classed as roads. Share this post Link to post Share on other sites
dragon01 902 Posted June 11, 2016 Looks pretty realistic. The same thing happens IRL when you're relying too much on GPS. :) Indeed, this problem stems from the exact same root - no differentiation between road types. Also, would that be possible to make a "keep to the rules of the road" option for AI? It'd try to stay as far to the right side of the road as possible, automatically clamp speed according to roadsigns (might need additional work map-side), would never go off the road and would take sharp corners very carefully. Basically, making it simulate a civilian driver, as opposed to a soldier whose only concern is getting from A to B in minimum time. 1 Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted June 11, 2016 Looks pretty realistic. The same thing happens IRL when you're relying too much on GPS. :) Indeed, this problem stems from the exact same root - no differentiation between road types. Also, would that be possible to make a "keep to the rules of the road" option for AI? It'd try to stay as far to the right side of the road as possible, automatically clamp speed according to roadsigns (might need additional work map-side), would never go off the road and would take sharp corners very carefully. Basically, making it simulate a civilian driver, as opposed to a soldier whose only concern is getting from A to B in minimum time. Just need a "dont leave the road ever" function, and also some test of surface type to prevent the driver picking roads on wrong surface types. Share this post Link to post Share on other sites
cosmic10r 2331 Posted June 11, 2016 Had a test... up thru La Rochelle... It is much better... I immediately noticed the AI braking before the corner where it seemed like the old way they would get way too deep into the corner before braking. Only hit one roadsign merging back on to the asphalt but certainly working to getting the big Red P on the back of the AIs cars removed LOL. I also noticed if you ordered the AI to disembark and re embark that i could re order a move point but once the ai reachs that point it breaks. Could then do again to get AI moving to assigned location via mapclick looking very promising... not to try some ambient cars and AI Share this post Link to post Share on other sites
mistyronin 1181 Posted June 11, 2016 I am still getting AI refusing to drive sometimes, on the current 1.63 build. Same here. Share this post Link to post Share on other sites