How to calculate IGT using the frame counter
Guides
/
How to calculate IGT using the frame counter
Updated 7 months ago by Smathlax

This guide is for moderator use only, however any runner may also use this to cross-reference the moderator's calculations.

This guide applies to:

  • Prince of Persia: The Fallen King
  • Prince of Persia: The Forgotten Sands (DS)
  • Battles of Prince of Persia

In the event that the in-game time cannot be determined via the LiveSplit plugin (e.g. because LiveSplit crashed during the run), this can be calculated manually using the frame counter, as shown in the top-left corner here:

The frame counter shows how many frames have elapsed since the ROM has been opened. Therefore, the in-game time can be calculated by the following formula: (endingFrame - startingFrame) / framerate.

startingFrame and endingFrame are obtained by reading from the frame counter, while the framerate is a constant value of exactly 59.82609828808082. (This value corresponds to the framerate of a native Nintendo DS console, which is what is being emulated here. This is not the framerate of the submission video.)

Note: The starting and ending frames for IGT timing are not the same as the starting and ending frames for RTA timing, although they are very close. Starting and ending frames for RTA are defined in the rules, while starting and ending frames for IGT are defined by the LiveSplit script. If the LiveSplit script isn't used, then the IGT starting and ending frames should be obtained by observing another run which did use the LiveSplit script.

Example 1:

  • Frame counter at run start shows 503.
  • Frame counter at run end shows 14396.

Then the in-game time calculation is as follows:

= (14396 - 503) / 59.82609828808082

= 13893 / 59.82609828808082

= 232.223 seconds

= 3 minutes 52 seconds 223 milliseconds

However, if the emulator is closed at any point during the run then the calculation becomes more complicated. In-game time is not counted while the emulator is closed, and when the emulator reopens the frame counter goes back to 0 again. Therefore if the emulator is closed, the in-game time has to be calculated individually for each continuous segment of the emulator being open, and then all values should be added together at the end.

Example 2:

  • Frame counter at run start shows 497.
  • The emulator is closed when the frame counter shows 12391.
  • When the emulator is reopened, the frame counter shows 0 again.
  • The emulator is closed again when the frame counter shows 7204.
  • When the emulator is reopened, the frame counter shows 0 again.
  • Frame counter at run end shows 2901.

Then the in-game time calculation is as follows:

= [(12391 - 497) + 7204 + 2901] / 59.82609828808082

= [11894 + 7204 + 2901] / 59.82609828808082

= 21999 / 59.82609828808082

= 367.715 seconds

= 6 minutes 7 seconds 715 milliseconds

Game stats
Followers
9
Runs
14
Players
2
Latest news
There's now a TAS of this game!

@GMP has made a Tool-Assisted Speedrun of this game!

You can find all the details in this thread:

3 years ago
Latest threads
Posted 3 years ago
0 replies
Posted 5 years ago
0 replies
Moderators