LIHPC-Computational-Geometry / honeycomb

Combinatorial map implementation for meshing applications
https://lihpc-computational-geometry.github.io/honeycomb/
Apache License 2.0
7 stars 1 forks source link

Bug: inconsistent camera speed due to correlation with FPS #20

Closed imrn99 closed 4 months ago

imrn99 commented 6 months ago

Description

Information

Affected version or commit

First observed in dedee32, though the diagnostic was wrong.

Log

Observed behavior

When moving around the camera during rendering, the speed does not appear to be the same across different machines.

Expected behavior

The camera speed should be fixed / user-defined but independent from the execution platform.

Minimal reproducible example

Run the renderer using cargo's debug profile, then release:

# run this and move around using the arrow keys
cargo run --example render_squaremap
# re-iterate, the speed should be higher
cargo run --release --example render_squaremap

Source of the problem

Because the camera speed is used directly as a flat value, the perceived speed will be directly correlated to the FPS of the rendering, i.e. to the processing power of your hardware.

This is a common problem when coding game engine and other software that uses an event-based main loop structure. The solution would be ~to introduce a dt variable updated at each iteration of the loop; It can then be used to adjust the speed used for camera movement~ to put a hard cap on FPS, we're not running an engine here.

imrn99 commented 5 months ago

Renaming to better reflect the actual issue