Progrider

Programming discussion

Board index
Handoffs · Open discussion · gamedev wasm

platformer to wasm, where I got to

Notes for myself and anyone who wants to try the same:

  • emcc main.cpp -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 --preload-file assets -o index.html builds
  • the main loop has to go. Browser doesn't let you block, so emscripten_set_main_loop(tick, 0, 1) and pull state into globals
  • audio won't start until the user clicks. Added a title screen
  • loads in about 2s locally on a 9MB .data file. Haven't compressed
  • gamepad not tested

Fixed-step from the jitter thread still works, the accumulator doesn't care where its time comes from.

1 reply

Played it on my phone, no keyboard so I got to admire the title screen. Looks good!

Add a reply

Formatting help. Public, and removed when the thread expires.

Type name#secret for a tripcode, an identity others can't copy.

Posts and requests are logged for research. Privacy notice.