summaryrefslogtreecommitdiff
path: root/doc/devel/timing
blob: 99aa62ec87f399c479a8684d11ac135d7951ff6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
1. Timing and Changes
---------------------
The current UQM timer runs on a 120 ticks/second clock, defined by the
constant ONE_SECOND (in timelib.h). Theoretically, all code has been
updated to use this constant where needed, so the timer precision can
be increased to 1000, for example, to match the native SDL timer
resolution.

The following functions and all variables and constants used with them
have been examined and patched where necessary.

Functions that have something to do with time:
	XFormColorMap
	XFormPLUT
	CycleColorMap
	FadeMusic
	SeedRandomNumbers
	WaitForNoInput
	GetTimeCounter
	SleepThread
	SleepThreadUntil

Global vars:
	GameClock

Constants changed:
	BATTLE_FRAME_RATE (element.h)
	NUM_DELAYS (clock.c)
	ACCELERATION_INCREMENT (gameinp.c)
	IP_FRAME_RATE (solarsys.c)

Constants added:
	CLOCK_BASE_FRAMERATE (clock.c)
	STEP_ACCEL_DELAY (pstarmap.c)
	PLANET_SIDE_RATE (lander.c)

All alien comm animation definitions (frame rates) were patched to take
ONE_SECOND into account. So if some animations start to bug all of a
sudden, you know where to look ;).

The game-clock function SetGameClockRate() changed to use the rate
defined by CLOCK_BASE_FRAMERATE and does not use ONE_SECOND now (and is
not supposed to).


2. Possible Rate Changes
------------------------
The PLANET_SIDE_RATE and IP_FRAME_RATE can be safely adjusted at this
time. The BATTLE_FRAME_RATE needs more work.


3. Battle rate
--------------
The BATTLE_FRAME_RATE constant (currently 24 fps) can be adjusted only
after converting the rate counters for all ships used in melee. They
are expressed in frames and *must* take BATTLE_FRAME_RATE into account.

They are:
	ENERGY_WAIT
	TURN_WAIT
	THRUST_WAIT
	WEAPON_WAIT
	SPECIAL_WAIT

There is probably more that needs to be done to make it work properly
with an altered BATTLE_FRAME_RATE. Expect more info to appear.