openarena

Game physics is the way in which the laws of nature are simulated in a computer game. This article focuses on the problems with simulating gravity in a way that is fair for all OpenArena players and independent of their personal hardware and game settings.

The different ways this may work are frame rate dependent, fixed frame rate and accurate physics. You can select one of them when creating a custom match (multiplayer or skirmish) from the menu, or using console commands according to the info you find in this page.

At standard 800 gravity, jump height/length with "accurate" physics is slightly shorter than with "fixed 125 Hz" physics, and longer than with "fixed 90 Hz" physics.

Note: if you are searching the variables to manually control in-game gravity, speed and knockback, see Special game options#Game physics instead. If you are searching info about "Vanilla" and "CPM" physics, see the dedicated section later in this page.

Hint: if the server is using "fixed" or "accurate" physics, each client's com_maxfps value does not influence player's jumps anymore... anyway it continues to control the number of frames-per-second rendered on their screens, and clients should continue to set it to a value their machine can handle constantly (e.g. setting it to 0 -no limit- is a bad idea).

To map creators: it is strongly advisable to test the maps you create, to be sure they are playable (e.g. all platforms are reachable) with "Accurate" physics and with "Fixed 90 Hz" and with "Fixed 125 Hz" physics.
You should make maps playable with all three these settings. Examples: jump-pads and accelerator pads pushing may require some tweak to do not send the player off-target; some obstacles should or should not be taller than "x" units; some jumps (gaps) may require to be a little shorter; etc. Also consider that "accurate physics" (used by default since OA 0.8.5) is not supported by many old mods designed for Q3A.

Frame rate dependent physics

Frame rate dependent physics is the original way of simulating gravity the OpenArena game engine inherited from its Quake III ancestor. The game server calculates a players position with the PMove() function and it transmits the resulting coordinates to the players game clients represented as integer numbers. If a player's coordinates have fractional parts ('decimals behind the dot'), the fractional parts have to be rounded to make them into integer numbers. This makes the moment at which the PMove() function does the rounding have an effect on the result of the rounding: if the rounding is done early the result is rounded down, if the rounding is done late the result is rounded up. Normally the rounding errors will cancel each other out over time because the acceleration is not constant. However there is one notable exception: Gravity. Because gravity is constant, rounding errors accumulate over time. The rounding error is related with gravity and fps: with standard 800 gravity, at 125 FPS you can jump a bit higher than at 90 FPS; with 600 gravity, instead, at 125 FPS you can jump a bit lower than at 90 FPS. As you can guess, higher jumps can be longer than lower jumps.

Because in frame rate dependent physics the PMove() function is called whenever a client renders a frame, a player can influence the effect of the rounding by tweaking his client's com_maxfps setting (reminder: its default value is 85, which results in 90 FPS).
The com_busywait variable is set to 0 by default, and this should help to save CPU load (assuming that your system can handle the desired com_maxfps framerate), but may make framerate a little more unstable; if you have problems performing some jumps, especially with framerate-dependent physics (and you have the right com_maxfps value), you may try to set com_busywait 1.

Advantages

Drawbacks

Configuration

The server can be configured to frame rate dependent physics by setting both pmove_float and pmove_fixed to 0.

Fixed frame rate physics

Fixed frame rate physics solves the unfairness frame rate dependent physics by calling the PMove() function at the same, fixed time interval for all players, independent of their com_maxfps. This way all players get the same rounding error and thus all can jump the same height. The rounding error is related with gravity and FPS: with standard 800 gravity, at 125 FPS you can jump a bit higher than at 90 FPS; with 600 gravity, instead, at 125 FPS you can jump a bit lower than at 90 FPS.

Advantages

Drawbacks

Configuration

The server can be configured to fixed frame rate physics by setting pmove_float to 0, pmove_fixed to 1 and pmove_msec to the desired time interval in milliseconds. The interval is calculated by dividing 1000 by the FPS to be emulated, or the other way around:

pmove_msec FPS
1 1000 / 1 = 1000
2 1000 / 2 = 500
3 1000 / 3 = 333
4 1000 / 4 = 250
5 1000 / 5 = 200
6 1000 / 6 = 166
7 1000 / 7 = 142
8 1000 / 8 = 125
9 1000 / 9 = 111
10 1000 / 10 = 100
11 1000 / 11 = 90
12 1000 / 12 = 83
13 1000 / 13 = 76
14 1000 / 14 = 71
15 1000 / 15 = 66
16 1000 / 16 = 62
17 1000 / 17 = 58
...
32 1000 / 32 = 31
33 1000 / 33 = 30
34 1000 / 34 = 29

