tomjackman / rre-spec

TV/esports Broadcasting Overlay for RRE
The Unlicense
2 stars 1 forks source link

Fix for autodirector #189

Closed NikolaiVChr closed 9 months ago

NikolaiVChr commented 3 years ago

In races without a lot of close driving the autodirector would sometimes overly focus on position #4.

This code:

var secondsPassed = ((UI.state.sessionInfo.timeTotal/3600)*60)-UI.state.sessionInfo.timeLeft
if (secondsPassed < 20 && driver.scoreInfo.positionOverall === 4) {
    score += 30;
}

Is the reason. As you have realized other places like usage of UI.formatSessionTime = function(seconds) { both UI.state.sessionInfo.timeTotal and UI.state.sessionInfo.timeLeft is in seconds. So that strange conversion of timeTotal above into minutes and the subtracting timeLeft which is in seconds, does not make sense and can with a little unluck make the director focus on position #4.

I have seen the bug, and so did a long commented stream of daytona the other day on Youtube.

So this pull request should fix that. Hope you accept it.

Thank you for a nice tool.

Regards Leto Turdania

NikolaiVChr commented 3 years ago

AH, yes maybe it should be 4. Unless there is less than 4 racers in the race I guess. But thats not the main issue, the main issue is the calculation of secondsPassed.