1

**Stunts Code Extraction / Replay recording and limits**

« **on:**May 02, 2018, 10:19:12 PM »

Posts collected from the ZakStunts shoutbox in May 2018, for easier reading.

Afullo

About the time limitations, I'm trying with MS1.1 and I can go past the 10 minutes replay limit (with the correct displaying of the truncation message):

Note that the replay starts at 0:30.00 and ends at 10:20.30, so the older recording is progressively discarded. Now I'm going to proceed through the 25 minutes limitation, and to see what will happen...

Afullo

I just hit the 25 minutes limit, and the game simply returns the replay screen, like pressing ESC; trying to continue driving from the menu, which is still an active option (written in white and not in blue, differently from "save replay" which becomes inactive after 10 minutes), will result in the replay screen disappearing for a fraction of second, and then reappearing still stucked at 25:00.00... Maybe it has something to do with possible overflow errors: you can theoretically complete a track with a time higher than 25 minutes if you collect proper penalties, but I remember at least once to have seen a minus sign in the total time (elapsed+penalty), which was with all chance caused by a low number of bits for the integers involved...

Afullo

Indeed, in this example (units are 0.05):

I skipped 898 tiles, so I was charged with a penalty of 2694 seconds, or 53880 units. Modulo 2^16 = 65536 this equals -11656 units, or -582,8 seconds, or -9:42.80. This is consistent with the limit: 25 minutes are 1500 seconds, or 30000 units; 16-bit signed integers range from -32768 to 32767, so it would be possible to reach safely 27.18:35, I guess 25.00:00 is simply the nearest "sufficiently rounded" lower number.

Afullo

Just a minor remark: with the terminology used in Stunts Wiki: Penalty_time , I skipped *896* tiles, it is the chain to be 898 elements long.

By leaving the track on tile 1 (I count them from 1, don't knowing whether there is an internal counting starting from 0), i.e. very close to the start/finish line, I rejoined it on tile 898, i.e. the one in position (3,30) on the grid; so the tiles from 2 to 897 were skipped, tile 898 is the re-entry element, and tile 899 is the element coming immediately after it, closing the penalty chain. Note that intersecting another nearby tile, e.g. tile 58 which is one step east to the s/f line, does not result in the chain interrupting, since (by quoting directly from the wiki) if, after performing a penalty-inducing shortcut, one returns to the track and then leaves it immediately, without closing the penalty chain, penalty will be calculated as if all elements between the first leaving of the track and the final re-entry had been skipped, even those crossed upon the temporary rejoining of the track.

Cas

This is very interesting. I think it would deserve a good forum thread so it can be accessed easily. I hadn't sat to think about when the 32767 cycle limit would be exceeded. I think I never drove that long. What calls my attention is that the "last minutes" are kept instead of the first. We know Stunts records the key presses, not the physical status, so the only way to conciliate these two facts would be that Stunts uses an inverse function when going backwards, but this seems to contradict the fact that you can immediately warp to the beginning of the replay. Maybe this is only the case when it's not truncated, or maybe Stunts does memorise the replay initial conditions. Then if the replay could be saved, we'd see an additional field in it, but the key presses are clearly saved right after the track data in memory.

Afullo

About the time limitations, I'm trying with MS1.1 and I can go past the 10 minutes replay limit (with the correct displaying of the truncation message):

Note that the replay starts at 0:30.00 and ends at 10:20.30, so the older recording is progressively discarded. Now I'm going to proceed through the 25 minutes limitation, and to see what will happen...

Afullo

I just hit the 25 minutes limit, and the game simply returns the replay screen, like pressing ESC; trying to continue driving from the menu, which is still an active option (written in white and not in blue, differently from "save replay" which becomes inactive after 10 minutes), will result in the replay screen disappearing for a fraction of second, and then reappearing still stucked at 25:00.00... Maybe it has something to do with possible overflow errors: you can theoretically complete a track with a time higher than 25 minutes if you collect proper penalties, but I remember at least once to have seen a minus sign in the total time (elapsed+penalty), which was with all chance caused by a low number of bits for the integers involved...

Afullo

Indeed, in this example (units are 0.05):

I skipped 898 tiles, so I was charged with a penalty of 2694 seconds, or 53880 units. Modulo 2^16 = 65536 this equals -11656 units, or -582,8 seconds, or -9:42.80. This is consistent with the limit: 25 minutes are 1500 seconds, or 30000 units; 16-bit signed integers range from -32768 to 32767, so it would be possible to reach safely 27.18:35, I guess 25.00:00 is simply the nearest "sufficiently rounded" lower number.

Afullo

Just a minor remark: with the terminology used in Stunts Wiki: Penalty_time , I skipped *896* tiles, it is the chain to be 898 elements long.

By leaving the track on tile 1 (I count them from 1, don't knowing whether there is an internal counting starting from 0), i.e. very close to the start/finish line, I rejoined it on tile 898, i.e. the one in position (3,30) on the grid; so the tiles from 2 to 897 were skipped, tile 898 is the re-entry element, and tile 899 is the element coming immediately after it, closing the penalty chain. Note that intersecting another nearby tile, e.g. tile 58 which is one step east to the s/f line, does not result in the chain interrupting, since (by quoting directly from the wiki) if, after performing a penalty-inducing shortcut, one returns to the track and then leaves it immediately, without closing the penalty chain, penalty will be calculated as if all elements between the first leaving of the track and the final re-entry had been skipped, even those crossed upon the temporary rejoining of the track.

Cas

This is very interesting. I think it would deserve a good forum thread so it can be accessed easily. I hadn't sat to think about when the 32767 cycle limit would be exceeded. I think I never drove that long. What calls my attention is that the "last minutes" are kept instead of the first. We know Stunts records the key presses, not the physical status, so the only way to conciliate these two facts would be that Stunts uses an inverse function when going backwards, but this seems to contradict the fact that you can immediately warp to the beginning of the replay. Maybe this is only the case when it's not truncated, or maybe Stunts does memorise the replay initial conditions. Then if the replay could be saved, we'd see an additional field in it, but the key presses are clearly saved right after the track data in memory.