Time: Difference between revisions
Add table of contents. |
m Fix TOC. |
||
| Line 1: | Line 1: | ||
<code><nowiki>__TOC__</nowiki></code> | |||
== Introduction == | == Introduction == | ||
Revision as of 01:21, 12 July 2026
__TOC__
Introduction
Timing is crucial to OpenBOR, as it is with most game engines. Understanding how the engine measures time, and how those measurements affect a project, is therefore essential. OpenBOR’s primary unit of time is the centisecond, or one hundredth of a second. Animation delays, for example, are expressed in centiseconds. Other units may be used depending on the feature, circumstance, or design requirement.
Time in OpenBOR is represented by the following primary definitions:
Game Time – The traditional beat ’em up countdown timer that forces players to maintain pace or lose a life when time expires. Game Time is enabled by default, though creators may disable or remove it.
Elapsed Time – An integer value reset at the beginning of each active level and incremented during every engine update while the level remains active. Elapsed Time drives much of the engine’s internal timing, including animations, delays, effect duration, and other game-play processes.
Ticks – The number of milliseconds elapsed since the current game session began. Tick values are primarily used for timing operations outside active game-play, including loading processes and recorded player input.
System Time - OpenBOR script includes an API to access the host system clock for obtaining real-world dates and times. System clock access is entirely optional and does not affect native engine timing or game-play functionality.

Game Time
Game time is a default countdown timer that appears at top center of the screen during an active level. It starts at 99 and decrements once every two real world seconds. At 0, all active players take damage equal to their current HP, and the game is over if no lives or credits remain. Time resets automatically when players clear a designated level wait and at the start of each new level.
Timer text is hard-coded to font 3 (font4.png - remember loaded fonts are 0 indexed). Swap this font to change the text appearance.

Level Header
settime {int 99}
Level header command that sets starting time from 0 - 99. Populate with 0 for infinite time.
notime {int 0}
If 1, the timer remains active, but does not display on screen.
Levels.txt
timeloc {x} {y} {w} {h} {border disable}
Levels.txt command that positions the timer on screen.
- {x 149} - Horizontal position.
- {y 4} - Vertical position.
- {w 21} - Width of border around time text.
- {h 20} - Height of border around time text.
- {border disable 0} - 1 disables border.
timeicon {path} {x} {y}
Adds a static image one layer step behind the timer. Meant as a timer icon, but may be used independently to place a static image anywhere on screen.
- {path none} - Path to the image file for icon.
- {x 0} - Horizontal offset from top left of screen.
- {y 0} - Vertical offset from top left of screen.
Other
data/scripts/timetick.c
If available, fires on each decrement of the game timer. Populates the following local variables.
- time (int) - Current timer value.
data/sounds/timeover.wav
If available, plays once when the game timer expires.
anim lose
If available, entity plays this animation in place of normal death when game timer expires.
- Accessible to script as
openborconstant("ANI_LOSE").
anim falllose
If available and entity does not have a lose animation, entity plays this animation in place of normal fall death when game timer expires.
- Accessible to script as
openborconstant("ANI_FALLLOSE").
Attack types
Attack types applied to players when game time expires.
- openborconstant("ATK_TIMEOVER") - Applied to players without a lose animation.
- openborconstant("ATK_LOSE") - Applied to players with a lose animation.
Script API
Game Time
Current game time is read and write accessible.
openborvariant("game_time")- Integer representing game time remaining.
Timetick.c
if available, data/scripts/timetick.c fires on each game time decrement. Populates the following local variables.
time- Current game time value.