Revenant tracers desync internal demos

From DoomWiki.org

In the vanilla Doom engine, homing projectiles fired by revenants will cause internal demos to desync.

Explanation[edit]

Whether or not a revenant missile will be homing is determined by the game on a frame-by-frame basis using the current gametic, which is a timer which begins at 0 as soon as the first call to TryRunTics is issued from the game's main loop, and increments by one for every tic run, including during static screens such as the title, intermissions between levels, and episode finales.

When recording a demo, the start of the level always coincides exactly with gametic 0. Normally, when playing back a demo via the -playdemo command-line parameter, the start of the level during playback will also coincide with gametic 0. This means that such demos containing revenants behave normally. However, when internal demos, ie., those played during the title screen demo loop such as the DEMO1 lump, are started, the gametic may be at any arbitrary value depending on how long the game has been running.

This discrepancy will cause the homing behavior of revenant fireballs to differ when played back as internal demos, as compared to the behavior they had during recording. This ensures that any internal demos containing revenants will virtually always desync as soon as they fire any projectiles.

Repair[edit]

This problem was recognized by the Doom community as early as 1996. It was first repaired by Lee Killough in the Boom source port by recoding the homing decision of revenant fireballs to depend on a new variable called basetic, which keeps pace with gametic but adjusts itself intelligently so that it behaves the same during both recording and playback. The special behavior of this variable allows demos to sync whether played back internally or externally, without disturbing the synchronization of demos recorded with the original executable. This approach has been adopted by virtually all advanced source ports.