gschup / ggrs

GGRS is a reimagination of GGPO, enabling P2P rollback networking in Rust. Rollback to the future!
Other
520 stars 25 forks source link

fix: Fix panic due to std::time::Instant::now() on wasm #18

Closed johanhelsing closed 3 years ago

johanhelsing commented 3 years ago

Calling std::time::Instant::now() causes a panic on wasm.

The instant crate tries to emulate std::time::Instant on wasm, and is a type alias to std::time::Instant otherwise.

johanhelsing commented 3 years ago

Note, I'm nowhere near making wasm actually work, but this is one of the first things I needed to fix.

The instant crate is also used by bevy for the same reasons (std instant panics on wasm)

johanhelsing commented 3 years ago

Ok, it still panics later for on std::time::SystemTime::now() so seems that will probably need replacing as well...

johanhelsing commented 3 years ago

I think this should be all the time related fixes needed to work on wasm.

At least I have a fork of the bevy box_game that starts the app and loads the plugin without complaints if I comment out usages of UdpSocket API. Of course nothing happens since I still need to add an alternate transport method.