comfy icon indicating copy to clipboard operation
comfy copied to clipboard

FPS for Wasm32 build is unbounded

Open cedeerwe opened this issue 9 months ago • 1 comments

Hi!

I have a game developed against comfy v0.3.1. When running cargo run, the FPS numbers show ~60. When I run it using trunk serve, my FPS numbers are ~1000. This is a problem, as it actually slows down the game by a bunch.

I have noticed this line of code in the main game loop:

#[cfg(not(target_arch = "wasm32"))]
loop_helper.loop_sleep();

For some reason the engine isn't sleeping for wasm32.

Finally, I wasn't able to reproduce this for comfy v0.4, as trunk build fails on some unrelated issue, with errors such as these:

error[E0599]: no method named `set_inner_size` found for mutable reference `&mut comfy_core::Window` in the current scope
   --> /Users/cd/.cargo/registry/src/index.crates.io-6f17d22bba15001f/comfy-0.4.0/src/game_loop.rs:95:16
    |
95  |         window.set_inner_size(PhysicalSize::new(

However, the code for comfy v0.4 seems very similar with regards to the sleep behaviour.

Am I missing something with regards to the Wasm32 FPS?

cedeerwe avatar May 20 '24 06:05 cedeerwe