π Pick the language#
Firefly Zero supports lots of programming languages:
- π¦ Rust
- π Go
- π C and C++
- β‘οΈ Zig
- π¦ββ¬ Odin
- π° MoonBit
- π¦ AssemblyScript (a subset of TypeScript)
Experimental:
- π Lua
- π§ͺ Elixir
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.
For simple adventure games, it’s also possible to use Bulb or Bitsy.
π₯ Install tools#
- Install firefly_cli
- 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.
- Install odin:
- Go to odin releases
- Download and extract the latest release for your OS.
- Add the
bindirectory from the extracted path into$PATH.
- Install 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 ff new:
ff new --lang=rust hello-worldff new --lang=go hello-worldff new --lang=zig hello-worldff new --lang=as hello-worldff new --lang=c hello-worldff new --lang=cpp hello-worldff new --lang=odin hello-worldff new --lang=moon hello-worldff new --lang=lua hello-worldff new --lang=bitsy hello-worldff new --lang=bulb 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 the app and launch it in the emulator: ff run.
Have troubles using emulator? Check out the emulator user guide.
π¦ Distribute#
-
Export the app as a ROM (zip file):
ff 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:
ff import ./joearms.hello-world.zip -
Optional: add your app into the catalog: catalog.fireflyzero.com.
π€ Inspiration#
Need inspiration for your next game? Try combining and .
π regenerateAnother cool place for inspiration is My Famicase Exhibition. It’s a gallery of covers (with a short description) created for non-existing games. Wouldn’t it be fun to bring one of these games to life?
Also have a look at our catalog to see what other people made and check out popular games for PICO-8.
π± Ecosystem#
This section lists third-party packages that can be useful for making Firefly Zero apps and games. All of these packages are tested to compile to Firefly Zero, be fast, and produce very small binaries.
- micromath: Math library featuring fast, safe floating point approximations for common arithmetic operations, trigonometry, 2D/3D vector types, statistical analysis, and quaternions.
- nalgebra: Linear algebra optimized for computing graphics and physics.
- firefly-toml: A macro for statically parsing
firefly.toml.
- tinymath: The fastest Go math library for constrained environments.
- firefly-go-math: Go game math library for Firefly Zero. Includes random functions using Firefly Zero random source, Vec2 type, and some other math utils.
- micromath.mbt: Embedded math arithmetic, optimized for small code size at the cost of precision.
π§ 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:
You can edit the main.bitsy file using the official Bitsy editor: make.bitsy.org. Use the “load data” button to upload the file into the editor and “save data” to download the file from the editor back into the saved file.
To learn how to make Bitsy games, go to the official documentation.