# The rmp command

> rmp builds, runs, tests and ships a game, and makes new ones: one Python file behind a launcher for every shell.

Source: https://omardev29.github.io/rmp-docs/manual/basics/the-rmp-command.html

`rmp` is the one command a game needs. It builds the game, runs it, checks it, packs its assets, tags a release and makes new games. It is a single Python file, `tools/rmp.py`, standard library only, behind three small launchers so that the same word works in every shell.

Every command, with its examples, is in the [commands reference](https://omardev29.github.io/rmp-docs/reference/commands.html), which is read from `rmp help` itself.

## Getting it

The installer gets the framework and puts `rmp` on your PATH, in one line:

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

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

[Install rmp](https://omardev29.github.io/rmp-docs/getting-started/install.html) has the line for every system, where it puts things, and how to remove them. Underneath, it is a clone of the framework and two of `rmp`'s own commands, and a clone you made yourself goes on your PATH with the second:

```shell
~/raylib_multiplatform/rmp install
```

Building a game also needs [Python](https://www.python.org/downloads/) 3.11 or newer, [CMake](https://cmake.org/), Ninja and a C++ compiler on the PATH, and on a Linux desktop the X11 development libraries; the installer lists whichever this machine lacks. On a Linux console with no desktop it lists the DRM/KMS ones instead, which [Linux from a console](https://omardev29.github.io/rmp-docs/manual/platforms/linux-console.html) names. The one command for each of Debian and Ubuntu, Fedora, Arch and Alpine is in [Getting started](https://omardev29.github.io/rmp-docs/getting-started/index.html#linux-packages), and [the build image](https://omardev29.github.io/rmp-docs/getting-started/install.html#in-the-build-image) needs none of them on your machine.

## The launchers

The framework's root, and every game's, holds three files that do one thing each: find a Python 3.11 or newer and hand it `tools/rmp.py` with every argument you typed.

| File | For |
|---|---|
| `rmp` | POSIX sh, so it runs as `/bin/sh` on Linux, macOS and the BSDs and under bash, zsh and ksh. It follows a symbolic link to itself, so `ln -s ~/raylib_multiplatform/rmp ~/bin/rmp` works too. |
| `rmp.ps1` | PowerShell, Windows PowerShell 5.1 included. |
| `rmp.cmd` | cmd.exe. |

Each one asks every Python it finds whether it is 3.11 or newer instead of trusting the name: macOS's own `python3` is older than that, and on Windows `python3` can be the Microsoft Store's placeholder, which exits without running anything. The sh launcher tries `python3`, then `python3.14` down to `python3.11`, then `python`, then the `py` launcher that python.org installs on Windows; the PowerShell and cmd launchers try `py -3`, `python3` and `python`. When none will do, the command says so and stops:

`rmp: needs Python 3.11 or newer on PATH (python3, python or py).`

## Where it works

`rmp` works on the project it is standing in: the nearest folder, from the current one upwards, that holds a `raylib_multiplatform.toml`. So it works from any subfolder of a game. Outside a project, only `rmp new`, `rmp install`, `rmp update` and `rmp help` mean anything, and the others say so.

The project is either a game or the framework itself — the framework is the one that also holds its own test suite. `rmp lint` and `rmp example` are the framework's maintenance commands and are refused in a game.

### A game keeps its own rmp

Inside a project, the `rmp` on your PATH does not run its own code: it runs that project's copy of `tools/rmp.py`. A game therefore keeps the `rmp` it was made with — its build, its checks, its release steps — when the framework on your PATH moves on. Games made months apart each behave the way they did when they were made.

`rmp new`, `rmp install` and `rmp update` are the exceptions, by design: they act on the framework that ships the `rmp` being run, wherever they are typed. A new game is made from the framework you have installed, not from the game you happen to be standing in; and what goes on your PATH, and what updates, is that framework too. A game's own copy of `rmp` refuses the last two, because it is never what is on your PATH and never updated.

One variable in the environment turns the hand-over off, so that the `rmp` on the PATH runs its own code on the project:

```shell
RMP_NO_DELEGATE=1 rmp test
```

## Every day

```shell
rmp run               # build (debug) and play
rmp test              # the .toml, the pins, the licences, a frame drawn, a boot
rmp build release     # the release build
rmp web               # or: rmp android
rmp package           # the zip a release ships, made here
rmp help              # every command; rmp help <command> explains one, with examples
```

### rmp run and rmp build

`rmp run` builds the game in debug and starts it. Only what changed is compiled again, and only the game's own target is built, not anything else the build folder has configured. When the game exits, `rmp` exits with the game's code, so a crash is not reported as a success.

`rmp build` compiles without running and prints where the executable is: `build/debug/`, the folder `rmp run` builds in too. `rmp build release` is the build players get: optimised, with link-time optimisation except on NetBSD, whose linker cannot read GCC's link-time objects in a static library, and reading its assets from the `resources/` shipped beside it rather than from the project. It puts the executable in `build/release/` and copies nothing next to it, so started from the project's root it falls back on the project's own `resources/`. Laid out the way a release ships it — the executable with `resources/` beside it — it finds its files from whatever folder it is started in, everywhere but NetBSD and OpenBSD; [The app](https://omardev29.github.io/rmp-docs/manual/core/app.html#where-a-release-finds-its-files) explains how.

Debug and release each have a folder of their own, so switching between them rebuilds nothing, and the release never meets the compiler `[dev] compiler` chose for debug, which stays in the debug folder's cache. `build/` itself only holds those folders and is never a build. A `CMakeCache.txt` at its top is a build from a checkout older than that, and the first `rmp` command that configures removes what it left there, says so, and keeps the folders of the builds beside it.

### On a Linux console

On a Linux console with no desktop, `rmp` builds the game for DRM/KMS — raylib's backend that draws straight to the screen, with no X11 and no Wayland — and says so once. Debug and release then go to `build/debug-drm` and `build/release-drm`, and `rmp run` checks that the game can open the screen and read the keyboard before it starts it, saying what to do when it cannot. `rmp run sudo` builds as you and starts only the game as root, and `rmp` itself under sudo refuses every command but `rmp help` and `rmp clean`. `RMP_DRM=1` or `0` in the environment overrides what `rmp` decides. [Linux from a console](https://omardev29.github.io/rmp-docs/manual/platforms/linux-console.html) has the whole of it.

### rmp web and rmp android

`rmp web` builds the game for the browser with Emscripten, into `build/web/`. The emsdk has to be activated in the shell first, so that `EMSDK` is set; `rmp` refuses with that instruction when it is not. The page has to be served, not opened as a file:

```shell
rmp web
python3 -m http.server 8000 --directory build/web
```

and then `localhost:8000/my_game.html` in the browser, with the game's name in place of `my_game`. [Web](https://omardev29.github.io/rmp-docs/manual/platforms/web.html) has the rest of the browser target.

`rmp android` regenerates the Android configuration from the `.toml`, builds a debug APK with Gradle — which needs the Android SDK and NDK — and prints every APK it finds, marking the one it has just written. `adb install -r` with that path puts it on a connected phone. [Android](https://omardev29.github.io/rmp-docs/manual/platforms/android.html) has the rest.

### rmp build windows and rmp run windows

On Linux, `rmp build windows` builds the release `.exe` for 64-bit Windows, without a Windows machine: with MinGW-w64, into `build/windows/`. `rmp build windows
clang-cl` builds it with clang-cl and lld-link instead, into `build/windows-clang-cl/`, against Microsoft's own C runtime and Windows SDK — the same ones Visual Studio links — which is closer to what a Windows machine builds.

```shell
rmp build windows            # build/windows/my_game.exe, by MinGW-w64
rmp build windows clang-cl   # the same with clang-cl, against Microsoft's runtime
rmp run windows              # built, then started under Wine
```

Microsoft's runtime and SDK cannot be handed out by anyone but Microsoft, so neither the framework nor its build image carries them. The first `rmp build windows clang-cl` asks you to accept Microsoft's licence for them, and once you type `yes`, xwin downloads them from Microsoft into `~/.xwin` (about 800 MB; `XWIN_DIR` puts them elsewhere), once. Not on a terminal, it refuses instead of asking, unless `RMP_ACCEPT_MICROSOFT_LICENSE=1` says you accept it. The runtime it fetches is the newest your clang-cl can compile.

`rmp run windows` builds the `.exe` and starts it under Wine, which is a quick look and not a proof: Wine is not Windows. The build image has MinGW-w64, clang-cl, lld-link, xwin and Wine (on x86-64; there is no Wine for x86 programs on ARM). On a Linux machine of your own, MinGW-w64 is the `mingw-w64` package, clang-cl and lld-link come with LLVM, and xwin is `cargo install --locked xwin`. On Windows, `rmp build release` already builds the `.exe`, and `rmp build windows` says so.

### rmp package

`rmp package` makes, on your machine, the archive a release job would upload, into `build/package/`: the release build, packed with UPX where `[upx]` asks, the resource pack, and `LICENSES.txt`, zipped. For when you ship by hand — an upload to itch, a zip for a friend, a build for a store — without a tag and a CI run.

```shell
rmp package                  # build/package/my_game-linux-x64-glibc.zip: this machine's target
rmp package windows          # build/package/my_game-windows-x64.zip, made on Linux
rmp package windows clang-cl # the same with clang-cl: my_game-windows-x64-clang-cl.zip
rmp package web              # build/package/my_game-web.zip: the page, ready to upload
rmp package android          # build/package/my_game-android.aab and .apk, signed
```

`rmp package android` builds the release bundle — what Google Play takes — and a release APK, what a phone installs from a file, both signed with your upload key. It reads the key from the same four variables CI does, and refuses, naming each one missing, when they are not set:

```shell
export ANDROID_KEYSTORE_FILE=~/keys/upload.jks
export ANDROID_KEYSTORE_PASSWORD=...
export ANDROID_KEY_ALIAS=upload
export ANDROID_KEY_PASSWORD=...
rmp package android
```

The keystore never goes in the `.toml` or the repository. CI checks the command is what it ships: the web job makes the zip with `rmp package web` as well and compares the two file by file, and the Android job signs with `rmp package android` and verifies both files' signatures. [Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html) says how to make an upload key.

### rmp test

`rmp test` checks the game, stage by stage, and stops at the first that fails. `rmp test smoke` runs a single stage. In a game there are four, in this order:

| Stage | What it does |
|---|---|
| `config` | Validates `raylib_multiplatform.toml` the way every build does, checks that the pinned versions agree with each other, and checks every licence of everything vendored. |
| `unit` | Builds your tests in `tests/game/` with the game and runs them with no window. With no `.cpp` there, it says so and passes. See [Testing](https://omardev29.github.io/rmp-docs/framework/testing.html#game-tests). |
| `render` | Builds the game a second time against raylib's software renderer, which draws into memory with no GPU and no window, runs it for ten frames, and requires that it exited with status 0 and no sanitizer report, booted with no asset failing to load, drew something, honoured `[window] vsync` and reached the end of its frames. |
| `smoke` | Builds the game in debug, runs it for ten frames for real, and requires that it exited with status 0 and no sanitizer report, booted with no asset failing to load and put pixels on the screen. |

These are the same checks CI runs on the targets it can start, which is why a game that passes `rmp test` rarely surprises anyone in CI. A failed smoke stage prints the game's own output and one of four reasons, in this order: `a sanitizer reported the run above (exit …)`, `the game exited with status …`, `the game did not boot, or an asset failed to
load`, or `the game booted and drew nothing`. The exit status is read because the markers are printed before the game ends: a crash on the way out, or a leak that [`[dev] sanitize`](https://omardev29.github.io/rmp-docs/manual/basics/configuration.html#sanitizers) reports at exit, comes after them.

The `config` stage runs shell scripts, so on Windows it needs a bash; the one Git for Windows installs is the one `rmp` looks for.

### rmp fmt

`rmp fmt` formats your C and C++ — everything under `src/`, `include/` and `tests/` except the framework's own folders, `tests/smoke_test.h` and generated files — with whichever clang-format is on your `PATH`. `rmp fmt check` only reports what would change. Neither compares that clang-format's version with the one pinned in `thirdparty/FROZEN_VERSIONS.md`, and a different version would reformat files that were already correct, so it is worth installing the pinned one.

### rmp pack and rmp unpack

`rmp pack` bundles `resources/` into one encrypted `resources.rres` inside it, the way a release ships, so you can see the game run from the pack. From then on the game reads the pack. `rmp unpack` deletes it, and the game reads the loose files again — which is what you want while you are adding art.

### rmp clean

`rmp clean` deletes `build/` and every file generated from the `.toml`. The next build makes all of it again. It is the answer when a build goes strange. The Android and iOS icons stay, because they are not in those folders and remaking the Android ones needs Pillow. The Windows icon is in `cmake/generated/` and goes with the rest, so after a clean a machine without Pillow builds an `.exe` with no icon.

### rmp push and rmp deploy

`rmp push` is `git push`, refused while a CI run is still in flight: CI cancels the run in progress when a branch receives a new push, so pushing would throw away a run that was half done. It names the run instead, with the command to watch it. `rmp push force` pushes anyway. Without the `gh` command installed it cannot ask, says so, and pushes. With [`[ci] on_push = false`](https://omardev29.github.io/rmp-docs/publishing/ci.html#on-push) a push starts no run to cancel, so it asks nothing and pushes — unless `ci.yml` has changes not committed yet, when the commit being pushed may still start one.

A branch with no upstream yet has nowhere to go, so its first push, to the remote called `origin`, is `git push -u origin` and the branch's name — `git push -u origin main` for the `main` of a game `rmp new` made, once `git remote add origin` has named its repository. Git then knows where the branch goes, and every push after it is a plain one. With no remote at all, `rmp push` refuses and says how to add one.

`rmp deploy 1.2.0` releases a version. It adds the `v`, and refuses — before tagging anything — when there are uncommitted changes, when the tag already exists here or on the remote, when the branch has not been pushed (`rmp push` is what it tells you to run), or when the commit you are on is not the one on the remote, since CI builds the tag from the remote. It then checks the `.toml` the way the release will, which refuses placeholder store ids and a version that is not `MAJOR.MINOR.PATCH`, and only then makes an annotated tag and pushes it. CI builds every enabled target and attaches them to the release. `rmp deploy 1.2.0-rc1` is a pre-release.

### rmp install and rmp update

`rmp install` puts the framework it belongs to on your PATH, and `rmp update` moves that framework forward to the latest `main`; the installer runs both for you. [Install rmp](https://omardev29.github.io/rmp-docs/getting-started/install.html) explains them.

### rmp new and rmp help

`rmp new my_game` makes a game; `rmp new --list` prints what a game gets without making one. [Project layout](https://omardev29.github.io/rmp-docs/manual/basics/project-layout.html#making-a-game) explains both.

`rmp help` lists the commands on one screen. `rmp help test` explains one, with examples — and for `test`, its stages. `-h` or `--help` after any command prints the same page. `rmp help --json` prints every command and stage for a tool to read; this site checks every `rmp` line it shows against it.

## What it answers with

| Exit code | Means |
|---|---|
| 0 | Done, or help printed. |
| 1 | A check failed, or a precondition did not hold and the command refused. |
| 2 | The command line was wrong: an unknown command, a wrong argument, a framework command in a game, no project here, or an `RMP_DRM` that is neither `1` nor `0`. |
| 127 | No Python 3.11 or newer was found to run it: the launcher printed the message above and stopped. |
| 130 | Interrupted. |

A misspelt command gets the nearest real one suggested back. A command that ran something external, such as CMake, and saw it fail, names what failed and its exit code.

## Without rmp

Nothing in a game requires `rmp`: underneath, it is plain CMake with presets, and the `.toml` is applied by the configure step itself.

```shell
cmake --preset debug           # configures AND generates everything from the .toml
cmake --build --preset debug
./build/debug/my_game
```

The presets a game builds with are `debug`, `release`, `web` and `memory`, the software-rendered build the `render` stage uses, and each builds into the folder of its name under `build/`: `build/debug`, `build/release`, `build/web`, `build/memory`. On a Linux console, `debug-drm` and `release-drm` take the place of the first two, in `build/debug-drm` and `build/release-drm`. Configuring `build/` itself is refused before anything else runs, and so is a release configured by hand into a folder where `[dev] compiler` was applied, because that compiler stays in the folder's cache. A fifth, `cmake --preset lint`, only configures, into `build/lint`: it writes the compile database that clang-tidy and an editor read.
