I spent most of December on vacation, so no big post. However, I did learn about Emscripten, a C++ compiler that produces an executable in WebAssembly. I tried it out and have to say, it was remarkably easy to get something up and running.
I made a very simple crossword game. You you can try it out here.
Best on desktop. While it does load in the browser, it is looking for key events, which is really cumbersome on mobile.
This was written with SDL2 and Dear ImGUI.
Compilation is pretty straightforwad. Instead of running gcc <srcs> <libs> you run emcc <srcs> <libs>. The compiler does some magic to reinterpret use of OpenGL with WebGL, and spits out a .wasm binary blob, a .js script that can execute it, and a .html page that runs it all. My game link above is simply to that .html page.
To test it locally without uploading it to a web page, you can simply start a Python server in your dev directory:
python -m http.server
and then open your .html file in the browser:
http://localhost:8000/your_thing.html
I spend a lot of time tinkering with games and other programs in C++, but I’m developing on a Linux machine. As a result, I can’t really share my games with my friends. Emscripten might be a nice way to achieve that.
Happy 2025 everyone. Hope its a good one.
