π Pick the language #
Firefly Zero supports lots of programming languages. 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 a better results, there are some recommendations:
- (β Coming soon) β‘οΈ Zig is simple and gives the best performance but you need to be careful to avoid bugs and memory leaks.
- π¦ Rust gives performance close to Zig and it’s hard to use it wrong, but it’s also the most difficult language to learn on the list.
- π Go is slower than Rust or Zig but very simple to use and doesn’t have memory leaks.
- (β Coming soon) More languages.
Subjective comparison:
Language | Simplicity | Performance | Safety |
---|---|---|---|
β‘οΈ Zig | π» 3/5 | π 5/5 | π 2/5 |
π¦ Rust | π¬ 1/5 | π 5/5 | π 5/5 |
π Go | π¨ 4/5 | π 4/5 | π 4/5 |
π C | π» 3/5 | π 5/5 | π 1/5 |
π₯ Install tools #
- Install rust and cargo:
curl https://sh.rustup.rs -sSf | sh
- Install firefly-cli:
cargo install firefly_cli
- Download emulator binary and put it into
$PATH
- Install WebAssembly compiler for your language:
rustup target add wasm32-unknown-unknown
The 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_PATH
environment variable.
π» Create the project #
A new project can be created using firefly_cli new
:
firefly_cli new --lang=rust hello-world
firefly_cli new --lang=go hello-world
firefly_cli new --lang=c hello-world
firefly_cli new --lang=cpp hello-world
In 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.
- What functions the SDK for the programming language that you choose provides:
- How to make games and what patterns make it easier. We recommend reading Game Programming Patterns.