- 317

- France
Oh i've been having this pet project of mine with AI and lua scripts.I feel the same
Still working on Rouen les Essarts night configuration :
View attachment 1483985
but started to learn Lua sdk in parallel... as much as I discover Assetto Corsa script possibilities, my curiosity was triggered, I want to spend some time to understand why AI issues can't be tackled. A part from the Nuzzi app, I did not find many AI apps, and no open source, maybe that would be a nice project.
So far what i learned/achieved :
-The fastlanes are composed of a few payloads, mainly position points, inputs, vectors/directions, etc. So althought the AI is hardcoded and the payloads are strictly informative for the AI, you can actually extract the fastlane in some CSV file and edit, copy, slice apiece of fastlane to another. A great tool to take the first corner from a fastlane, the middle part from a second one, and the last sector from a third one, all combined into a final fastlane with all your perfect inputs.
I couldn't for the hell of me turn the converters and editors into a working lua app (and that's only because of a particular mathematical precision failure in the lua APIs) , but the python apps work wonders to convert AI->CSV->Ai files. If you're familiar with python you 'll find your way, i'll add them here, i just need to make better names extracts to avoid renaming each export/import.
So far, until i fix the stupid payload_0 first index error, here's the lua app with a reader (so you can track car's position from the payloads and edit the CSV files accordingly).
So, second part : now that you have the fastlane 3D position, and every info about it, you can translate this data to something exploitable by a lua script. You can use the @shi basic one, and add a behavior related to a car depeinding on its position around the Fastlane. I made a fastlane to lua values friendly converter as well.
@shi 's ai hints.lua should give you realtime access to what is basically ai_hints. It lacks proper BRAKEHINT at the moment, but at least it's real time. So far the furthest i got was a basic behavior with the car on the left side slowing down, while the car on the right side push harder, cars getting higher HINT values when they're on the fastlane, things like that. I stopped in the middle, out of free time to develop anything, but let me add the ai_hints.lua i had for Dundrod when i was trying things, you might find something useful in it (to use the ai_hints.lua, you need the track ext_config.ini to enable it).
To my understanding so far, choices have to be made. Getting all the cars' positions and updating on every frames depending on calculations on where they stand is gonna be costly. Might be worth it for some situations, not so much most of the time.
Anyway, one day i'll get my head back at it, if you wanna give it a try, my crappy codes are yours.
The Broken Car Kicker app on Overtake is interresting as well. It allows for real time control of some parts of the ai.ini files from each AI car. Pretty costly again if you run it real time, but going into the code, it's easy to either call it at start on the script.update and a few times thorough a track, which means you could improve cars behavior in real time depending on conditions. It shouldn't be too hard to give the inside car a late braking, allowing for some interresting modularity along the race.
Attachments
Last edited:








