This projects clones the viral Flappy Bird game using WebAssembly and WebGL. It is written in Magelang.
To compile this game, you must first install the Magelang compiler.
-
Before installing Magelang, make sure you have the following tools installed:
-
Installing magelang compiler
# At the time of writing this project, Magelang has not been officially released.
# The game was compiled using Magelang with this commit ID: 7b1804beb4d9443a6346c2518652b738e2b90dcb.
# Use this commit ID to install Magelang to ensure version compatibility.
cargo install \
--git https://github.com/jauhararifin/magelang.git \
--rev 7b1804beb4d9443a6346c2518652b738e2b90dcb \
magelang
# Verify the installation
magelang --version
- Run the build script
# Clone the flappybird repository
git clone https://github.com/jauhararifin/flappybird.git
cd flappybird
# Execute the build script:
bash ./build.sh
After running this script, you should see a ./build directory in your current working directory, containing all the files required to run the game.
- Serve the build directory using an HTTP server. You can use the
http-server
package from NPM for this purpose.
npx http-server ./build -p 8800
- Open your browser and navigate to http://localhost:8800.
To run the tests, you'll need to install a WebAssembly runtime called wasmtime. You can follow the installation step on their website. Wasmtime serves as a WebAssembly runtime, similar to JVM for Java and Node.js for JavaScript. There are other alternatives such as WasmEdge, Wasmer, Wasm3, and NodeJs' own WebAssembly runtime. This project uses wasmtime for its ease of installation and use.
Ensure that you've also installed the Magelang compiler as described in the Compiling section.
To execute the tests, simply run bash ./test.sh
.