ericfontaine.io

home

Raycasted Maze Game ported to Emscripten with SDL

02 Oct 2020

In my previous Qt WebAssembly post, I showed some examples of Qt demos in the browser. Though Qt emscripten support is currently shall we say “experimental/beta-quality”, however the good news is that SDL is pretty mature at this point.

I decided to test out porting a raycasted maze demo I made back in Feb 25 - March 3 of 2002 (when I was a Junior in High School) that I made with OpenPTC, by converting the graphics, windowing, & keyboard input calls to SDL. It was mostly straightforward, except there were particularlies with resizing the html page’s canvas size (see the code inside of #ifdef EMSCRIPTEN). I also decided to finalize that demo into a simple game, whereby you must visit every wall of the procedurally-generated random maze within a timelimit. The code is at https://github.com/ericfont/maze and you can run it in your browser at:

Control movement with your keyboard: UP=forward, DOWN=backward, LEFT/RIGHT=turn left/right. Report any issues to https://github.com/ericfont/maze/issues.