Skip to main content

Quick Start



Installation

  1. Install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Add the Rust WebAssembly compiler target
rustup target add wasm32-unknown-unknown
  1. Run the Turbo CLI install script
curl -sSfL https://turbo.computer/install.sh | sh
note

The installer will ask for your password for permission to move the turbo command into /usr/local/bin. If you prefer a manual download, follow these steps:

  1. Download the 64-bit release for your platform on the releases page.
  2. Decompress the archive and move turbo into your $PATH. We recommend /usr/local/bin.
  1. Verify your installation
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: