Although the game evolves without player intervention, there is an internal ``clock'' that determines when events take place and ensures the correct ordering of events. COMMAND durations, movement speeds, etc. are all defined in terms of ticks of this GLOBAL CLOCK signal. Every time a new event is created, it is added to a global schedule, along with a note specifying when the event will take place. Every time the global clock ticks, the game engine checks to see if any events are scheduled at that time unit and carries out those events.
For example, suppose that the current schedule is as follows:
| EVENT | Produce( |
Move( |
Attack( |
Spawn( |
| SCHED TIME | 1138 | 1141 | 1149 | 1160 |
and that the current GLOBAL TIME is 1137. On the next clock
tick, the GLOBAL TIME becomes 1138 and the event
Produce, applied to UNIT
and cell
, takes
place and is removed from the schedule. After Produceing,
UNIT
is re-scheduled to Produce again at time step
1158 (
is a forest cell and produces wood; see
Section
). Now the schedule appears as follows:
| EVENT | Move( |
Attack( |
Produce( |
Spawn( |
| SCHED TIME | 1141 | 1149 | 1158 | 1160 |
On time steps 1139 and 1140 nothing happens. On
time step 1141, the Move event takes place and is
removed from the schedule. This scheduling and action loop continues
until the game ends (Section
).
If an event is encountered whose conditions no longer apply (e.g., a
Produce event is scheduled for UNIT
, but
no
longer exists when the event is encountered), the event MUST be
silently dropped. However, care must be taken to de-schedule
any events for a UNIT whose COMMAND is changed. For example, suppose that
UNIT
is scheduled to execute a Build command at
GLOBAL TIME 27893, but at GLOBAL TIME 27695, the
player changes
's COMMAND to Move. The
Build COMMAND MUST be de-scheduled before the Move
command is scheduled to ensure that
does not execute two
mutually exclusive COMMANDs.
The GLOBAL CLOCK is maintained on the server to ensure that all clients schedule events according to the same time base.
Terran Lane 2005-11-10