Ported my C game to WASM, here's everybug that I hit
10 hours ago
- #Emscripten
- #Game Development
- #WASM
- The author details the main issues encountered while porting a C game to WebAssembly via Emscripten.
- Had to use Visual Studio for 32-bit debugging since WASM is 32-bit and their regular debugger didn't support 32-bit processes.
- Pointer size differences between 64-bit and WASM caused struct layout problems; fixed by removing pointers from serialized structs.
- Debugging in 32-bit native builds improved productivity by allowing the use of breakpoints and memory watch.
- A bug was found where a pointer size mix-up allocated incorrect memory on 32-bit, hidden on 64-bit.
- OpenGL ES (WebGL) was stricter than Direct3D, requiring fixes for vertex layouts, component mismatches, and Y-flipping.
- Shaders needed recompiling for GLSL ES, including function replacements and strict type handling.
- Web Audio autoplay policies and an Emscripten export issue (missing HEAPF32) required specific flags to resolve.