openomf icon indicating copy to clipboard operation
openomf copied to clipboard

Stat calculation

Open katajakasa opened this issue 3 years ago • 2 comments

This issue is for tracking stat calculation for HARs

Note that in original game, values are generally multiplied by 256 to get integer value, since game handles stuff in ints instead of floats. In OpenOMF, we use floats by default.

Unknown variable

har->unknown_1 = (har->stun_resistance * 0.2 * 0.9) * (pilot->endurance * 0.025)

Movement speeds

All HAR speeds are modified by agility. Upwards speed is also multiplied by config value "jump height".

up_speed = up_speed * pilot->agility * config->jump_height down_speed = down_speed * pilot->agility x_speed = x_speed * pilot->agility

Vertical speed modifier

har->vertical_speed_modifier = pilot->agility * 0.02222222

Used when calculating CX tag effect

Horizontal speed modifier

har->horizontal_speed_modifier = pilot->agility * 0.03333333

Used when calculating CY tag effect

Health

pilot->health = (pilot->vitality * health) / 100

katajakasa avatar Aug 11 '21 20:08 katajakasa

Making floating point work deterministically across platforms is tricky, see https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/

We want the simulation to be deterministic for easier multiplayer so it would be best to not use floating point in simulation code.

turol avatar Aug 16 '21 10:08 turol

This is known. However, openomf has used floats since the start, and someone would need to do the work to convert to something else. Currently we just trust that the floats are close enough and let the network code do any additional syncing.

katajakasa avatar Aug 16 '21 14:08 katajakasa