The online racing simulator
Test Patch D4 (now D48)
(704 posts, closed, started )
Quote from Viperakecske :How do we fix fps stuttering when someone leaves the pit whit mod car?

1) If there is a bad glitch with a particular mod, you should talk to the mod creator and make sure they use the latest editor test patch. Since editor version D26 there are limits on the number of triangles in the second LOD (shadow LOD). Often mod creators have been lazy and instead of spending a short time to make a low poly shadow mesh, they instead made a direct copy of the main mesh. The recent editor test patches impose limits on that.

2) In the development version which we are all waiting for, there is delayed texture loading, so the car is initially created, but the textures load over subsequent graphical frames, instead of loading them all at once.

3) This has nothing to do with the test patch.
Quote from Scawen :1) If there is a bad glitch with a particular mod, you should talk to the mod creator and make sure they use the latest editor test patch. Since editor version D26 there are limits on the number of triangles in the second LOD (shadow LOD). Often mod creators have been lazy and instead of spending a short time to make a low poly shadow mesh, they instead made a direct copy of the main mesh. The recent editor test patches impose limits on that.

2) In the development version which we are all waiting for, there is delayed texture loading, so the car is initially created, but the textures load over subsequent graphical frames, instead of loading them all at once.

3) This has nothing to do with the test patch.

Development version will be out this year ye? LFS
I actually find it easier to work when people don't constantly antagonise me.

And you are trying to bug me, because I have told you countless times that this is the test patch thread, which is to discuss changes in the test patch. There is no other purpose for this thread.

I'm working 11 hours a day trying to finish things to get onto the other thing I was working on, so I can get back onto the other thing i was working on before that.

But your constant nagging at me, just makes me annoyed, less willing to put in that amount of work time. It may be a strange concept, but not really surprising when you think about it, that it's easier to work for people if they aren't annoying you.
Don't want to be a sheriff, but sorry I can't resist. For all those who disturb Devs heads...


I'm one of the "single player" user. Big thank for any AI updates.
I agree! AI Update is also interesting topic for me, regardless of if I am being active here or not.

I think Bike AI could take corners a much faster speed, and perhaps giving to Novice Level AI the current speed of what they are capable of.

Unless there is upcoming issues, who knows. But I test some combinations and sure, they could take at least a notch or even two.
+1
Currently, even with patch D40, which is a real improvement eagerly awaited by (almost) everyone, the AI remains too slow.

I don't know about bikes, but for LFS turbos and GTRs, a slow racer with the default setup can go from last to first in just 5 laps, against 20 AI.
Two additional levels seem good to increase AI speed by 2-4 seconds per turn on medium length tracks.

The other home-made solution consists of manufacturing specific cars for the AI adapted to its level. But the general behavior of the AI must first be improved. With the D40 patch, it's already much better. Thanks Scawen Smile
I've done some updates for overtaking that more sensibly group the cars in front together, instead of taking each one as a separate object to pass. It's hard to describe in words, but it boils down to a single "left" or "right" or "brake" decision on the group, instead of doing that separately for individuals then choosing one of the results. It means that more sensible decisions can be taken. Also it can add more AIs that aren't directly in front but are beside the cars that are in front, so hopefully they can make their way around a pileup. It's not a navigation algorithm but makes a better estimate of how far right or left it may have to go.

Just for the record, the bikes aren't slow because I have somehow failed to notice that they are slow. It's because if I turn them up any more it is very unlikely they will make a lap. They'll run wide or ground out or wobble at a bump and generally wipe out far too often. The bike AI are super sensitive to bumps and jumps in the road and as I mentioned before, there are issues with the tyre physics. So bike AI speed is not something to spend a lot of time on at the moment.

Years ago I updated the development version quite a bit, to make the cars a bit more competitive. Unlike in some games, the AI in LFS use the same physics as human drivers, and it's not an easy task to make them simply drive faster. The level of understanding for where you can push and the lines to take, is not an easy thing to code.
Thank you very much for this patch.AI improvements are good news.
¡Good job!
Well, certainly. As there are bunch of different bikes with various physics.

So, back to original status: to wait tyre physics.
Quote from Scawen :
Years ago I updated the development version quite a bit, to make the cars a bit more competitive. Unlike in some games, the AI in LFS use the same physics as human drivers, and it's not an easy task to make them simply drive faster. The level of understanding for where you can push and the lines to take, is not an easy thing to code.

Deciding that AI uses the same physics as humans is an ambitious choice. This requires AI to be as responsive, calculating, reckless and unpredictable as a virtual racer, to achieve the same level of performance and appear credible. I understand it's a bit difficult to code Big grin

The improvement in AI anticipation undeniably improves the way it drives. Until the AI becomes more human, giving it a little mechanical advantage works pretty well to make offline racing more enjoyable. This is the desired result. And it works best with patch D40.

Smile Thanks for spending the time to improve this. Despite the impatience, provocations and other nonsense that we can read, all your efforts to improve this game are always very appreciated.
Quote from Scawen : The level of understanding for where you can push and the lines to take, is not an easy thing to code.

