AMS2 AI Developer Q&A - Physics & AI

Discussion in 'Automobilista 2 - General Discussion' started by Renato Simioni, Mar 23, 2025 at 12:01 PM.

  1. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    Let´s try this folks - for the next few days I´ll keep this topic open to try clarify as many questions or give feedback on user reports about Physics & AI development for AMS2 as you may have about AMS2 AI development past current and future.

    Some basic rules to keep this productive:
    • You may only participate if you already have 25 posts or more (the threshold for being an Active Member in the forum)
    • Each member can only maker one post, in which they may include up to three questions / reports they would like feedback on
    • You may link or copy an existing question or report made elsewhere in the forum that hasn´t yet been commented on by a developer
    • NO DISCUSSIONS to take place in this thread amongst members (but members are welcome to rate other members questions and reports in order to stress their relevance)
    • Members can discuss this thread amongst themselves including follow-up questions in the AMS2 Q&A General Discussions thread (albeit we make no commitment to answering these follow-ups)
    • For AI reports, it is paramount to use only original AI files; we can´t comment on issues running custom AI files as we don´t know the values they are using
    • Please try keep posts absolutely dispassionate - just the questions and the facts
    Please keep questions & reports strictly to physics & AI - if this goes well other lead developers might create similar threads for their fronts in the future
     
    Last edited: Mar 23, 2025 at 2:11 PM
    • Like Like x 16
    • Informative Informative x 5
    • Friendly Friendly x 1
    • Useful Useful x 1
  2. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    Reserved for future adding of general information about Physics & AI in AMS2
     
  3. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    For AI related reports, it is especially useful to document it with images (in case of performance reports) and especially videos that showcase the issues you are trying to gather feedback on - since many AI issues are specific to certain car / track combos and often specific regions of a given track layout, videos do a great job of not only llustrating the problem but informing us where we can reproduce it to try make improvements.

    This is a very good example of an user´s video report by @TomLehockySVK we´ve shared internally for further aI development so as an exception to the 3-point rule I´ll be commenting on evry single issue he raises as a template as to how we can best use this thread for similar reports which will both help inform us of issues that might need attending, and users as how the AI in AMS2 works and what are the prospects for its future development:


    1) 0:0-0:28s : AI cars getting bogged down by other slow starting AI Cars: Firstly some context on the AI logic at play in standing start scenarios, here the AI is subject to three main behavorial variables, one is Start Reaction (which as the name suggests defines how quickly the AI driver reacts to the lights going green - this is an AI personality variable so specific to each AI driver and moddable via custom AI files); the other is a type of AI mistake that can occur randomly with random magnitude for every AI driver, the frequency each these mistakes occur being defined at the class level (more often for older classes without electronic assists or sophisticated modern clutch systems, less often or disabled for modern classes with Traction Control and / or Launch Control); the third is a performance scalar we need to calibrate manually per car so the AI launch performance is similar to what the player can achieve both in dry and wet conditions.

    The issues illustrated are in the video are twofold - the bad starts by AI cars is excessive both in terms of how many AI cars have bad starts, and how bogged down they get; AI drivers having bad starts can then trigger a chain reaction as even in highest Aggression settings the AI is generally set to be conservative navigating tightening spaces especially for faster classes in race starts in order to reduce chances of carnag - AI being too conservative on race starts is bad, but pileups are worse.

    This can and is often being fine-tuned from class to class update by update; the magnitude of AI bad starts in historic classes such as the F-Classics for instance have since been reduced so the issue should already be less severe and less frequent.


    2) 0:29-1:20s : AI taking too long to pull off the track following damage / mechanical failure: This issue is primarily a result of the logic for AI pulling out in case of failure being developed for ovals where previously their abrupt reaction pulling out when suffering a failure would cause major high-speed pileups; the current logic clearly doesn´t suit road courses as well. This is on the taskboard to be fixed over the next development cycle.

    3) 1:20-1:53s AI Multiclass racing: Not clear what the issue is here, I am assuming it is about the occasional hesitance from the faster cars to complete a pass; this can and is always being fine-tuned but there is always going to be a safety margin especially when it comes to such speed differences navigating such a tight and winding section; more risk-taking results in more incidents and as per above that is the worse of the two evils.

    4) 1:54-2:16s & 2:44-3:01s AI cutting to the grass: This is another of those content-specific issues that are constantly being fine-tuned as it is subject to both car variables (the risk threshold for an AI of given car to decide to take to the grass to avoid another car) and track variables (what are the AI lines and corridors through that corner defining the parts of the track the AI should and should not take); these are constantly being adjusted and have been since this video went up, so AI cars should generally be going less often and less deeply into the grass in that specific corner and others; it still needs further improvements however.

    It is not something you could necessarily improve with lower Aggression settings because at Lower aggression the AI will also be giving more space to other cars and being more conservative as to how close it gets, leading to it deciding to go off-track more often, Can and is often being fine-tuned on all levels.

    5) 2:20-2:43s: AI track rejoin logic: Needs improvement - another already on the taskboard for the upcoming cycle.

    6) 3:02- 3:28s: AI Multiclass Traffic: Same reply as 3.

    7) 3:29-5:18s: AI vs AI Racing Again similarly to 3, except in the case of the Kansai hairpin I wouldn´t expect things to change much; there simply sn´t enough space, braking and speed differential for the AI to decide doing anything else then fall in line there.

    8)5:19s-5:37s AI Drafting other Cars AI makes no distinction between player and another AI car wrt chasing the draft of a car ahead; it simply is not doing it because at that distance and speed the draft effect is minimal. In V1.6 we generally furher fine-tuned the drafting thresholds (which is another custom variable for each car / class) as the drafting distances were generally too high which could lead to a whole train of cars pulling to the inside on a straight to follow a car doing an overtake or defensive move; as always further class-specific fine-tuning is almost surely possible and will be performed over time.

    9) 5:38-6:42s: AI "Train": Same reply as 3 above.

    10) 6:43-6:54s Frequency of AI taking defensive lines: The frequency AI elects to make defensive moves is subject to AI personality and car-specific variables - more agressive driver (and / or higher AI Aggression settings) will lead to AI drivers making defensive moves more often; the likelihood is also increased in modern formulas and slower classes relative to historical classes and those with very high power-to-weight ratio. These variables are also subject to fine-tuning and are generally set conservatively so we can gauge their impact; it should generally grow more frequent overall in future updates.

    11) 6:55-9:06s: AI vs AI Racing: Agreed with the basic premise of the point, AI vs Player logic is generally excellent, AI vs AI logic still needs and has room for further improvement; the reason for development priority here is fairly obvious but naturally good AI vs AI racing is also critical for the overall race results - we can and have slowly but surely improving Ai vs AI racing and will continue to do so in future updates.
     
    Last edited: Mar 23, 2025 at 8:39 PM
    • Informative Informative x 14
  4. stealthradek

    stealthradek Driving character: Chaotic good AMS2 Club Member

    Joined:
    Nov 22, 2020
    Messages:
    828
    Likes Received:
    717
    Excellent opportunity to get some additional insights:

    - Since you've been able to allocate more processing power to physics, are you planning something similar with the AI physics, or whether it's possible to get AI to run on physics that are much closer (or maybe even the same) to the player?

    - Does AI have an internal "road rage" attribute that makes them drive worse/ultra-aggressively after they've lost some positions or been involved in an minor collision/spin? And if not, is this something you can think of implementing in the future to simulate underperforming drivers?

    - And a lightweight one to finish off: What was the biggest success you've done with the physics that you never thought it's possible and ended up being just a great overall win?
     
    • Like Like x 1
  5. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    Every time we elaborate the logic for AI performance, behavior or strategical decisions we are effectively allocating more resources to AI-centric calculations; there isn´t a need to expand on how many threads it runs on or any major structural reform to make them better.

    To give some perspective, below are a sample of the variables every single car in the game has - these are the variables we can and are regularly adjusting for each of them. Not included below are the AI´s own tire model and AI Driver personality or Global variables (those that apply to all cars) and hardcoded variables that are adjusted only via code changes.

    Screenshot 2025-03-23 111734.png Screenshot 2025-03-23 111917.png Screenshot 2025-03-23 112041.png

    More than 50% of these we have created over the course of AMS2 development; about 30% of the remaining were global variables that already existed in Madness but that we made car-spefific.

    Please don´t ask which and what each of them do as I won´t answer it :p this is just meant to illustrte the scale of the AI behavior modelling and how we constantly making it more and more elaborate. By the time we are done with AMS2 we will probably have expanded on these by another 50%.- reason for them not being there yet other than obvious required development time is that throwing in more variables can muddy the water in assessing / developing / calibrating AI performance & behavior which at the moment are prioritary over making them more unique or creative.

    Not yet; there is a plan for something like this but it is one of the things but as per reply above it is the type of thing that can only be introduced when overall behavior and performance calibration is close to the sweetspot.

    Tire developments always bring the biggest overall wins as tire modelling is the most critical factor in any racing sim; a minor tread adjustment can net a more perceptible improvement than making the suspension geometry of a given car 1:1 with the real one vs some generic geometry it might be previously running on .

    As such the biggest "surprising" overall win was through the tire hysteresis overhaul through v1.6 development; not only it made a bigger difference in its own right than we figured it would make, it increased the scope for further tire modelling developments around it and made v1.6 physics overhaul even bigger than v1.5 was even though in terms of magnitude and scope V1.5 had been more in-depth and wide reaching in other physics fronts..
     
    • Like Like x 6
    • Informative Informative x 3
  6. MarcG

    MarcG Well-Known Member AMS2 Club Member

    Joined:
    Mar 8, 2016
    Messages:
    653
    Likes Received:
    329
    Brilliant idea Renato, I'll start with something "simple" (he says!);

    Being a self-confessed AI Expert <cough> one thing I miss from the ISI/rFactor days is the ability for the user to help AI "Learn" individual tracks, this was incredibly helpful when the AI were 99% good around a particular circuit but there was always one corner they'd be too slow/too fast/mess up on etc. By using the Learning tools I/we had the ability to help them train and become better suited to those troublesome corners or sections of track, which prevented the need to report it as a Bug then wait endlessly until the development team could fix the issue.

    So my question; Is there anything in the Madness/Reiza Engine that has anything in the code for users to do their own AI Learning and/or is it something that you might consider adding yourself one day?

    From the outside it appears you have to manually tweak every node for every vehicle, which I can imagine takes time, this is where AI Learning may actually benefit this and/or future titles from Reiza.

    Many Thanks.

    P.S. If you want to offload some of the AI work, I'm looking for a new job :whistle:
     
    • Like Like x 3
  7. Mazdaspeed

    Mazdaspeed Well-Known Member AMS2 Club Member

    Joined:
    Aug 25, 2022
    Messages:
    1,569
    Likes Received:
    800
    Thanks for doing these Q&A, they are incredibly informative.

    1. The AI seems to get some sort of boost when within 1 second or so of themselves or the player, I understand that might help with them overtaking each other but it can also create the dreaded pack racing as slower cars are made more competitive due to that boost. Is that by design or can that be improved to make the AI vs AI battles and field spread more realistic and natural? Specially in classes like the Formula cars.

    2. While the AI do slow down a bit and pit for repairs, they seldom retire from damage unless they lose a tire. Are there plans to make them retire more regularly from heavy damage? For example if they lose a rear wing in the formula classes.

    3. Is the custom AI feature to edit the engine/torque/aero(can't remember the exact wording) parameters still on the agenda?
     
    • Agree Agree x 1
    • Winner Winner x 1
  8. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    Not yet; I am not a big believer in it as a concept at least for core AI calibration matters; for one we´d be delegating a chore to the player that should be done by the developer; for another it would inevitably mould AI performance around that of the player, and that has its bad side - unless the player is an alien-level driver, his / her own performance is going to fluctuate quite a bit relative to optimal going from car to car, track to track and condition to condition; there would be no bar for the player to clear as he would effectively be setting the bar for him / herself based on how high he can jump to begin with.

    With that said there could be value in some adaptive AI logic running on the background further down the line for the purpose of rounding up persisting minor rough edges in AI calibration; but the core of the work should first be done by the developer.


    It certainly is a time consuming process, but the primary reason overall AI Calibration has been an ellusive target so far is because the player physics has also been under constant development throughout AMS2 development, so we´ve been chasing moving goal posts throughout.

    Bit by bit we are edging closer though and at least as far as dry weather physics go the changes are unlikely to be as fundamental moving forward so it´s just a matter of knowing where persisting discrepacies still remain.in order to addres them.
     
    • Informative Informative x 4
    • Like Like x 3
    • Friendly Friendly x 1
  9. deadly

    deadly Well-Known Member

    Joined:
    Jul 8, 2016
    Messages:
    1,575
    Likes Received:
    542
    My two cents on this AI train thing:
    Fast AI which are going to overtake slower ones catch up very quick, but then, instead of going for the move decisively, they tend to come much too close to the rear of car in front and ram instead of using the track on the inside.
    Maybe, if they would learn to keep more distance to each others, they could use the free space better?
     
    • Agree Agree x 4
  10. Dylan Hale

    Dylan Hale Well-Known Member AMS2 Club Member

    Joined:
    Jan 10, 2018
    Messages:
    1,913
    Likes Received:
    1,189
    3 questions.
    2 small ones and 1 big one.

    1. Why do the AI keep get locked togeather nose to tail?

    Having gone back to Project cars 1-3 and Need for Speed Shift 1-2, its extremely rare to see two cars locked toegather as of their trying to tandem draft, yet this is something that constantly happens across all car types and disciplines in AMS 2. My hypothesis is, at a certain point the rear car is no longer aware of the front car's presence and so they just continue driving as normal unknowingly locked togeather?

    (Worth noting this does happen occasionally on GTR2 and GT Legends, both ISI games)

    2. Whats the major differences in the oval AI.

    Typically the oval only AI is sort of hit or miss throughout the different builds and oddly enough, the none oval AI car's like GT3 and GT1 at times have worked better than the oval specified cars? So whats the deal with that, and whats the differences between the two AI sets?

    3. (The big question dynamic question)

    Older games like GP4 and GPL both use a sort of seed based AI race director system which controls when, where, and how AI suffer car failures and crash out of races. Every time you start the race or reload a session, the game generates and new seed and different things can happen. Other more modern games also use this system (Grid 2019 and Grid Legends as examples with cars just pulling the handbrake going down straightaways to start a massive barrel rolling crash.)

    From what has been talked about before, I understand AMS 2 doesn't use this system, (or it doesn't rely on it as heavily as other games) as the ADM allows for the dynamic wear of various simulations of the car's systems. For example, I ran a 200 mile CART race around Brazilla and 11 car's of 26 finished with 5x Mechanical failure rates, with most cars suffering turbo failures or overheating problems. (Including me as the player) This also seems to be true with AI pit strategies, with AI having thresholds for when to pit, add fuel (if allowed), repair damage (which I never see them do), or to change tires. (And soon that will get even more complicated with tire set limitations and different compounds of tires for the AI to use)

    So my question is, why did you decide to make all these things dynamic and fluid, vs a rigid seed based system like other games? It seems like a TON of extra work to try and get all these different systems balanced togeather, and all the logic working right for all these different systems, in any sort or situation a player might be able to come up with. So whats the goal and the vision behind this decision?
     
    • Like Like x 1
  11. 3dquick

    3dquick Active Member

    Joined:
    Oct 30, 2022
    Messages:
    268
    Likes Received:
    75
    Thanks for the opportunity. My 3 questions are old ones but have never been fully answered.

    1) is it possible to have less than 14 degrees steering lock in car setup as the minimum customisable value?
    2) Can steering sensitivity be activated for digital devices or are we limited to damping and speed sensitive steering? If it is the latter case then can we have the option to customise the minimum and maximum car speed when speed sensitive steering takes effect, like in raceroom? That´s 2 questions in one, I know.
    3) The DS RX car is the only one in the game that memorises external camera adjustments made with shift K. All other cars reset after each session, can whatever is different about the DS be copied across the board to other cars?
     
    • Informative Informative x 1
  12. TomLehockySVK

    TomLehockySVK Well-Known Member

    Joined:
    Aug 7, 2022
    Messages:
    1,287
    Likes Received:
    1,678
    Like i wrote in the other thread, first of all: thank you very much for sharing all the insigtful information in that discussion thread ! So people here also know - the 3.rd point, i should have worded that differently as i was actually giving praise that in THAT specific situation the LMDh AI driver showed zero hesitation and went 3-wide and made a successful overtake on me and the slower car class, and it was amazing to see.

    And if i still may ask 3 questions:

    1) AI defending the inside on corner entry makes racing feel more natural, but would it be possible to add AI changing their lane once or even twice on a straight, in an attempt to block an overtake or attempt to break the tow from the driver following them ?

    2) Real drivers often make passing moves which are not safe, sometimes they make it, sometimes one crashes, sometimes multiple drivers crash. Currently AI is extremely cautious and instead of going for a risky move they will 100% of the time bail out. Will the AGGRESSION setting eventually be able to have them disregard total safety in preference to making an overtake attempt at all cost ? Either against the player or another AI. Low setting resulting in them never doing such moves, maximum having it happen fairly often.

    3) For cars that have multiple tire compounds like more modern F1 cars, will there be something like that for the AI too ? I read some time ago that right now it is better for them to have one AI specific compound that results in an overall balanced experience, but whether multiple tires for AI will be implemented or not, how about a placeholder "Different colored tires" for AI. Like F-Ultimate Gen2 have Soft / Medium / Hard tires differenciated by colors, so even if the AI would have the same type of tyres at least the difference in color would make it feel that they put on a different compound for immersion.
     
    • Like Like x 1
  13. Bernd18995

    Bernd18995 Active Member

    Joined:
    Feb 15, 2023
    Messages:
    125
    Likes Received:
    81
    Dear Renato,

    thanks for the opportunity of participating in the Q&A.
    Watching some of the sebring imsa Highlights makes me wonder if there are plans to make tyre barriers physically simulated to a degree or if that would even be a possibility the way the physics are laid out in this Sim currently.
    Dont think there is a sim that is doing this currently and wonder why.
     
    • Like Like x 1
    • Optimistic Optimistic x 1
  14. Inkta

    Inkta Well-Known Member AMS2 Club Member

    Joined:
    Mar 27, 2016
    Messages:
    910
    Likes Received:
    355
    I'll jump in aswell:
    1- Is there a possibility to add something like "augmenting" aggresion? So that for example, in an indy 500 race the AI takes it extremely easy on the first laps, leaving 0.5, 0.6 seconds to the car ahead and as the race gets close to the finish the AI gets progresively more aggresive, or is the aggresion level fixed for the entire race?

    2- Do you think it will be possible to add something like a "generic" AI difficulty selector? Taken inspiration from iRacing here, they apparently will add/have added a adaptative AI difficulty, just select easy, medium or hard and the game, based on your previous records in the track aswell as your overall experience as a driver, will calibrate the AI to better suit your skill level.
     
  15. muzarati

    muzarati Active Member

    Joined:
    Mar 15, 2016
    Messages:
    181
    Likes Received:
    25
    1) Raceroom has adaptive AI which works quite well (still could be tweaked a bit) is this something that could be implemented in AMS2?
     
  16. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    Firstly I don´t think that happens as often as it once did - as per OP a bit of video evidence would do wonders in illustrating what you mean and where it is happening so I could give more precise feedback and maybe make adjustments if it happens to have margin for it.

    Basically it comes down to what the AI lines are vs the AI corridors (which basically restrict the areas of the track the AI is supposed to stay within) and a live-time assesment the AI makes of the spaces ahead of it -

    Many differences both in terms of what values are used for the many behavioral variables listed above and oval-specific values for the classes that have oval-specific variants; these oval variants hadn´t yet received a thorough revision in time for V1.6 releases, the F-USAs received that treatment in the January updates and the tintops received it in the latest V1.6.4.3; not perfect by any means but at might higher level than it was before. I´d suggest checking them out and revisiting this question after you do - remember videos help a lot illustrating your point :)

    Because anything dynamic is generally better than rigid even if it does take more time to get things right.

    Unfortunately this question is also very short on specific information about what classes yiou experienced each of those issues so I can´t try reproduce what you are commenting on and give you more specific feedback (or fix something that might indeed be broken).
     
  17. 50footELVIS

    50footELVIS Member AMS2 Club Member

    Joined:
    Apr 6, 2019
    Messages:
    29
    Likes Received:
    64
    Ai (contact aversion)

    Over the development, Ai has shown a more natural aversion to lateral contact with drivers in single player. (they had janked in a fearful way in the past) They ended up less defensive and now keep their lines with minimal defensive aversion. My question is the reverse of this behavior, and is regarding rear contact.
    Are there applications to this method of Ai averting contact? (once Ai contact is made to human driver car rear or rear quarter panel)
    It seems that once contact is made by Ai, they continue their line and cause "pit maneuvers" and are not affected by the contact.

    I have had decent races with Ai and thank Reiza for their continued work. If there is the potential for Ai to respond in backing off a bit after contact with drivers and, I would consider them to be considered among the best in sim racing.

    I also hope that there is an improvement to reduce Ai's top-end speed bursts on straights (that catch human drivers and pass them, as if a boost button was pushed.) Other than those two,
    I have had enjoyed the single player experience with Ai.

    Just observations and an opinion.

    Cheers.
     
    Last edited: Mar 24, 2025 at 12:09 AM
  18. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    It´s possible, but at this point this would lead to another setup reset accross the board and we don´t want that; there are other ways to allow more control for steering sensitivity.

    Not really a Physics / AI question so I can´t really answer this with any precision beyond indicating there is still a plan to introduce further improvements to gamepad / digital controllers.

    Likewise not Physics / AI related I´m afraid but I´ve passed this on internally ot check on if it follows as a bug report.
     
    • Like Like x 1
    • Informative Informative x 1
  19. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    There can be and have been changes to what sort of AI behavior is scaled by Aggression setting and how much it is scaled by; we have changed quite a bit on the former on the run-up to V1.6 release and the latter is constantly ongoing.

    There are indeed different properties for the AI over the first lap (or the first 5km of a race depending what gets completed first) both intended to improve their dynamic behavior looking for spaces as well as minimize incidents, some tracks also have a custom AI lines designed for the initial few corners.

    As with most things AI-related there are lot of custom properties here that are class / track specific and these are constantly being fine-tuned; I think AI performance into the 1st lap has improved considerably over V1.5 and V1.6 development but especially from further back the grid there is still a degree of conservatism to minimize risks of incidents which hopefully we will still improve on.

    The answer here is similar to the one in post 8.
     
    • Informative Informative x 2
    • Like Like x 1
  20. Renato Simioni

    Renato Simioni Administrator Staff Member

    Joined:
    Feb 14, 2016
    Messages:
    5,094
    Likes Received:
    48,915
    This is more a track / code question than Physics / AI, in any case I´d say adding more refined elastic properties is possible but not currently on the plans; as to why it´s generally not done I´d say for the most part it´s because it might take some processing power that is better used elsewhere.
     
    • Informative Informative x 2

Share This Page