Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stat calculation #395

Open
katajakasa opened this issue Aug 11, 2021 · 2 comments
Open

Stat calculation #395

katajakasa opened this issue Aug 11, 2021 · 2 comments

Comments

@katajakasa
Copy link
Member

katajakasa commented Aug 11, 2021

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
Copy link

turol commented Aug 16, 2021

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants