omf2097 / openomf

One Must Fall 2097 Remake
http://www.openomf.org
MIT License
360 stars 35 forks source link

Stat calculation #395

Open katajakasa opened 3 years ago

katajakasa commented 3 years ago

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

turol commented 3 years ago

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.

katajakasa commented 3 years ago

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.