Why convert LOBSTER to WASM?
Compiling to .wasm lets a Lobster game or graphical app run in the browser at near-native speed. Since Lobster's engine already supports WebAssembly, the Emscripten toolchain packages your compiled program and its assets into web-ready files.
How to convert LOBSTER to WASM
Lobster --cpp then Emscripten make OPEN-SOURCE
First run lobster --cpp my.lobster (the wasm build has no JIT), put your assets in dev/emscripten/assets, then in dev/emscripten run make -j8 to produce lobster.wasm, lobster.js, lobster.html, and lobster.data.
Run with emrun OPEN-SOURCE
Launch the built page with emrun --browser chrome lobster.html --verbose to test the WebAssembly build in a browser.
Emscripten toolchain FREE
Install and activate Emscripten (plus GNU make) beforehand, since the wasm build is driven entirely by Emscripten compiling Lobster's generated C++.
About these formats
A .lobster file holds source code written in the Lobster programming language, a statically typed language with Python-like indentation created by Wouter van Oortmerssen and aimed mainly at…
Open .LOBSTER details →A .wasm file holds a compiled WebAssembly module: portable binary bytecode produced from languages like C, C++, or Rust and run at near-native speed. Most .wasm files are loaded by a web…
Open .WASM details →Quality & what to watch
- You can't skip the
--cppstep - the WebAssembly build has no JIT, so the C++ compile is mandatory first. - The
.wasmnever travels alone: the browser needs the accompanyinglobster.jsloader,lobster.htmlpage, andlobster.dataasset bundle. - Assets must be placed in
dev/emscripten/assetsbefore the build so Emscripten packs them intolobster.data.
Frequently asked questions
Do I need to compile to C++ before WebAssembly?
--cpp first and then build that C++ with Emscripten.What files does the build produce?
make -j8 in dev/emscripten produces lobster.wasm, lobster.js, lobster.html, and lobster.data.How do I run the wasm build?
emrun --browser chrome lobster.html --verbose to serve and open the page in a browser.Can I ship just the .wasm file?
.js runtime, .html loader, and .data asset bundle generated alongside it.