Skip to content

Calculating game time

Darren edited this page May 2, 2024 · 2 revisions

This is a placeholder for documentation relating to how to calculate game time.

Definitions

Replay Time vs. Game Time

There are two distinct time measurements within a replay: replay time and game time. Replay time progresses regardless of whether the game is paused, while game time starts at negative values and reaches 0:00 at the horn.

CDOTAGamerulesProxy

This is an entity within the replay data structure that holds properties relevant to game rules and timing, such as m_fGameTime and m_flGameStartTime.

CDOTA_Unit_Hero

Another type of entity within the replay data structure, containing properties related to hero units, such as mana (m_flMana) and max mana (m_flMaxMana).

Challenges

Listing down these challenges so that research onto the calculations can be built on top of each other.

Server clock inaccuracies affecting Game Time calculation

Game time is calculated based on ticks, with an assumption of 30 ticks per second. However, there may be variations due to server clock inaccuracy, leading to discrepancies in the conversion between seconds and ticks.

Pre-game activities before Game Time

Determining the initial game time accurately poses a challenge, as it may vary between replays and can be affected by factors such as pre-game activities and server synchronization.

Pauses

The replay also records actions even while the game is paused. This means that there needs to be a way to normalize (i.e. remove pause time) to ensure game time is calculated properly.

References