Notes:

Accurate physics

Accurate physics solves the problems with fair gravity simulation by rather than ussing an integer number representation of the players positional data, it uses floating point numbers instead. Floating point numbers can hold fractional values, making it no longer necessary to do rounding of the players coordinates. It has been introduced with OpenArena 0.8.5. At standard 800 gravity, with "accurate" physics, jumps are slightly lower/shorter than "fixed 125 Hz" physics, and higher/longer than "fixed 90 Hz" physics.

Advantages

Drawbacks

Configuration

The server can be configured to accurate physics by setting pmove_float to 1. Furthermore, it's strongly advisable to also set pmove_fixed to 0, as enabling it at the same time would not affect jump height, but would still cause the drawbacks from "fixed" physics.

Note: the server administrator can influence the jump height by tweaking the g_gravity value and setting up a custom map rotation script, with the g_gravity value set after the map command (because the game engine sets g_gravity to the value specified by the map designer). See g_gravity for some infos about how to integrate this in a map rotation script. Please notice that situations that cause a map restart (e.g. voting for a "shuffle" of the teams during team-based games) and do not trigger the map rotation script (e.g. manual map changes), will cause the gravity change back to map default until the new match ends and the map rotation script continues to the next map.

Starting with OpenArena 0.8.8, a g_gravitymodifier cvar has been introduced to solve the problem of having to set g_gravity for each map anew. This variable keeps the value you set for it until you set it to a different one, it's not automatically reset. "G_gravitymodifier 1" means "no change", while 1.2 means higher gravity (e.g. 800*1.2=960) and 0.8 means lower gravity (e.g. 800*0.8=640). If you manually change g_gravity, too, g_gravitymodifier will multiply that value instead of the default map gravity.

Experimentation with the g_gravity tweak led to values between 756 and 768 as being optimal for simulating 125 fps fixed framerate physics at 800 gravity, when using accurate physics instead.
This leads to values of 756 / 800 = 0.945, 757 / 800 = 0.94625 or 768 / 800 = 0.9475 for g_gravityModifier.
Note: the result will be the one expected (playing maps designed for 125 fps physics as they were meant, but using accurate physics) only if the original map gravity was 800 (most maps), and if you only tweak g_gravity or g_gravitymodifier; well, you could change both of them, but the result would change.

Default values and menu option

Since OpenArena 0.8.5, default values of the server-side variables are:

Changes to their values are immediately effective.
Tip: you can pull down the console, write pmove and press the TAB key to see your current values for all three of them at once, quickly determining the game physics type you are using.

It is also possible to select the game physics from the menu, when setting up a new skirmish or multiplayer match using the GUI. The "Game server" menu allows to cycle between the following "Physics" values: Accurate, Framerate dependent, Fixed framerate 125 Hz, Fixed framerate 91 Hz. Accurate is the default option.

Notes:

Mods

Pmove_float (accurate physics) is OpenArena specific and not supported by most old mods designed for Q3A (which would just ignore its value). Pmove_fixed (fixed framerate physics) is supported by most mods, and framerate-dependent physics is probably supported by any mod[1].

Vanilla and CPM physics

One may find references to "Vanilla" (or "VanillaOA" or "VanillaQ3", thus also "VOA" or "VQ3") physics, opposed to "CPM" (or "CPMA" or "ProMode") physics. The first consists of classic physics and control responses that you can usually find in the standard game. The second consists of modified physics and control responses, to allow even more hardcore tricks, like more mid-air control; it comes from the Challenge ProMode Arena mod for Quake 3, and some more mods, like DeFRaG, implemented similarly modified physics (even if not from the same source code). At the moment, only Vanilla physics is available without the need of using mods. Note: differences between Vanilla and CPM physics are a different thing than the various kinds of rounding-error calculations explained in this page; CPM physics is a real (and intentional) gameplay modification provided by some mods.

Notes

  1. Unless mod authors decided to completely disable it for some fairness reasons.

See also