7 ms·
I recently ported an early-2000s 2D game to WebAssembly and old Asyncify was too clunky and the Emterpreter was too slow to be useful. To get things working com
by SpaceManiac 7y ago
I recently ported an early-2000s 2D game to WebAssembly and old Asyncify was too clunky and the Emterpreter was too slow to be useful. To get things working comfortably I ended up porting the game loops to use Clang's support for the C++ coroutines TS, with a simple scheduler that yields control back to the browser after every screen flip. I will have to see if this new Asyncify can do any better.
- aidanhs 7y ago> To get things working comfortably I ended up porting the game loops to use Clang's support for the C++ coroutines TS, with a simple scheduler that yields control back to the browser after every screen flip. Oh nice, is this code (or a write-up) available anywhere? A couple of years ago I was working on porting Wesnoth and got it working...except it was too slow with the Emterpreter. I'll try this new asyncify, but your approach sounds like an interesting backup if I were to resurrect my efforts.
- SpaceManiac 7y agoI've been meaning to write a proper blog post for a while, but in the meantime here is a gist with notes[1] and the code in context[2]. [1] https://gist.github.com/SpaceManiac/79a507858fbe3946a0c40e99b9a6838c https://gist.github.com/SpaceManiac/79a507858fbe3946a0c40e99... [2] https://github.com/SpaceManiac/HamSandwich/blob/emscripten/source/ham/coro.cpp https://github.com/SpaceManiac/HamSandwich/blob/emscripten/s...