Skip to main content

Quick Start



Prerequisites

Before installing the Turbo CLI, ensure you have Rust with the wasm target:

How to install Rust + wasm

On MacOS, Linux, or another Unix-like OS, run the following command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

On Windows, download and run rustup-init.exe.

If needed, you can find more info on Rust's installation docs →

Once installed, run the following command to add the WebAssembly target:

rustup target add wasm32-unknown-unknown

Installation

Install turbo by running this script:

curl -sSfL https://turbo.computer/install.sh | sh
Install script alternative

The installer will ask for your password to place the command in /usr/local/bin. If you don't want to rely on the install script, you can manually download the cli and place it somewhere in your $PATH.

Verify your installation with the following command:

turbo -h

If successful, it will output turbo's help documentation.

Hello, World!

Now it is time to speedrun your first Turbo game. It should take less than 5 minutes.

1. Initialize

Begin by creating a new project called hello-world:

turbo init hello-world

This initializes a rust crate in a hello-world directory.

2. Run

Next, run your game with the following command:

turbo run -w hello-world

A game window should appear.

Turbo game window with the text "Hello, world!!!"

note

The -w flag auto-refreshes your game window as you code. Just be sure to watch the console for compiler errors.

3. Update

Leave the turbo run command running. Open the hello-world project in your preferred editor.

Now, open hello-world/src/lib.rs. You should see something like this:

hello-world/src/lib.rs
// This is where your main game loop code goes
// The stuff in this block will run ~60x per sec
turbo::go! {
text!("Hello, world!!!");
}

Time for your first update. Modify the text and check out your game window:

hello-world/src/lib.rs
// This is where your main game loop code goes
// The stuff in this block will run ~60x per sec
turbo::go! {
text!("Yuuurrr!");
}

Turbo game window with the text "yuuurrr!!!"

If you want to keep playing around, the text! macro has several optional parameters you can experiment with:

hello-world/src/lib.rs
// This is where your main game loop code goes
// The stuff in this block will run ~60x per sec
turbo::go! {
text!(
"Let's gooo!", // Text to display
x = 32, // Starting x position of the text
y = 48, // Starting y position of the text
color = 0xff00ffff, // Text color
font = Font::L // Text font (other options: Font::S and Font::M)
);
}

Next Steps

Congratulations! 🎉

Here are a few ways to continue your game development journey: