Skip to main content

Setup

Download WASM-4:

📥 Windows📥 macOS📥 Linux

This contains the w4 command that will be used to create new projects and run games locally.

info

You can also install w4 with NPM by running npm install -g wasm4

Quickstart#

Let's go over creating a new project called hello-world for your chosen language. Use the dropdown menu to select a different language.

To compile Rust projects you will need cargo installed. You will also need the wasm32 target, which can be installed with rustup target add wasm32-unknown-unknown.

w4 new --rust hello-worldcd hello-world

Compile the .wasm cartridge:

cargo build --release

Run it in WASM-4 with:

w4 run target/wasm32-unknown-unknown/release/cart.wasm
tip

You can also use w4 watch to automatically watch for changes in source files and rebuild in real-time.

Next Steps#

Next let's take a look at some source code for Hello World.