4 ms·
Actually in my experience running physics (Box2D) is relatively harmless since it's purely in WASM and doesn't need to interact with any JS API directly. By fa
by samiv 2y ago
Actually in my experience running physics (Box2D) is relatively harmless since it's purely in WASM and doesn't need to interact with any JS API directly.
By far the biggest headache for me is actually Lua. It has terrible perf natively also but in WASM it's complete dog shit. I suspect there might be some bad allocation patterns or something that make it perform very poorly. I haven't had time to investigate that yet to my satisfaction.
Your game runs quite smoothly, didn't get the logic but it didn't jank much. :)
- fidotron 2y ago> Actually in my experience running physics (Box2D) is relatively harmless since it's purely in WASM and doesn't need to interact with any JS API directly. I see! In my case the actual scene graph is in JS too, and I've seen enough people struggle with both approaches to wonder which one really comes out ahead in the end. > Your game runs quite smoothly, didn't get the logic but it didn't jank much. :) Good! These assets here are not remotely optimal, but the core loop going on is not too bad given the complexity of what it can through around before having problems. The whole separate worker thing introduces inevitable continuous timing problems, but I've seen too many webgl games where they run perfectly smoothly for a bit, then stutter like hell, and repeat. It's got to be GC gunk.
- samiv 2y agoHere's an example of running Box2D physics in WASM https://ensisoft.com/demos/playground/game.html https://ensisoft.com/demos/playground/game.html Still very small scenes of course so not much stuff going on. Yes, the GC pauses are a known issue in Lua.