# Getting started

> Install the rmp command once, make a game with it, run it, and then build that game up one page at a time.

Source: https://omardev29.github.io/rmp-docs/getting-started/index.html

`rmp` is the one command: it makes a game, builds it, runs it, tests it and ships it. You install it once, and every game you make has its own copy.

## What you need

- **Python 3.11** or newer, **CMake 3.30** or newer and **Ninja** on your PATH, and a C++ compiler. A Linux distribution's own `cmake` package can be older than 3.30, and an older CMake stops the first build before anything is compiled: `cmake --version` says which one you have.
- **git**, to get the framework and to keep your game in.
- On a Linux desktop, the X11 development libraries.

### On Linux, in one command

Everything a build needs — the compiler, CMake, Ninja, Python, git and the X11 headers — for each family of distributions. Any C++20 compiler does: `[dev] compiler = "clang"` uses clang where it is installed and the system's compiler where it is not.

**Debian and Ubuntu**

```shell
sudo apt install build-essential cmake ninja-build python3 git \
    libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev
```

Ubuntu 24.04's `cmake` is 3.28; take a newer one from Kitware's own apt repository, or `pipx install cmake`.

**Fedora**

```shell
sudo dnf install gcc-c++ cmake ninja-build python3 git \
    libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel mesa-libGL-devel
```

**Arch**

```shell
sudo pacman -S --needed base-devel cmake ninja python git \
    libx11 libxrandr libxi libxcursor libxinerama mesa
```

**Alpine**, 3.21 or newer for a CMake of 3.30. Its Ninja is `samurai`, its compiler and `make` come in `build-base`, and GLFW reads the kernel's input headers. Alpine ships `doas` rather than `sudo`:

```shell
doas apk add build-base cmake samurai python3 git linux-headers \
    libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev mesa-dev
```

Or install nothing on the machine at all, and work inside the image CI builds in: [In the build image, with Podman](https://omardev29.github.io/rmp-docs/getting-started/install.html#in-the-build-image).

On a Linux console with no desktop, `rmp` builds for DRM/KMS instead, and needs the DRM headers in their place; [Linux from a console](https://omardev29.github.io/rmp-docs/manual/platforms/linux-console.html) says which, and how the game reaches the screen.

## Install rmp

One line, in a terminal. On Linux and macOS:

```shell
curl -fsSL https://omardev29.github.io/rmp-docs/install.sh | sh
```

On Windows, in PowerShell:

```powershell
irm https://omardev29.github.io/rmp-docs/install.ps1 | iex
```

It needs git and Python 3.11 or newer, and says how to get either if it is missing. It puts the framework in your home folder and `rmp` on your PATH, as you and without `sudo`, and at the end it lists anything a build still needs on this machine. [Install rmp](https://omardev29.github.io/rmp-docs/getting-started/install.html) has the line for the BSDs and for Linux without `curl`, where everything goes, and how to update and remove it. Open a new terminal, and check:

```shell
rmp help
```

## Make a game

```shell
rmp new my_game
cd my_game
rmp run
```

`rmp new` makes a folder with the framework, the build and CI for every target, and a small game in `src/` to start from. `rmp run` builds it and opens the window: a menu with a rabbit on it. The first build compiles raylib and the framework, so it takes a while; after that only what changed is compiled again.

The folder is also a git repository, with every file already added. Commit it, so that what the next pages change is yours to see in `git diff`:

```shell
git commit -m "New game"
```

## What is yours

Most of the folder is the framework and the build, and you do not edit it. Your game is seven places:

| Path | What it is |
|---|---|
| `src/main.cpp` | Where the game starts. It names the first scene, and that is all it does. |
| `src/scenes/` | The scenes, one per file: `main_menu.h` and `main_menu.cpp` are the menu you just saw. |
| `include/` | Your headers, when you want them apart from the code. This tutorial keeps each header beside its `.cpp` instead. |
| `resources/` | Pictures and sounds, loaded by name. `rabbit.png` is the one on the menu. |
| `tests/game/` | Tests of your game, run with no window by `rmp test unit`. It starts with one, of the menu. |
| `branding/icon.png` | The app's icon: the Android and iOS icons, and the one inside the Windows `.exe`, are all made from this one picture. It is not in `resources/` because the game never loads it. |
| `raylib_multiplatform.toml` | The game's name, its window, its app ids and which platforms to build. |

`src/rmp/` and `include/rmp/` are the framework itself, inside your game. Every other `.cpp` under `src/`, in any folder, is compiled without being listed anywhere: adding a file to the game touches no build file.

The new game's `raylib_multiplatform.toml` has your game's name in it, and app ids that start with `com.example.`. Set real ones before your first release: `rmp deploy` refuses to tag a release while they are placeholders, because a Google Play app id can never change once it is published.

## The tutorial

The pages that follow turn the game `rmp new` made into a real one, a step at a time: *Coin Rabbit*, in which a rabbit gathers coins while bats close in on it. Each page shows every source file it adds or changes, whole, and the keys it sets in `raylib_multiplatform.toml`, and ends with a game that builds and runs.

1. [Your first scene](https://omardev29.github.io/rmp-docs/getting-started/your-first-scene.html): a menu of your own, and a second screen to go to.
2. [A player](https://omardev29.github.io/rmp-docs/getting-started/a-player.html): an object that moves with the keyboard, a gamepad, the mouse or a finger.
3. [Coins and bats](https://omardev29.github.io/rmp-docs/getting-started/coins-and-bats.html): something to collect, something to avoid, and a game over.
4. [A pause menu](https://omardev29.github.io/rmp-docs/getting-started/a-pause-menu.html): a scene on top of the game.
5. [Art and sound](https://omardev29.github.io/rmp-docs/getting-started/art-and-sound.html): pictures and sounds, loaded by name.
6. [Saving a record](https://omardev29.github.io/rmp-docs/getting-started/saving-a-record.html): the best score, kept between sessions.
7. [Ship it](https://omardev29.github.io/rmp-docs/getting-started/ship-it.html): real app ids, the checks, and a release built for every platform.
