Difference between revisions of "Tic"

From DoomWiki.org

[unchecked revision][checked revision]
m (fmt)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{gendisambigabout|the timing unit in the [[Doom engine]]|the mid 90s mapping team responsible for [[Memento Mori]] and [[Obituary]] whose name is abbreviated as TiC|The Innocent Crew}}
 
A '''tic''' is either a ''realtic'' or a ''gametic''.
 
A '''tic''' is either a ''realtic'' or a ''gametic''.
  
Line 6: Line 7:
  
 
Each gametic corresponds to a ''ticcmd_t'' structure. These structures represent the state of the input devices (keyboard, mouse and joystick) at a given time, and are used to update the game state. This mechanism provides a good deal of flexibility, because the ticcmd_ts can be passed over the network for multiplayer games, and to/from disk files for recording and playing [[demo]]s.
 
Each gametic corresponds to a ''ticcmd_t'' structure. These structures represent the state of the input devices (keyboard, mouse and joystick) at a given time, and are used to update the game state. This mechanism provides a good deal of flexibility, because the ticcmd_ts can be passed over the network for multiplayer games, and to/from disk files for recording and playing [[demo]]s.
 +
 +
The term tic is short for "tick", as in "one tick of the clock".
  
 
In the [[Doom source code]], the ticcmd_t is defined as follows:
 
In the [[Doom source code]], the ticcmd_t is defined as follows:
Line 23: Line 26:
 
  } ticcmd_t;
 
  } ticcmd_t;
  
The function <tt>G_BuildTiccmd</tt> in <tt>g_game.c</tt> fills a ticcmd_t structure based on the keyboard, mouse and joystick states. It uses the state of the "run" control and the "strafe on" controls to properly interpret the other controls.
+
The function <tt>G_BuildTiccmd</tt> in <tt>g_game.c</tt> fills a ticcmd_t structure based on the keyboard, mouse and joystick states. It uses the state of the "run" control and the "[[strafe]] on" controls to properly interpret the other controls.
  
 
* '''forwardmove''' and '''sidemove''' record the signed net total of the various forward/backward and right/left controls (each total limited to no more than 50 and no less than -50).
 
* '''forwardmove''' and '''sidemove''' record the signed net total of the various forward/backward and right/left controls (each total limited to no more than 50 and no less than -50).
* '''angleturn''' records the signed net total of turning motion controls.
+
* '''angleturn''' records the net total [[angle]] of turning motion controls.
* '''consistancy''' (spelled incorrectly, but as in the source code) is normally the player's x-position, and is used to confirm that network games are in sync.
+
* '''consistancy''' (sic) is normally the player's x-position, and is used to confirm that network games are in sync.
 
* '''chatchar''' can be a character to be added to the interplayer message area on the [[heads-up display]].
 
* '''chatchar''' can be a character to be added to the interplayer message area on the [[heads-up display]].
 
* '''buttons''' encodes the following actions: attack, use, change weapon (including new weapon number), pause, and save game (including savegame slot number).
 
* '''buttons''' encodes the following actions: attack, use, change weapon (including new weapon number), pause, and save game (including savegame slot number).
 +
 +
==Doom 64==
 +
In [[Doom 64]] a realtic is 1/30th of a second, or roughly 33.333 milliseconds.
 +
 +
==PSX Doom==
 +
In the PlayStation versions of Doom and Final Doom, a realtic is 1/15th of a second, or roughly 66.667 milliseconds.
  
 
==See also==
 
==See also==

Latest revision as of 02:04, 9 December 2022

This article is about the timing unit in the Doom engine. For the mid 90s mapping team responsible for Memento Mori and Obituary whose name is abbreviated as TiC, see The Innocent Crew.

A tic is either a realtic or a gametic.

A realtic is 1/35 of a second (roughly 28.571 milliseconds), as measured by the system real-time (wall-clock) timer, and is the designed frame rate for the game.

A gametic is one game state update, which ideally can be completed in one realtic with time left over. However, sometimes (particularly in multiplayer games subject to network delays) gametics take longer, and the game will slow down.

Each gametic corresponds to a ticcmd_t structure. These structures represent the state of the input devices (keyboard, mouse and joystick) at a given time, and are used to update the game state. This mechanism provides a good deal of flexibility, because the ticcmd_ts can be passed over the network for multiplayer games, and to/from disk files for recording and playing demos.

The term tic is short for "tick", as in "one tick of the clock".

In the Doom source code, the ticcmd_t is defined as follows:

// The data sampled per tick (single player)
// and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
typedef struct
{
     char forwardmove;   // *2048 for move
     char sidemove;      // *2048 for move
     short angleturn;    // <<16 for angle delta
     short consistancy;  // checks for net game
     byte chatchar;
     byte buttons;
} ticcmd_t;

The function G_BuildTiccmd in g_game.c fills a ticcmd_t structure based on the keyboard, mouse and joystick states. It uses the state of the "run" control and the "strafe on" controls to properly interpret the other controls.

  • forwardmove and sidemove record the signed net total of the various forward/backward and right/left controls (each total limited to no more than 50 and no less than -50).
  • angleturn records the net total angle of turning motion controls.
  • consistancy (sic) is normally the player's x-position, and is used to confirm that network games are in sync.
  • chatchar can be a character to be added to the interplayer message area on the heads-up display.
  • buttons encodes the following actions: attack, use, change weapon (including new weapon number), pause, and save game (including savegame slot number).

Doom 64[edit]

In Doom 64 a realtic is 1/30th of a second, or roughly 33.333 milliseconds.

PSX Doom[edit]

In the PlayStation versions of Doom and Final Doom, a realtic is 1/15th of a second, or roughly 66.667 milliseconds.

See also[edit]