π Pick the language#
Firefly Zero supports lots of programming languages:
- π¦ Rust
- π Go
- π C and C++
- β‘οΈ Zig
- π° MoonBit
Experimental:
- π Lua
- π§ͺ Elixir
- β Coming soon: more languages (Python, JS, Kotlin).
For simple apps and games, it’s a good idea to stick to what you already know. But if you’re ready to learn something new for better results, we recommend using Go. It’s easy to learn, sufficiently fast, and memory-safe.
π₯ Install tools#
- Install firefly-cli and firefly-emulator
- Install WebAssembly compiler for your language:
rustup update nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknownThe preferred way to build a C (or C++) app is using wasi-sdk:
- Go to wasi-sdk releases.
- Download and install the latest release for your OS.
- This should install wasi-sdk into
/opt/wasi-sdk. If you used an alternative installation method and installed wasi-sdk in a different place, provide the absolute path to it in theWASI_SDK_PATHenvironment variable.
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bashπ» Create the project#
A new project can be created using firefly_cli new:
firefly_cli new --lang=rust hello-worldfirefly_cli new --lang=go hello-worldfirefly_cli new --lang=zig hello-worldfirefly_cli new --lang=c hello-worldfirefly_cli new --lang=cpp hello-worldfirefly_cli new --lang=moon hello-worldfirefly_cli new --lang=lua hello-worldIn this example, it will create hello-world directory and initialize in it a new app called hello-world using your chosen programming language. Don’t think about it too hard, you can later change the project name in the config (hello-world/firefly.toml).
π Build and run#
- Build and install the app:
firefly_cli build - Run the last built app:
firefly_emulator
Have troubles using emulator? Check out the emulator user guide.
π¦ Distribute#
-
Export an app into a zip file:
firefly_cli export. -
Publish the file anywhere you like. For open-source projects, a good option is Github Releases.
-
People then can download and install the app:
firefly_cli import ./joearms.hello-world.zip -
Optional: add your app into the catalog: catalog.fireflyzero.com.
π§ Further reading#
There are several things you should know to make a game:
- How the runtime works in general. Start by reading about firefly.toml and then go through all other pages in this documentation in order.
- How to make games and what patterns make it easier. We recommend reading Game Programming Patterns.
And take a look at resources for your language: