• "Mwoah" - Kimi Räikkönen
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dear Guest. Follow RaceDepartment on Twitter, Facebook, Instagram, Twitch, Steam and YouTube.

AC Corner Cutting Analysis Tool

Discussion in 'Assetto Corsa' started by Captain Condescending, Sep 4, 2017.

  1. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Hey everyone!

    So with the recent push in the Club races to stamp out corner cutting, I was trying to think of an effective way of enforcing it. In the absence of any proper reliable flag and penalty system in AC (that I'm aware of), it seems looking back post race is the best way. I'm not a staff member, so I can't comment exactly on how this is done for club races, and so this thread might be totally redundant.

    I know a lot of people choose to simply set penalties to off, and set the max wheels out allowed to 4, so people don't get messed up by dodgy penalties, and it's just a case of policing within servers. There's probably a great and effective way of doing it, but to me this seems prone to errors and conflict. To me, surely setting the max allowed wheels out to 2 (in club racing we allow 2 wheels outside the track), that way cuts are registered as such, but keep the penalties set to off. This way, especially in qualifying, everyone can be certain no cuts are being made, as laps will be invalidated (as far as I'm aware this is how it works?).

    I was discussing this with a friend, in conjunction with showing him simresults, and what they do with the race_out.json files, when I noticed that those files actually include a "cuts" value for each lap! A bit of explaining to my non-sim-racing friend and him fiddling with Go later, and we have made a little tool for analysing this.

    Now, this is in revision 1, literally thrown together by him in about 20mins, but i'll explain how it works, link to the GitHub and if this sounds like it's useful for you guys maybe we can get some improvements made: https://github.com/cj123/acstats

    The gist of it is as follows. Firstly, it prints out each lap for each driver in each session, showing lap times and number of cuts on that lap. Secondly, it flags which lap was the fastest by that driver in that session (this for qualifying sessions, you can see if their fastest lap had them cut the track). Thirdly, it compares each lap to the average of that driver's previous laps to determine if that lap could be considered faster. Finally, if a lap had cuts, and it was faster, it flags that lap as the driver having cut and gained an advantage (this is more for the race than other sessions of course).

    Pretty simple, I know, but I think with some work it could be very effective. I think the first thing that needs fixing is that it needs to disregard very slow laps from the averaging. Maybe it should ignore any laps slower than 107% of the fastest clean lap? Maybe higher than that? I don't know, that's where more experienced drivers need to weigh in.

    Anyway, I guess my basic question is, have I completely wasted my friend's time by not knowing or understanding something? Is this potentially a useful tool? Is there a better way entirely of judging corner cuts? I'm totally out of my depth here, so I'd love some experienced guys to weigh in.

    -Joe
    Edit: here's a download link for the tool -
    https://www.dropbox.com/s/w19oomoof9micwf/acstats.zip?dl=0
    Just extract them both in documents\assetto corsa\out and double click the .bat file. Results are in analysis.txt

    Edit 2: Scroll down a bit to see the results of some of my experimentation to get AC's track limits to be better. There's a download for a surfaces.ini file for Silverstone GP that makes it much stricter, and might be worth some testing. I'd love feedback on this!
     
    Last edited: Sep 4, 2017
    • Like Like x 2
    • Love Love x 2
  2. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    Hey man,
    first a very very big THANK YOU for trying to make this a better place and spending time thinking about solutions! :):thumbsup::inlove:

    To the program: Although I have basic programming knowledge from university, I don't know how to compile the files to make it a running thing to use. Could you give me a short instruction? I'm using netBeans for coding, if it matters :)

    To the problem it self: I did something similar with sTracker. Not that detailed but you see if the lap was valid or not and can sort it quite nicely. Your program seems to nail it better though.
    The general problem with that: I guess this program only reads the flag from the game?

    The problem aren't just the penalties, the problem is that the game doesn't detect cuts in the first place.
    Have a look at this little video! It's recorded with "gas-cut" disabled but with the rule set to 2-wheels-out.
    As you can see the game doesn't give a damn about track limits at Silverstone in the corners. But at the end I touch the grass and the game give a notification that the lap would be invalidated.

    If your program does not detect the limits in a different way, there sadly is absolutely no use for it in terms of cut detection, since you can still cut almost every corner without the lap getting flagged as invalid :(
    BUT it's still very promising for an offline alternative to watch the race results etc. :)
     
    • Love Love x 1
  3. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    So my friend CJ who wrote the program compiled it into an .exe and gave me a .bat to run it, so i'll upload these here. Basically just pop it in your "out" folder where the JSONs live, and run the .bat.

    https://www.dropbox.com/s/w19oomoof9micwf/acstats.zip?dl=0

    I see, so the main issue is AC's definition of track limits! My first question would then be, and I know it would a be a massive job, but could track files not be edited to tighten the track limits? ie go into the editor and add new definitions for the track limits? There are already mods which add more pit boxes, for example, to existing tracks, so why not modified versions with better track limits?

    Edit: It's a little buggy at the moment, and for me only outputs part of the file sometimes, but unfortunately CJ is on holiday so if he's willing to work on it at all, it will be sporadic at best.
     
    Last edited: Sep 4, 2017
    • Love Love x 2
  4. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    I really like how you think man! Big fat thumbs up!
    Thanks for the exe/bat! That is something I can work with haha. I had a look at the code though and looks very clean, I like the coding style you can tell that your friend! My professor would give a thumbs up :)

    I had the exactly same thoughts about modding the limits and yes, that would be totally awesome!
    But sadly another big problem would come up: we are trying to keep the "entry barrier" as low as possible so we are not using any mods in the normal, weekly race events. But especially in this events the abusement of track limits is really important to fight to give the new and/or slower drivers the feeling that it's 100% fair!

    But we also have special events with usage of mods so if you know someone who knows someone etc, go for it. Shouldn't be THAT much work to draw the track limit along the white line :p
     
    • Love Love x 1
  5. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Yeah the mod discussion is a big point of contention I'm sure. I totally get both sides, and of course while being a bit of a mod junkie, I do lean on the side of not making people install stuff for every race. Would definitely be a good mod to have though. Even if it was just for special events, or less frequent more competitive races (track limits defined so as to deal with incidents on-track and keep the racing going). All discussions for you staff members really :p

    If any budding modders who are familiar with the map tools do stumble upon this thread, though, could you tell us how difficult this would be? Might have a go myself, but it could be pretty slow progress as I've yet to touch the modding tools at all :S
     
    • Love Love x 2
  6. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Yeah he's pretty handy, especially in Go. He wrote and runs popular iphone-stuff website ipsw.me, and just graduated compsci, so if i ever need anything code-ey doing, I go to him :) (He did this because, and I quote, he was "bored and need something to write in Go")
     
    • Like Like x 1
  7. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    Luv it, lol!
    I'm only used to basic C and C++ Stuff with some Engineering stuff like light barriers, sensors, actuators etc. I love, and I hate coding... :cautious::roflmao:
     
    • Haha Haha x 1
  8. Andrew Scott

    Andrew Scott
    "Ye Old Convict" Premium

    Messages:
    1,567
    Ratings:
    +650
    This is just what is needed to take up the slack from vanilla track limits, kudos to you and CJ for getting this off the ground:thumbsup::thumbsup:
    If I can suggest, it maybe wise to put your feelers out on the official AC forums, which may garner some info about how to designate and utilize track limits and who is exceeding them in the app.
    Ultimately it would be awesome if this could be made to be live so the offending drivers name and the corner cut is splashed on screen for all to see. I realise it's probably asking a bit much at this stage, but something to keep in mind.
    If this works out as we all hope, I think it should be a compulsory mod, and required to race in RD's club and league races.
    If your a professional noob then Im a professor of nooboligy, I don't know :poop: about coding:whistling:
     
    • Love Love x 1
  9. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Thanks Andrew! I'm not sure if it could be made to work live, just because it reads from the JSON results files that AC puts out - the same one that simresults reads. If AC generates that on the fly, then it would probably work just fine, with a lot of fiddling. Something to ask him for in the future.

    And yeah, thanks for the tip, I'll go have a look on their forums and see if I can get any help. With a bit of luck there's an existing thread I can just follow :)
     
    • Love Love x 1
  10. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    AFAIK the PLP-App already does that.
    LINK to the official forum :)
    The JSON is indeed generated in more or less real time. When you start a server you can see the entries for it :cool:

    @Andrew Scott there are plenty of private leagues that are running this PLP app combined with minorating and sTracker. It changes the penalties to something reasonable and real, it keeps statistic of it all, you have a livemap etc etc. It's amazing :)

    Sadly, the Cut detection is just NOT USABLE and you can't do anything other than mod the track to finally get something GOOD :thumbsdown:
     
    • Like Like x 1
    • Sad Sad x 1
  11. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Ok, bit of a development!

    Further to the discussion of fixing the track limits on tracks (and the mention of Silverstone being particularly bad), I decided to do some hunting through files.

    assettocorsa\content\tracks\ks_silverstone\gp\data\surfaces.ini

    This file defines for each type of surface whether or not it is "valid track", or whether a cut will be detected if you drive over it. Setting IS_VALID_TRACK=0 for a surface means that the game will detect a cut if the specified number of wheels is on that surface. Obviously, if your wheels straddle a surface this isn't going to work, so you have to do it for every surface type that is outside of track limits.

    After a bit of fiddling and testing, I managed to do it. For Silverstone GP, the following materials need to be set to IS_VALID_TRACK=0:

    CONCRETE
    CARPET
    KURB
    OUT
    CONCOUU
    CURB
    KERB

    The rest can be left as is. Here's a link to my edited file if you want to test it: https://www.dropbox.com/s/5s8utn2420qv8rq/surfaces.ini?dl=0

    I can't see why this can't work for every track in the game to get more consistent track cut detection. However, editing the track files will, I suspect, make it incompatible with unedited versions (citation needed), so a new version of the track would probably need to be created and used by all players in a race. I did try doing this, but simply copying and renaming the track meant it would not launch - I'm sure I'm missing something so does anyone know how to do this?

    Obviously, this is still a modded track as a solution, but I think it could work well. Let me know if your testing is fruitful!

    -Joe

    Edit: IF YOU TRY THIS REMEMBER TO BACK UP YOUR ORIGINAL FILE SO YOU CAN EASILY REVERT IT BACK. OTHERWISE YOU'LL HAVE TO MANUALLY EDIT THE FILE TO GET IT BACK TO NORMAL.
     
    Last edited: Sep 4, 2017
    • Love Love x 2
  12. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    Will test it!
    Thanks again for doing what you do! :)
     
    • Like Like x 1
    • Love Love x 1
  13. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    As I we thought, it creates a mismatch error and you are getting kicked :(
    I will try your settings for some tracks though and see if it works. If it really does, it could be a total gamechanger!!! :)
     
    • Like Like x 1
  14. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Presume you're testing this online? Offline the tracks load just fine, as long as you apply it to the default track and don't try to make a copy (the copies never load for some reason).

    Testing on other tracks will require some fiddling, as they may have used different surface names and may have more surfaces. Don't try and use the same file for a different track, because each track has specific surfaces.

    I'd help you out with some testing but I'm supposed to be working :p (I'll get on it later)
     
    • Love Love x 1
  15. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    Yeah I didn't really "test" it. I just wanted to see if it creates a mismatch. And put it on a server without modifying my local files.
    The "clean way" would be to edit the surfaces.ini, put it into a new Layout and name it "RD_Club_Layout" or something like this. Then do a mod-pack, upload it here, credit you sir, of course! And problem solved :thumbsup::confused::geek:

    It's a long way to go but you found something AWESOME!
     
    • Love Love x 1
  16. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Yeah if you want to do that you're more than welcome! I never tried making a new layout rather than an entirely new track folder, so if you know how to do it properly then go for it, upload it and share it! Later on I can go through all the rest of the default tracks and try to produce similar files for those as well, then we could have RD versions of every track.
     
    • Love Love x 1
  17. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    In fact, if I do that, a new layout for each track could be made, bundled together in 1 download and shared as a single RD track resource. If you were actually interested in using this for RD club races this would be a shortcut for everyone.
     
    • Love Love x 1
  18. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    That's what I wanted to say, yes! :)
    Would be totally awesome. But I already stumbled upon a few great ideas and at some point there was something that broke it all... So I'm hyped, but at the same time I absolutely don't know if it will work haha
     
    • Love Love x 1
  19. Captain Condescending

    Captain Condescending
    Nerd, Petrol Head, Professional Noob Premium

    Messages:
    81
    Ratings:
    +61
    Yes of course, a lot more testing is required. As I said i'll give it a go later on, see what works what doesn't. I'll have to test every corner, inside and outside to see if it works everywhere. And of course, other tracks could be a different thing altogether!
     
    • Love Love x 3
  20. RasmusP

    RasmusP
    AC Stuff and G27 help Staff Premium

    Messages:
    2,087
    Ratings:
    +779
    Well in theory you only need to set the pitlane and the racing tarmac to "is valid=1". Most of the default tracks don't have more than 3 different tarmac colours.
    I'm testing Spa at the moment... You have these strange... violet, red etc. tarmacs but when you drive on the track, it's only ONE surface I think. Let's see :p:cautious:
     
    • Love Love x 1