Getting started ▢️

Getting started

πŸ‘‰ 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:

  1. (βŒ› Coming soon) ⚑️ Zig is simple and gives the best performance but you need to be careful to avoid bugs and memory leaks.
  2. πŸ¦€ 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.
  3. πŸƒ Go is slower than Rust or Zig but very simple to use and doesn’t have memory leaks.
  4. (βŒ› 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 #

  1. Install rust and cargo: curl https://sh.rustup.rs -sSf | sh
  2. Install firefly-cli: cargo install firefly_cli
  3. Download emulator binary and put it into $PATH
  4. 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:

  1. Go to wasi-sdk releases.
  2. Download and install the latest release for your OS.
  3. 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 the WASI_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 #

  1. Build and install the app: firefly_cli build
  2. Run the last built app: firefly_emulator

Have troubles using emulator? Check out the emulator user guide.

πŸ“¦ Distribute #

  1. Export an app into a zip file: firefly_cli export.

  2. Publish the file anywhere you like. For open-source projects, a good option is Github Releases.

  3. People then can download and install the app:

    firefly_cli import ./joearms.hello-world.zip
    
  4. Optional: add your app into the catalog: catalog.fireflyzero.com.

🧠 Further reading #

There are several things you should know to make a game:

  1. How the runtime works in general. Start by reading about firefly.toml and then go through all other pages in this documentation in order.
  2. What functions the SDK for the programming language that you choose provides:
    1. πŸ¦€ Rust
    2. πŸƒ Go
    3. πŸ€ C
  3. How to make games and what patterns make it easier. We recommend reading Game Programming Patterns.

➑️ firefly.toml