I've had a few close races, but this has to be the closest

I've had a few close races, but this has to be the closest

Postby tempAnon093 » 28 Aug 2019, 06:54

Image

I used Kiki's slipstream to try and overtake her at the end, I can't tell if I won or not...
I have no idea why this was able to happen. I would have assumed the same measurement is used for the ranking and the finish time. Maybe finish time truncates and ranking rounds? (I would try debugging this for fun but I'm just too busy tonight. I can try debugging and patching tomorrow)
tempAnon093
 
Posts: 113
Joined: 02 Feb 2019, 12:09

Re: I've had a few close races, but this has to be the close

Postby Andet » 28 Aug 2019, 18:25

Nice lol. On a maybe similar note, the two-digit time at the end of time trials often differs from the three-digit time saved by the ghost replay and put on the high score list, so maybe the two-digit time you see is just an approximation based on the individual lap times? Idk
User avatar
Andet
 
Posts: 43
Joined: 08 Dec 2018, 01:40

Re: I've had a few close races, but this has to be the close

Postby theodorepringle » 29 Aug 2019, 09:13

This occurs because the time shown in the end screen is actually slightly inaccurate; the difference compared to the actual time is usually less than one frame (1/120th of a second) but it's especially noticeable in Oliver's Math Class, because it's the shortest official track and finishing it in a particular way results in the time shown being almost five frames faster than the actual time. I don't know the reason for the discrepancy, but interestingly in Egg Hunt the final time shown always seems to be accurate so hopefully it will be possible to fix in regular play. I might upload a video demonstrating the problem.
theodorepringle
 
Posts: 4
Joined: 29 Aug 2019, 00:32

Re: I've had a few close races, but this has to be the close

Postby tempAnon093 » 29 Aug 2019, 12:07

Andet {l Wrote}:Nice lol. On a maybe similar note, the two-digit time at the end of time trials often differs from the three-digit time saved by the ghost replay and put on the high score list, so maybe the two-digit time you see is just an approximation based on the individual lap times? Idk

Good to know! When you say they the two times differ, do you mean rounding the high score number to two-digits, like '01:33:00.127' rounding to '01:33:00.13', or something else unexpected?

(edit: I started writing this before I saw theodorepringle's reply)

I did some digging around and it's not as simple as I naively suspected. The times are rounded correctly when converted to text and the kart positions are a bit too complex for me to tackle right now. My most reasonable guess is that the game didn't update my position before finishing.
I can't see any relevant warnings or errors in my stdout logs so I don't think both karts were given the same rank or anything. <-- I think that will only be recorded if DEBUG is enabled!

note to self: finish time for the pictured race was "88.9548" == 1:28:9548 so it has rounded correctly. I appear to be getting ~100 FPS according to the game counter which means 0.01 seconds between frames. Given our shown finish times, it's quite likely we finished in the same frame. Are FPS and ticks related? Some comments (linear_world.cpp, lines 167 and 448) suggests they might be...
if so then a game this close may theoretically see us both cross the line in the same update. updateRacePositions() is called whenever a kart finishes a lap, but before the kart is declared finished. If m_overall_distance is updated after this function, it could be possible that they game still thinks Kiki has traveled further than me, neither of us has won yet and so therefore she is in 1st place. Then one/both of us are declared finished (and can no longer change position) and the finish time is calculated through interpolation, where mine is in front by <.01s but Kiki's interpolated time almost certainly rounds to .96 while mine rounded down, so I end up .95 and she ends up .96
I am making some big assumptions here but it seems plausible with a <.01s difference finish. A sanity check from a dev would be appreciated!
Last edited by tempAnon093 on 29 Aug 2019, 13:25, edited 1 time in total.
tempAnon093
 
Posts: 113
Joined: 02 Feb 2019, 12:09

Re: I've had a few close races, but this has to be the close

Postby Andet » 29 Aug 2019, 13:25

Yeah it's something beyond just rounding the final result, since it's often off by more than simple rounding would account for (especially on Oliver's Math Class like Theodore said). Maybe it rounds every individual lap time and just adds them together or something.
User avatar
Andet
 
Posts: 43
Joined: 08 Dec 2018, 01:40

Re: I've had a few close races, but this has to be the close

Postby tempAnon093 » 29 Aug 2019, 13:49

Yeah, I agree that it's probably to do with laps. That would explain theodorepringle's last posts saying Egg Hunt works fine. Egg Hunt has no laps and so I assume the end time would be calculated differently. A video would be useful, yes! If we report the issue, then the devs can see it happening in the video and know what to look for.
tempAnon093
 
Posts: 113
Joined: 02 Feb 2019, 12:09

Re: I've had a few close races, but this has to be the close

Postby theodorepringle » 30 Aug 2019, 03:36

Here is a video demonstration: https://www.youtube.com/watch?v=MMbPQWepM8k
theodorepringle
 
Posts: 4
Joined: 29 Aug 2019, 00:32

Re: I've had a few close races, but this has to be the close

Postby Alayan » 30 Aug 2019, 11:04

See this issue : https://github.com/supertuxkart/stk-code/issues/3272

if so then a game this close may theoretically see us both cross the line in the same update. updateRacePositions() is called whenever a kart finishes a lap, but before the kart is declared finished. If m_overall_distance is updated after this function, it could be possible that they game still thinks Kiki has traveled further than me, neither of us has won yet and so therefore she is in 1st place. Then one/both of us are declared finished (and can no longer change position) and the finish time is calculated through interpolation, where mine is in front by <.01s but Kiki's interpolated time almost certainly rounds to .96 while mine rounded down, so I end up .95 and she ends up .96


Sounds possible, I may have a look to see if this hypothesis holds ; it should not be too hard to fix this (unlike the issue linked above).
Alayan
STK Moderator
 
Posts: 206
Joined: 25 Mar 2012, 22:11

Re: I've had a few close races, but this has to be the close

Postby tempAnon093 » 31 Aug 2019, 02:59

Alayan {l Wrote}:See this issue : https://github.com/supertuxkart/stk-code/issues/3272
[snip]
Sounds possible, I may have a look to see if this hypothesis holds ; it should not be too hard to fix this (unlike the issue linked above).

It may be possible although I think it's more likely to be the issue above. I made the assumption that the finish times were correct.
tempAnon093
 
Posts: 113
Joined: 02 Feb 2019, 12:09

Re: I've had a few close races, but this has to be the close

Postby Andet » 31 Aug 2019, 12:45

Another thing to note: Fouks says he thinks it happens when you hit the checkline at the end, which makes sense since the discrepency generally occurs when you're on the side, and finish line checklines are on the sides.
User avatar
Andet
 
Posts: 43
Joined: 08 Dec 2018, 01:40

Who is online

Users browsing this forum: No registered users and 1 guest