<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://manicpop.org/gewiki/index.php?action=history&amp;feed=atom&amp;title=Game_timing</id>
	<title>Game timing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://manicpop.org/gewiki/index.php?action=history&amp;feed=atom&amp;title=Game_timing"/>
	<link rel="alternate" type="text/html" href="https://manicpop.org/gewiki/index.php?title=Game_timing&amp;action=history"/>
	<updated>2026-10-20T17:14:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://manicpop.org/gewiki/index.php?title=Game_timing&amp;diff=2021&amp;oldid=prev</id>
		<title>CodexBot: Link host midnight cleanup separately from recurring game timers</title>
		<link rel="alternate" type="text/html" href="https://manicpop.org/gewiki/index.php?title=Game_timing&amp;diff=2021&amp;oldid=prev"/>
		<updated>2026-10-17T04:35:10Z</updated>

		<summary type="html">&lt;p&gt;Link host midnight cleanup separately from recurring game timers&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Galactic Empire does not have one universal game tick.&amp;#039;&amp;#039;&amp;#039; Movement, ship systems, automated-ship decisions, and planet production run on separate schedules. A command may take effect immediately, but the visible result of movement, a recharge, a projectile hit, or a countdown depends on which scheduled routine handles it. This page expands the recurring-callback branch of [[Game execution flow]].&lt;br /&gt;
&lt;br /&gt;
== The main schedules ==&lt;br /&gt;
&amp;lt;code&amp;gt;GEMAIN.C&amp;lt;/code&amp;gt; registers these callbacks with MajorBBS &amp;lt;code&amp;gt;rtkick()&amp;lt;/code&amp;gt;. In the 16-bit builds, the 5.x callback names and the &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;-prefixed 6.x PHARLAP names are both forwarding wrappers for shared implementation routines (for example, &amp;lt;code&amp;gt;plarti()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pplarti()&amp;lt;/code&amp;gt; call &amp;lt;code&amp;gt;plartia()&amp;lt;/code&amp;gt;). The 32-bit &amp;lt;code&amp;gt;plarti()&amp;lt;/code&amp;gt;, [[Source code#routine-autorti|&amp;lt;code&amp;gt;autorti()&amp;lt;/code&amp;gt;]], and [[Source code#routine-warrti|&amp;lt;code&amp;gt;warrti()&amp;lt;/code&amp;gt;]] contain their implementations directly. The table names the 16-bit entry points and implementations. Each implementation schedules its next invocation rather than running continuously.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Scheduled callback !! Interval !! Implementation and principal calls&lt;br /&gt;
|-&lt;br /&gt;
| [[Source code#routine-warrti2|&amp;lt;code&amp;gt;warrti2()&amp;lt;/code&amp;gt;]] / &amp;lt;code&amp;gt;pwarrti2()&amp;lt;/code&amp;gt; || 1 second || &amp;lt;code&amp;gt;warrti2a()&amp;lt;/code&amp;gt; calls &amp;lt;code&amp;gt;rotateship()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;accel()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;moveship()&amp;lt;/code&amp;gt; for one third of the live ship slots. ge-next adds &amp;lt;code&amp;gt;tick_entrymsg()&amp;lt;/code&amp;gt; for delayed entry notices; ge-arena also advances match timers through &amp;lt;code&amp;gt;arena_tick()&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;autorti()&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;pautorti()&amp;lt;/code&amp;gt; || 1 second || &amp;lt;code&amp;gt;autortia()&amp;lt;/code&amp;gt; visits automated ships. It calls each eligible class&amp;#039;s configured &amp;lt;code&amp;gt;tick_func&amp;lt;/code&amp;gt; when that ship&amp;#039;s delay expires, and considers one vacant NPC slot for its configured &amp;lt;code&amp;gt;init_func&amp;lt;/code&amp;gt; every 30 scheduler ticks.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;warrti()&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;pwarrti()&amp;lt;/code&amp;gt; || 6 seconds || &amp;lt;code&amp;gt;warrtia()&amp;lt;/code&amp;gt; calls &amp;lt;code&amp;gt;checkmines()&amp;lt;/code&amp;gt;, then visits every active ship for repair, shields, cloaking, recharge, ordnance, ion fire, and damage checks. Classic also calls &amp;lt;code&amp;gt;fluxstat()&amp;lt;/code&amp;gt; here; ge-next adds &amp;lt;code&amp;gt;validate_lock()&amp;lt;/code&amp;gt; and skips defensive-state and recharge work once ship damage reaches 100.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;warrti3()&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;pwarrti3()&amp;lt;/code&amp;gt; || First call after 60 seconds; then every 120 seconds || &amp;lt;code&amp;gt;warrti3a()&amp;lt;/code&amp;gt; sends the neutral-zone warning through &amp;lt;code&amp;gt;outsect()&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;plarti()&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;pplarti()&amp;lt;/code&amp;gt; || Classic starts after its startup-calculated &amp;lt;code&amp;gt;plantime&amp;lt;/code&amp;gt;; ge-next first calls it after 10 seconds on 5.x or 30 seconds on 6.x. Subsequent intervals vary. || &amp;lt;code&amp;gt;plartia()&amp;lt;/code&amp;gt; searches planet records, updates neutral-zone stock and eligible ordinary planets, calls &amp;lt;code&amp;gt;multiply()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;check_spy()&amp;lt;/code&amp;gt; as appropriate, and recalibrates &amp;lt;code&amp;gt;plantime&amp;lt;/code&amp;gt; after a pass. Classic updates Zygor and Tahanian Station inline; ge-next calls &amp;lt;code&amp;gt;update_plan_1()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update_plan_2()&amp;lt;/code&amp;gt; and adds &amp;lt;code&amp;gt;update_plan_3()&amp;lt;/code&amp;gt; for the Enforcer Planet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The diagram below follows three of these scheduled paths into their principal calls. An asterisk marks a ge-next-specific call path or guard; it does not always mean the routine itself is absent from classic GE.&lt;br /&gt;
&lt;br /&gt;
[[File:GE callback timing shared GE.png|center|alt=Branches from automatic-ship, ship-system, and planetary timing callbacks to their significant gameplay calls]]&lt;br /&gt;
&lt;br /&gt;
These are scheduled intervals, not a guarantee that every message appears at an exact wall-clock instant. A busy BBS can delay a callback, and a condition may not be noticed until the next relevant pass. The two one-second callbacks are independent: NPC decisions and ship movement are not the same pass.&lt;br /&gt;
&lt;br /&gt;
== Movement and ship state ==&lt;br /&gt;
The movement callback runs once a second but processes only [[Ship slot|ship slots]] in one of three groups. A ship&amp;#039;s internal slot number determines its group: slots 0, 3, 6, and so on are in group 0; slots 1, 4, 7, and so on are in group 1; and slots 2, 5, 8, and so on are in group 2. In other words, the group is the slot number modulo three, not a property of the ship class or its speed. The callback cycles through the groups in order, so a ship receives a movement update roughly every three seconds. On that update the game rotates it toward its ordered heading, changes its speed, and moves it. Ships in different groups need not move at the same instant; their positions and headings change in steps rather than continuously between updates.&lt;br /&gt;
&lt;br /&gt;
As an illustration, twelve successive movement callbacks visit slot groups &amp;lt;code&amp;gt;0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2&amp;lt;/code&amp;gt;. During roughly that span, the separate ship-state callback runs twice and checks all active ships on each pass. The two schedules are not synchronized to one another, so this is an illustration of frequency, not a promise about their exact ordering at second 6 or 12.&lt;br /&gt;
&lt;br /&gt;
The separate six-second callback first advances mine timers, then makes one pass over all active ships, regardless of movement group. For each ship it checks maintenance state and target locks, updates shields and cloaking, recharges the energy pool, advances incoming torpedoes and missiles, ages decoys and weapon reload counters, processes ion fire, and checks damage and repairs. The pass can destroy a ship whose damage has crossed the destruction threshold. A ship can therefore move twice between two system passes. A player may also issue commands between callbacks: a command can change the ship&amp;#039;s intended course immediately, while its actual position or heading changes on its next movement turn.&lt;br /&gt;
&lt;br /&gt;
== Weapons and other short timers ==&lt;br /&gt;
Incoming torpedoes and missiles are advanced and checked during the six-second ship-state pass, not on every one-second movement callback. Mine timers also decrement in that pass; mine proximity work occurs every fifth such tick, with detonation on the timer&amp;#039;s zero pass. Decoys and several weapon reload counters are likewise handled there. For example, a reload counter of one normally means the next six-second system pass, not precisely one second after firing.&lt;br /&gt;
&lt;br /&gt;
Combat restrictions use the same distinction. The &amp;lt;code&amp;gt;cantexit&amp;lt;/code&amp;gt; counter is decremented during the six-second ordnance check, so its duration is measured in system passes. In GE, a full &amp;lt;code&amp;gt;FIRETICKS&amp;lt;/code&amp;gt; value of 10 corresponds to roughly 60 seconds, but further hostile activity can refresh it and some events set a shorter delay. ge-arena uses a value of four, roughly 24 seconds. The time actually remaining depends on where the ship is in the current six-second cycle and whether another event changes the counter. See [[Exit command]] and [[Maintenance command]] for what the restriction affects.&lt;br /&gt;
&lt;br /&gt;
== Automated ships ==&lt;br /&gt;
The automated-ship scheduler runs every second and visits live NPC slots, but visiting a slot does not mean the ship makes a new decision every second. Each NPC has its own &amp;lt;code&amp;gt;tick&amp;lt;/code&amp;gt; counter: the scheduler decrements a positive value and calls that ship class&amp;#039;s behavior routine when it reaches zero. The behavior routine can choose a different delay for the next decision, and combat or pursuit can shorten that delay. The scheduler also considers one vacant non-user ship slot for NPC creation after every 30 of its one-second ticks; this is an opportunity to create a ship, not a promise that one appears every 30 seconds. Movement still follows the same three-group schedule used for player ships, while shields, damage, and ordnance still use the six-second ship-state pass. This is why an NPC&amp;#039;s movement cadence and its decision cadence should not be treated as the same thing. A sysop Cybertron pause suppresses the active behavior pass, including countdowns, but the scheduler can still consider vacant slots for NPC creation. In ge-arena, the ordinary NPC scheduler does no work outside active regulation play; Base mode&amp;#039;s initial staging spawns are handled by the separate arena clock.&lt;br /&gt;
&lt;br /&gt;
== Planetary updates ==&lt;br /&gt;
Planet production is not tied to the six-second ship callback. A separate routine steps through eligible planet records, using a variable interval. The administrator&amp;#039;s &amp;lt;code&amp;gt;PLANUPD&amp;lt;/code&amp;gt; setting specifies how many passes through the eligible planets the game aims to complete in a day; the default is four. GE recalibrates the interval as passes complete. ge-next also stores per-planet timestamps and accounts for missed updates after downtime. A larger database can require more frequent callbacks, and not every callback necessarily finds a planet to update. For the traversal, pass schedule, timestamps, and catch-up, see [[Planetary update cycle]]. The calculations within one production pass are at [[Planetary production]].&lt;br /&gt;
&lt;br /&gt;
== Other callbacks and ordering ==&lt;br /&gt;
GE runs a separate neutral-zone beacon callback about every 120 seconds. Its timing is independent of the three-second per-ship movement cadence and the six-second ship-state pass. The [[Game execution flow#Midnight routine|midnight routine]] is different again: MajorBBS calls it during host cleanup, not through &amp;lt;code&amp;gt;rtkick()&amp;lt;/code&amp;gt;, and it does not perform a planetary production pass.&lt;br /&gt;
&lt;br /&gt;
Ordering between callbacks matters. Movement may happen before or after an ordnance update, and a ship can cross the destruction threshold before the pass that removes it. A later effective hit in that interval can change the last attacker. Maintenance, locks, shield state, and delayed messages are likewise observed when their own callback runs. Ports should preserve these schedules rather than collapse the mechanics into one timer. The 5.x and 6.x 16-bit builds use different MajorBBS callback signatures, but thin wrappers call the same gameplay routines.&lt;br /&gt;
&lt;br /&gt;
== ge-arena clocks ==&lt;br /&gt;
In ge-arena, the one-second callback also advances the arena state machine. The automatic lobby start timer and initial staging each last 60 seconds; combat then runs for 15 minutes. Respawn selection lasts 10 seconds. A tiebreaker, when needed, has a 10-second staging countdown and a two-minute combat limit. These are separate from ship movement and system recharge: the match clock can advance on a second when a particular ship has not yet moved. See [[ge-arena]] for match rules.&lt;br /&gt;
&lt;br /&gt;
== Centocks and displayed time ==&lt;br /&gt;
Older GE documentation uses [[Centock|centock]] as an approximate short interval, often described as about five seconds. It is not a single timer that drives every part of the game. When converting a delay into seconds, identify the counter and the callback that changes it; five NPC scheduler counts, one movement turn, and one ship-state tick are different things.&lt;br /&gt;
&lt;br /&gt;
Countdowns and messages describe elapsed play in human terms, while effects are observed at callback boundaries. If a system is due to recharge on the next six-second pass, it may appear almost immediately or nearly six seconds later depending on when the preceding action occurred. This ordinary phase difference is distinct from a timer being configured incorrectly.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Game execution flow]]&lt;br /&gt;
* [[Centock]]&lt;br /&gt;
* [[Planetary update cycle]] and [[Planetary production]]&lt;br /&gt;
&lt;br /&gt;
{{GE navigation}}&lt;br /&gt;
[[Category:Game reference]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>CodexBot</name></author>
	</entry>
</feed>