Please forgive me for the triviality of these remarks, and I don't know if this helps.

Improving decision-making for overtaking is a very good thing. But the AI's weakness also lies in long curves and turns. The grip of the tires and the handling do not seem to be exploited to the maximum. Sometimes the AI corrects a loss of rear grip, while the player at maximum acceleration in the same place with the same car does not feel it.
The AI also brakes too early and too gradually. As if the AI respected an endurance-type racing protocol, always remaining below the limits.
The virtual racer doesn't calculate like that. He will use his car as much as possible. His limit is to finish the race.

Perhaps the AI's driving could be better adapted to the number of laps, just like the amount of fuel? The AI would thus be more aggressive, heat its tires more in short races and be faster.
That is exactly what I will not be doing for the AI in the old physics system. Anything related to grip, tyres, etc, would be a waste of time because it would not apply to the new tyre physics. As mentioned, I've already made the AI better at using the available grip in the development version (although there is far more that could be done).

For this update that I've been working on for a few days, it's the overtaking that I am improving. The recent, unscheduled, look at AI (started by watching the bike AI) alerted me to the problems with overtaking and ramming.

Work on this applies equally to the public version and the development version, so it's not a waste of time.
It wasn't a request. Just notes on how the AI uses the same physics as the player. I know and understand your priorities.
Big grin I am already very satisfied with this patch, which I did not expect.
First of all been loving following up on these test patch changes, some great stuff in here and as someone who mostly does random stuff offline the recent AI stuff is definitely something I'm very happy to see.

That being said, not sure how relevant these are to what's already been brought up or the scope of the AI improvements for these builds, but I do have a couple of points I'd like to mention after some testing with a few cars (both base content & mods) mostly on the Kyoto Oval (ovals are a great place to really stress test AI racing behaviour imo) on patch D40:

- When an AI tries to go and overtake, they throw the wheel out quite aggressively in the direction they wish to go, which at high speed in cars with lower grip can cause them to get thrown into a slide or a tankslapper and eventually spin/crash. This behaviour is probably fine at lower speeds but might not be a bad idea to see if there's a way to make them steer less aggressively to overtake as the speed gets higher.

- AI seem to be a bit too eager/early to try and overtake and will sometimes jump out of line when they don't have a run on the car ahead meaning they go nowhere. I have no clue how they exactly judge overtakes, but if there's some way of them being able to better take the speed difference between the two cars into account to determine whether or not they jump out or back in to line when making an overtaking attempt then that would help them race better and make overtaking attempts more successful.

- AI sometimes will crash into the rear/sides of another car that's trying to overtake if they're trying to pass them (e.g P3 can crash into P2 whilst trying to pass them if P2 is trying to pass P1).

- Now that the AI are more willing to run side-by-side with these updates it makes their "emergency braking" when being squeezed occur much more commonly. This behaviour has always been my biggest bugbear with the LFS AI and now that it's more frequent, I'd definitely personally love to see the AI emergency braking dialed back a lot, especially at high speed (maybe even reduced to just a short lift-off on the throttle at high speed as that's all it takes to get out of some of these situations) but also to maybe make the thresholds that causes it to trigger for the AI to be much tighter as it's always felt way too sensitive with them backing out of scenarios where two cars could easily fit alongside one another.

Hopefully these are of some degree of use and not just nonsense rambling, but if they are I'll just happily return to my cave lol and patiently wait for future updates
Quote from Ricochet1136 :
Hopefully these are of some degree of use and not just nonsense rambling, but if they are I'll just happily return to my cave lol and patiently wait for future updates

The AI lacks conversation. You needed to talk. Everyone can understand it Big grin

Smile Jokes aside, what you say is very interesting (at least for another bear in his cave Big grin). We all have different experiences with AI that are complementary. (I hope they are useful and not stupidly time consuming for Scawen. Maybe this is not the right place to talk about it?).

I often choose Aston cadet REV for my tests, for reasons exactly opposite to yours. It is a complex track with unusual technical passages.Before patch 40, it was impossible to race there with GTRs. After a few laps, the AI inevitably massed in herd to eat the grass of the first corner.
With the D40 patch, I was finally able to do a 20 lap race with no other problem than taking the lead too quickly and too easily. It appears that the new overtaking strategy may work better on some tracks than others.
I have also observed the consequences of the "emergency braking" that you speak of. In 2 races on Rockingham Historic, cars lined up side by side, perpendicular to the track, and no longer moved. This has not happened again since.
It would seem (and I would appreciate Scawen's opinion and your feedback) that the AI is behaving differently in the first races, or scalable to a certain extent, as long as the races continue without change track.
First, the AI remains in single file on its trajectory. Then the AI distributes itself a little better on the track on the straights. Finally, the AI begins to attack. And there followed a few slightly chaotic races, and it ends up stabilizing until we changed the grid or the track. Sometimes, without changing anything, an epidemic of pileups sets in, as if the AI were going crazy.I have observed this phenomenon on several computers and multiple installations of LFS.

So, I ask you these questions:
Have you observed the same “trend” at home?
How many times have you repeated your experiments to establish your conclusions?
Quote from Avraham Vandezwin :So, I ask you these questions:
Have you observed the same “trend” at home?
How many times have you repeated your experiments to establish your conclusions?

As I mentioned I've run several tests with multiple cars both from official LFS content and the mod pool, I have no clue on the exact numbers but I spent a good couple of hours trying different stuff and seeing what happend. The results were very consistent across the board for me no matter how many re-attempts and I adjusted my comments as I went along with any new/updated notes I had after each run to make sure I was certain on my observations.

At the end of the day though, that's all these are is just some observations with a sprinkling of opinions on where I personally think the limitations of these new AI changes sit, so I'm not surprised people will have different viewpoints to my own. Overall I do think these changes as they currently stand are a very positive step forward for the AI in LFS, but of course there's always room for improvement Big grin
Thanks for the comments. I've been running a pretty tough test case repeatedly while I make the improvements. In my debug setups it is deterministic so the same thing happens every time if I don't make any changes.

It's South City Classic with this grid of 5 bikes and 3 cars:

TSR500
REAPER X1
VULCAN 998
CRUISER
SZK 1300R
UF 1000
XR GT TURBO
FORMULA XR

On some rare occasions they have made a lap without any serious collisions. It's hard work trying to get these vehicles to avoid each other as they have such different speeds and lines. Still, I think it's getting better but my head is spinning quite a bit. It is incredibly confusing and frustrating, as any change to fix one problem tends to also have unintended consequences or introduce new bugs.

I look forward to handing it over to you guys for some more testing and I will check your comments again. Some of them are definitely problems I have been trying to deal with.

It's been a longer diversion than expected bit I do believe it is important.
To me, AI is good as is, they follow a path very well. What needs work is calculating the optimal AI path. This is autogenerated if there isn't one already available. This algorithm is quite complex and tricky, but Scawen managed to do it somehow and we can even see some iteration steps and optimization during path autogeneration. If I were in his place, I would put my focus on improving this algorithm to generate faster lines, that use more track width have later braking points, and better effort to hit the corner apex as now all of them are too wide and too fast at corner entry.

I don't know which method Scawen used there, but the best approach for this is an implementation of deep neural networks with a genetic algorithm. This is the only way that AI can actually be somewhat aware and have a learning capability, but these things are state-of-the-art research at the moment and this would be an overkill to implement in LFS.
For me with my mods, the AI are fine (not perfect) through the lap but the problems are in the braking area (my vintage cars are high power and low grip). They tend to brake too late and too hard. So they are racing well but then they all lock-up and spin / slide into each other. Maybe this is to do with estimating grip as discussed so maybe the new physics will fix it. As an interim could the ABS be enabled for the AI?
Quote from teeembo :For me with my mods, the AI are fine (not perfect) through the lap but the problems are in the braking area (my vintage cars are high power and low grip). They tend to brake too late and too hard. So they are racing well but then they all lock-up and spin / slide into each other.

Can you give specific examples of a race setup that is likely to reproduce this problem? I can then have a look in the debug version.

If possible, fewer cars is better and if it could be a quick loading track like South City or Fern Bay that would be helpful so I get a quicker turnaround. Westhill and Blackwood are a bit too slow to load in the debug version, when I have to restart frequently.
Scawen : would it be possible to add back (in the time they were doing it I tend to remember...) the automatic blip for AI when downshifting ?
Quote from Scawen :Can you give specific examples of a race setup that is likely to reproduce this problem? I can then have a look in the debug version.

One example is Aston Cadet reversed where they brake downhill into the first corner. It seems they can't handle downhill braking as this happens elsewhere.

I have uploaded a WIP version of my new Lotus 49 mod in case you have time to use it (getting a skin ID was overdue anyway Smile) - I think this car is an ideal stress case for the AI as it is difficult to drive (in a fun way!).

These cars were hard to drive in-period and the 49 has a very rear biased weight distribution plus it is on Road Supers Big grin

Attached images
AI-crash.jpg
Quote from Flotch :Scawen : would it be possible to add back (in the time they were doing it I tend to remember...) the automatic blip for AI when downshifting ?

I think this would help as well Thumbs up
Thanks, I've got the excellent F1 car and see the problem, of course not fixed by my updates to the overtaking code.

I'll have a look to see if I can spot any reasons for the apparently wrong estimate of braking ability.
If you scawen are improving now AI there is also one thing what i dont understand. When i set in lapper example 10min race and AI dont have no reason to go pit they will do it anyways every race. If that could fix also that they wont go pit until they really need to (low fuel, bad tyres or damage fix.
This thread is closed

Test Patch D4 (now D48)
(704 posts, closed, started )
FGED GREDG RDFGDR GSFDG