
Next I found an interesting example program showcasing palette swapping–encoding a bitmap as indices into an arbitrary set of colors, which can be swapped out at runtime. I wasted a few hours here because of an unfortunate difference between bash and zsh. My first PRs were to Allegro to improve this documentation.
#Zelda tab browser music how to#
Luckily they provided some instructions on how to build with Emscripten. Learning CMake, Allegro, and EmscriptenĪllegro claims to support Emscripten, but I wanted to confirm it for myself. So that's the first hurdle–Zelda Classic needs to be ported to Allegro 5, and its CMakeLists.txt needs to be modified to build allegro from source.Īllegro 5 is able to support building with Emscripten because it can use SDL as its backend, which Emscripten supports well.īefore working on any of that directly, I needed to address my lack of knowledge of CMake and Allegro. The two versions are vastly different but fortunately there is an adapter library called Allegro Legacy which allows an Allegro 4 application to be built using Allegro 5. Allegro 4 does not readily compile with Emscripten, but Allegro 5 does. Well, it actually uses Allegro 4, released circa 2007. Zelda Classic is written in C++ and uses Allegro, a low-level cross platform library for window management, drawing to the screen, playing sounds, etc. Even with no optimization pass, I often ran into cases where some frames of the call stacktrace were obviously wrong, so I sometimes had to resort to printf-style debugging. You may need to drop any optimization for best results. If you are developing a Wasm application, the Chrome DevTools DWARF extension is essential. For the most part, if a C/C++ program is portable, it can be built with Emscripten and run in a browser, although you'll like have to make changes to accommodate the browser main loop. Because many C/C++ projects are built with Make and CMake, Emscripten also provides tooling for interoping with those tools: emmake and emcmake.
#Zelda tab browser music code#
It's not enough to just compile code to Wasm–Emscripten also provides Unix runtime capabilities by implementing them with JavaScript/Web APIs (ex: implementations for most syscalls an in-memory or IndexedDB-backed filesystem pthreads support via Web Workers). The very TL DR of how it works is that it uses clang to transform the resultant LLVM bytecode to Wasm. Getting it working EmscriptenĮmscripten is a compiler toolchain for building C/C++ to WebAssembly. and it definitely helped me write this article. This was the first time I kept notes like this, and I found the process improved my working memory significantly. If you're interested in the minutia, I've made my daily notes available. The rest of this article is an overview of the technical process of porting Zelda Classic to the web. Along the way, I discovered bugs across multiple projects and did due diligence in fixing (or just reporting) them when I could, and even proposed a change to the HTML spec. It's been challenging work, far outside my comfort zone of web development, and I've learned a lot about WebAssembly, CMake and multithreading. I hope my efforts result in Zelda Classic reaching a larger audience.

There's a lot of quests to choose from, but here's just a small sampling! Click any of these to jump into the quest: I spent the last two months (roughly ~150 hours) porting Zelda Classic to run in a web browser. However, the most recent version of Zelda Classic only supports Windows. The engine today supports scripting, and many have used that to push it to the limits: it's almost impossible to believe that some quests implemented character classes, online networking, or achievements in an engine meant to create the original Zelda. Some are 20+ hour games with expansive overworlds and engaging, unique dungeons.

If you are a fan of the original 2D Zelda games, I believe you'll find many Zelda Classic quests to be well worth your time. Fair warning, some are just awful, so be discerning and use the rating to guide you. They range in complexity, quality and length. Many are spiritual successors to the original, perhaps with improved graphics, but very recognizable as a Zelda game. The engine grew to support far more features than what was necessary to create the original game, and today there are over 600 custom games - the community calls them quests. Zelda Classic is a 20+ year old game engine originally made to recreate and modify the original Legend of Zelda.
