1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Aces AMS2 Multiclass Simhub Overlay

Discussion in 'Automobilista 2 - Modding' started by Ace, Apr 4, 2025.

  1. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    6
    Likes Received:
    1
    Hello,

    would it be possible to have Best lap in the leaderboard for every driver instead of last lap as that is also in the releative. would be nice to see who has the fastest pace possible durring a run. Also if your running fastest lap points its a quick refrence point.

    Other then that i am really enjoying this overlay.
     
  2. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    I wouldn't change for the whole dashboard, but I can easily show you how you can change that for yourself at the moment.

    Go to the overlays in Simhub and rightlick on the class leaderboard -> Edit Dashboard
    On the right side open ClassLeaderboard/ClassLeaderboard/TextLastLap.
    Edit the field "Text" by the green button, replace all coding to
    Code:
    return 'BEST LAP';
    Scroll down on the top right an open ClassLeaderboard/ClassLeaderboard/TopCars/TopCarss/Car/Car_LastLap. Again click on the green button at "Text":
    Replace all coding by this:
    Code:
    var indexMod = - 2;
    
    var playerPos = driverclassposition($prop("Position"));
    var classSize = $prop('PlayerClassOpponentsCount');
    if(classSize == playerPos) { indexMod -= 2 };
    if(classSize - 1 == playerPos) { indexMod -= 1 };
    
    carIndex = repeatindex();
    if(driverclassposition($prop('Position')) > 7 && repeatindex() >= 5) {
        carIndex = driverclassposition($prop('Position')) + indexMod + repeatindex() - 5;
    }
    
    var counter = 1;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop('CarClass')) {
            if(counter == carIndex) {
                var thisPos = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.Position');
                break;
            }
            counter++;
        }
    }
    thisLap = driverbestlap(thisPos)
    if(thisLap == '00:00:00') {
        return '';
    } else {
        var timeString = thisLap.toString();
        var parts = timeString.split(':');
        var minutes = parseInt(parts[1], 10);
        var secParts = parts[2].split('.');
        var seconds = parseInt(secParts[0], 10);
        var millis = (secParts[1] || '0').padEnd(3, '0').substring(0, 3); // genau 3 Stellen
        var formattedTime = (minutes > 0 ? minutes + ':' : '0:') +
                            seconds.toString().padStart(minutes > 0 ? 2 : 1, '0') + '.' + millis;
       
        return formattedTime;
    };
    Go to Object ClassLeaderboard/ClassLeaderboard/TopCars/TopCarss/Car/Car_LastLapColor right under it and click on the green button of "BackgroundColor", change coding to:
    Code:
    var indexMod = - 2;
    
    var playerPos = driverclassposition($prop("Position"));
    var classSize = $prop('PlayerClassOpponentsCount');
    if(classSize == playerPos) { indexMod -= 2 };
    if(classSize - 1 == playerPos) { indexMod -= 1 };
    
    carIndex = repeatindex();
    if(driverclassposition($prop('Position')) > 7 && repeatindex() >= 5) {
        carIndex = driverclassposition($prop('Position')) + indexMod + repeatindex() - 5;
    }
    var counter = 1;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop("CarClass")) {
            if(counter == carIndex) {
                var thisPos = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.Position');
                break;
            }
            counter++;
        }
    }
    thisLap = driverbestlap(thisPos)
    if(thisLap == '00:00:00') {
        return 'Transparent';
    }
    
    var bestLapOp = 999;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop("CarClass")) {
            bestThisLap = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.BestLap').toFixed(3);
            if(bestThisLap < bestLapOp && bestThisLap > 0) {
                bestLapOp = bestThisLap;
            }
        }
    }
    
    var lapTimeString = thisLap.toString().replace(',', '.');
    var parts = lapTimeString.split(':');
    var hours = parseInt(parts[0]);
    var minutes = parseInt(parts[1]);
    var seconds = parseFloat(parts[2]);
    var thisLap = hours * 3600 + minutes * 60 + seconds;
    if(thisLap == bestLapOp && bestLapOp > '0') {
        return '#B0921DFF';
    }
    
    return 'Transparent';
    Now the leaderboard should always show you the best Laps instead of Last Laps in races. But have in mind when the fastest lap in the not the 9 visible places on the leaderboard you will not see it.

    Maybe an optional window for the fastest lap of your class is a good idea for the future, what do you think?
     
    • Friendly Friendly x 1
  3. maitevel

    maitevel Member

    Joined:
    Dec 18, 2023
    Messages:
    31
    Likes Received:
    10
    Hi!
    Is there progress with penalties? That's what I've been waiting for since you announced your overlays. I know it's not easy. In any case, thank you for your overlays.
     
  4. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    I have a running testversion of it. I nailed down most of the logic (bascially if you have to measure how long a car needs for a lap and compare it to the last lap time after he crosses the finishline, the officiall last lap result will have penalties added), but it sadly still has some bugs so it counts penalties that are not there. It seems like things like pausing to the menu cause the issues, especially in multiplayer races it goes quite off.

    So I'm still working on getting it running correctly, currently a bit busy with other stuff, but I hope I can add it for v1.2
     
    • Like Like x 1
  5. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    A new version is here. It should hotfix issues like special letters still appearing broken and as they are ready I included two new overlays

    Input Circle
    [​IMG]
    Very simple display of Throttle and Brake input. It makes learning trailbraking and gentle throttle application way easier

    Air & Track Temperature Monitor
    [​IMG]
    As requested by users you can now display the Air and Track temperatures. Sadly there is no way to display weather informations or the current time of day of the session in simhub.

    I recommend updating to current Simhub version 9.8.4 for this update.

    What's next?
    As a tiny look into 1.2, I'm working on a MFD overlay that includes most of the functions (relatives, tires, electronics, etc), so you can see all important informations by cycling through the MFD instead of having everything shown at once. This will come with a fitting smaller telemetry monitor that doesn't rely on showing everything all the time. Of course these are additional overlays and not replacing existing overlays

    Getting time penalties finally working is still in progress too.

    The full patchnotes.
    v1.1.2
    New Overlay: Input Circle
    • Simple display of your throttle and brake input which works for every supported Simhub game
    New Track & Air Temperature Monitor
    • Simple display of Track and Air Temperature
    Fixes
    • Fixed: Special letters in names are still displayed broken
    • Fixed: Session timers above 1 hour are falsely formatted
    • Fixed: Input Monitor is updating too fast for Simhub Pro Users, making it hard to see your input graph through corners
    • Added Dodge and Jaguar Carmaker Icons for GT World Challenge mod
    • Removed JavaScript Legacy functions where they aren't necessary

    RELEASES
     
    Last edited: Jun 26, 2025
    • Like Like x 5
    • Friendly Friendly x 1
  6. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    This version is just a hotfix for displaying special letters in name. I change the routine how names are determined, so now this bug should finally be fixed.

    The hotflix only affects Class Leaderboard, Multiclass Leaderboard and Releatives, so you only have to update those if you already have 1.1.2 installed

    PATCHNOTES:
    • Fixed: Special letters in names are still displayed broken
    RELEASES
    Big thanks to User Molda222 at overtake helping to test this issue
     
    • Friendly Friendly x 1
  7. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    6
    Likes Received:
    1
    I need to get these updates! looks great thank you for your work!
     
    • Like Like x 1
  8. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    6
    Likes Received:
    1
    I must have a setting wrong or something, why is my lap count in the class leaderboard always short by 1?
     
  9. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    It shows completed laps, not the lap you're currently on. This is in line with bascially every other racing game besides AMS2 shows laps
     
  10. Hanzo_Voss

    Hanzo_Voss New Member

    Joined:
    Mar 25, 2025
    Messages:
    4
    Likes Received:
    0
    Its in line with ACC only. Every other game from iracing, LMU and AC1&evo to Need for speed and forza shows current lap/total laps. Same with TV broadcasts.

    Its not that hard to edit out "-1" in simhub and suggest everyone to do it. First time trying out overlay I thought I short fueled the car when it just showed completed laps. After that edited it out to remove confusion.

    Other then that, amazing overlay.
     
  11. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    54
    Likes Received:
    51
    Thank you for the input, I will check again how LMU and other sims handles this. Removing the -1 will interfere with the estimated Lap calculations. Here's how the coding should work fine without breaking the estimation, change ClassLeaderboard/TopBox/Lap/LapNo-Text Coding to:
    Code:
    var lapsDone = $prop('CurrentLap')-1;
    var currentLap = $prop("CurrentLap");
    var lastLapTime = $prop('LastLapTime');
    var lapTimeString = $prop('LastLapTime').toString();
    var parts = lapTimeString.split(':');
    var hours = parseInt(parts[0]);
    var minutes = parseInt(parts[1]);
    var seconds = parseFloat(parts[2]);
    var lastLapTimeInS = hours * 3600 + minutes * 60 + seconds;
    
    var timeSession = $prop('GameRawData.mSessionDuration');
    
    if (lastLapTimeInS > 0 && $prop('SessionTypeName') == 'RACE' && lapsDone >= 2) {
    if(lastLapCounter != lapsDone) {
    if (lastLapTimes.length >= 5) {
    lastLapTimes.shift();
    }
    lastLapTimes.push(lastLapTimeInS);
    lastLapCounter = lapsDone;
    }
    
    var avgLapTime = 0;
    if (lastLapTimes.length > 0) {
    avgLapTime = lastLapTimes.reduce((a, b) => a + b, 0) / lastLapTimes.length;
    }
    
    var estimatedLaps = 0;
    if (avgLapTime > 0) {
    estimatedLaps = (timeSession / avgLapTime) + parseFloat($prop('GameRawData.mSessionAdditionalLaps'));
    }
    return currentLap+"/~"+estimatedLaps.toFixed(1);
    } else {
    return currentLap;
    }
    I might change the display to currentlap instead of completed laps for 1.2 then
     
    • Like Like x 3
  12. ChasteWand

    ChasteWand Active Member

    Joined:
    Feb 9, 2021
    Messages:
    124
    Likes Received:
    88
    HeyAce, it's very helpful and that you are so open with information like this. I'm new to using simhub and java, but have experience of other languages. Keep up the good work!
     
    • Like Like x 1
  13. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    6
    Likes Received:
    1
    Made this change, thank you! I have always seen it as lap you are on not as laps completed lol
     
    • Agree Agree x 1
  14. GFoyle

    GFoyle Active Member AMS2 Club Member

    Joined:
    Mar 8, 2023
    Messages:
    685
    Likes Received:
    227
    Hi.

    These are really nice overlays but unfortunately required GarySwallowDataPlugin slows down the simhub overlays way too much for me to use it (it does it for other overlays too, even those that doesn't use it, I have to disable the whole plugin to prevent this). Maybe it would work better if I would allocate more resources for simhub, but I don't want to take those resources from the game.

    Not the first time I have experienced this problem when trying out a overlay that would require GarySwallowDataPlugin to be active (I never have any such issues if that pluging is disabled). It's really resource hungry and wouldn't be surpised if it would cause fps issues for the game too if it's active.

    btw. I noticed some errors from these overlays on the logs (1.1.3 version)

    ps. reinstall of simhub won't help
     

Share This Page