On this page
  1. Making a game
    1. What a new game gets
  2. The folder
    1. What is yours
    2. What is the framework's
  3. Every file under src/ is compiled
  4. resources/
  5. branding/
  6. What the build generates

Project layout

A game is a folder that rmp new makes. It holds your code, your art and one config file, next to its own copy of the framework and everything needed to build it for 17 targets. Most of the folder is never yours to open, and the framework's own code sits in two folders called rmp/, so the two are told apart at a glance.

Making a game#

rmp new my_game       # makes my_game/, here
cd my_game
rmp run               # build it and play it

The name of the folder is the name of the game. rmp new writes it into [project] name and [window] title, and from there it becomes the executable, the CMake target, the Xcode scheme, the save folder on desktops and the web, and the name of every artifact CI uploads. Because it becomes a file name on every operating system the game ships to, it has to be letters, digits, _ and -, starting with a letter. A name that is not, or that is already taken by a target of the build (rmp, raylib, unit_test and the like), or that Windows reserves for a device (con, nul, com1…) is refused before anything is written. When the trouble is a character, such as a space, the refusal suggests the name with it turned into _.

The folder can be anywhere — rmp new ~/games/space_rocks makes space_rocks — except inside the framework itself. If it exists it has to be empty.

Besides copying files, rmp new does six things to the new game:

  • Sets the store identities to placeholders built from the name: [android] application_id becomes com.example.my_game and [ios] bundle_id becomes com.example.my-game. The two differ because Android ids take _ and not -, and Apple bundle ids the other way round. A release build refuses any id under com.example., because a Google Play application id can never be changed once it is published.
  • Gives [resources] rres_password a random value of its own, so that games made from the framework do not share the key their asset packs are encrypted with.
  • Starts the game without ads and on OpenGL ES 2.0: [android.admob] enabled = false, so the Android build carries no ads SDK and asks for no advertising permission until the game has an ad to show, and [android] gl_version = "ES20", which every Android device has. The framework's own .toml sets both the other way, so that its CI builds the ads path and the ES 3.0 one.
  • Writes a short README.md for the game, which says which parts of the folder are the game's.
  • Makes it a git repository on a branch called main, with every file added and nothing committed yet. The raylib-iOS submodule is recorded at the commit the framework pins, with its folder left empty: git submodule update --init is only needed to build for iOS.
  • Runs the new game's own tools/configure.py --check and tools/license_db.py --check. If either fails, the folder is removed again: there is no half-made game to clean up.

A game has no licence of its own; choosing one is yours. The framework's MIT licence travels with it as thirdparty/raylib_multiplatform/LICENSE, next to every other component's, and reaches the LICENSES.txt each build ships. It is not a LICENSE at the root of the game, which would make GitHub call every game made with the framework MIT.

What a new game gets#

The copy is an explicit list, not "everything except". rmp new --list prints it, one path per line, without making anything:

rmp new --list

A list of what to take fails loudly when it is wrong: a file a game needs and does not get is a game that does not build. A list of what to leave out would fail silently and for good, because the next file added to the framework — a gate, a test fixture, a maintenance script — would ride along into every game and nothing would say so. The framework's own tests make every file it tracks be classified as one or the other, so a new file forces the question.

Some of what a game gets is not what the framework itself uses. Its [dev] sanitize is empty, and its [dev] c_compiler is "auto": on x86-64 Linux, with tcc installed, the C of its debug builds — raylib and the libraries it bundles — is compiled by tcc, many times faster (c_compiler). And it gets the development container, so it can be opened in one with nothing installed.

The folder#

This is the top of a new game. The comments say whose each entry is.

my_game/
├── raylib_multiplatform.toml   yours: the name, the ids, the platforms, everything else
├── src/
│   ├── main.cpp                yours: RMP_GAME(MainMenuScene); and nothing else
│   ├── scenes/                 yours: main_menu.h and main_menu.cpp to start from
│   └── rmp/                    the framework's implementation
├── include/
│   └── rmp/                    the framework's headers
├── resources/                  yours: art, sounds, fonts, levels (rabbit.png to start)
├── branding/icon.png           yours: the one picture the app icons are made from
├── README.md                   yours: written by rmp new
├── rmp  rmp.ps1  rmp.cmd       the command, for sh, PowerShell and cmd
├── tools/                      configure.py, rmp.py, the licence check, the packer, CI's scripts
├── CMakeLists.txt              the build, driven by the .toml
├── CMakePresets.json           the presets: debug, release, web, memory, lint
├── cmake/                      the build's helpers; cmake/generated/ appears here
├── raymob/                     the Android app shell (Gradle)
├── ios/                        the iOS scaffold; ios/project.yml appears here
├── tests/
│   ├── game/                   yours: tests of your game, with no window (main_menu_test.cpp)
│   └── smoke_test.h            the boot and render check CI runs on every target
├── thirdparty/                 raylib and the other vendored libraries, pinned
├── THIRD_PARTY_LICENSES.md     every vendored component and its licence
├── .github/workflows/          CI for every enabled target, and the release
└── package.json                what CI's web boot test runs on (Playwright)

What is yours#

PathWhat goes there
raylib_multiplatform.tomlThe game's name and identities, its window, the platforms it is built for, and every setting the framework reads. See Configuration.
src/main.cppThe entry point: one line, RMP_GAME(MainMenuScene);, naming the first scene. See The app.
src/scenes/Your scenes, one per file. More folders beside it — a folder for your objects, one for your behaviors — are yours to add.
include/Headers you want on the include path from anywhere in src/. Headers that sit next to their .cpp in src/ work too, included by their relative path.
resources/Everything the game loads at run time, loaded by name.
branding/icon.pngThe app icon, one square PNG.
tests/game/Your tests: doctest cases built with everything in src/ but main.cpp, run with no window by rmp test unit and by CI. See Testing.

What is the framework's#

Two paths are the framework's and carry the same name so that you can tell at a glance: include/rmp/, the headers you include, and src/rmp/, their implementation. Everything else under src/ and include/ is yours.

The rest of the folder is the machinery that builds and ships the game: CMake for the desktops and the web, Gradle under raymob/ for Android, an XcodeGen spec under ios/ for iOS, the workflows under .github/workflows/ for CI, and the vendored libraries under thirdparty/, each pinned and each licence on record. None of it is edited to rename the game, to add a source file or to pick platforms; all three are the .toml's or src/'s job.

The game's copy of tools/rmp.py is the one that runs inside it, even when the rmp on your PATH is a newer framework's. That is what keeps a game building the way it did when it was made; The rmp command has the detail.

A game does not get the framework's examples/, its own tests or its maintenance tools. The examples are on this site, under Examples, each one a small game of its own that can be read and copied from.

Every file under src/ is compiled#

There is no list of source files anywhere. Every .cpp and .c under src/, in any subfolder, is part of the game, in all four build systems: CMake globs the folder recursively, Android's CMake under raymob/ does the same, and the iOS spec takes src/ as a whole. Adding a game.cpp to src/scenes/ touches no CMake, no Gradle and no Xcode project; the next build finds it.

On the desktops and the web, src/rmp/ is left out of the game's own sources and compiled once into a library called rmp, which the game links. That is why changing a scene recompiles the scene and not the framework.

A game whose own sources hold no C++ — main.cpp, the scenes and tests/game/ deleted, and a main.c in their place — is built as plain C: its own main(), linked to raylib alone.

src/rmp/ goes too, because nothing in a C game uses it and yet it would be built: the framework library is built from it whenever it has sources, so kept, it is the whole C++ framework compiled for nothing on the desktops, and compiled into the game on Android and iOS, whose builds take everything under src/. With it gone there is no rmp library, and none is built; a C++ file left in src/ without it stops the configure with a message that says so.

What the C game still includes is written in C, and on its include path on every target: rmp/config.h for the .toml's values, which is why include/rmp/ stays, tests/smoke_test.h for the boot checks CI runs, and <admob.h>, the ads as C functions, which do nothing off Android. Plain C explains it, and examples/plain_c is that shape.

A plain C game keeps the builds, the generated identities and icons and the release pipeline. It gives up the asset pack, which raylib alone cannot read: its releases ship the loose files of resources/, with a PACK_SKIPPED.txt beside them saying why. And it gives up the web and iOS, whose frame loops belong to the browser and to UIKit and are written by the framework's entry point.

resources/#

The game loads its files from resources/ by name — rmp::assets::load_texture("rabbit.png") — without knowing whether they are loose files or packed into one encrypted resources.rres. While you work they are loose, so a new picture is in the game the next time it runs. rmp pack bundles the folder into a resources.rres inside it, the way a release does, and rmp unpack deletes the pack so the loose files are read again.

Assets has the whole of loading, and the loading example reads the same files both ways.

Keep the folder in folders by kind — sprites/, maps/, audio/, fonts/, dialogue/, locale/. A resource's name is its path below resources/ ("sprites/hero.png"), and every target finds it by that name: the pack a desktop release ships keeps each file under it, and the web, Android and iOS ship the folder whole.

Where the game looks for the folder depends on the build. On a desktop, a debug build reads the project's resources/ by its absolute path, so the game finds its files whatever folder it is started from. A release build reads ./resources/, and a release ships the folder, or the pack in it, next to the executable; at start it moves into the executable's folder when a resources/ is there, so a player can start it from anywhere — The app has the detail, and the two BSDs where it cannot. The web build preloads the files with the page, Android puts them in the APK's assets and iOS copies the folder into the app bundle.

branding/#

branding/icon.png is one square PNG, 1024×1024 recommended, and the Android, iOS and Windows icons are made from it: each Android density with its round and adaptive variants, the Play Store image, the iOS app icon and the .ico embedded in the Windows executable. The other targets have no icon of their own to make: macOS, Linux and the BSDs ship a bare executable, and the web a page.

It is not in resources/ on purpose. Everything there is packed and shipped with the game, and a launcher icon is an input of the build, not an asset the game loads.

The folder is yours, name included: [icon] source is the only thing that has to agree with it. When the file is missing the build warns and keeps whatever icons already exist instead of failing. Resizing it into the Android icons needs Pillow, the Python imaging library; a machine without it keeps the icons it has, because only the Android and iOS builds use them. The Windows .ico needs Pillow too: without it a build of your own makes an .exe with no icon, and CI's Windows jobs install it and fail an .exe that came out without one.

What the build generates#

Every configure turns raylib_multiplatform.toml into the files each build system reads. None of them is committed — .gitignore lists them — so none can drift out of step with the .toml, and git status stays clean after a build.

GeneratedFor
cmake/generated/CMake: the project name, raylib's module switches, the compiler, linker and sanitizers of debug builds, the Windows icon, the LICENSES.txt of each family of targets.
include/rmp/generated/C and C++: the config.h that holds the RMP_ values. See Headers.
raymob/generated.properties, raymob/app/generated/Gradle: the Android properties and the manifest.
ios/project.ymlXcodeGen: the iOS project.
build/Everything compiled, one folder per build: build/debug/, build/release/, build/debug-drm/ and build/release-drm/ on a Linux console, build/web/ for the browser, build/memory/ for the software-rendered check.

The app icons are generated too, into the Android resource folders and an asset catalogue under ios/, and ignored the same way.

One generated part is committed, because GitHub reads it before anything runs: the triggers of .github/workflows/ci.yml, which the configure writes from [ci] on_push. Continuous integration explains it.

rmp clean deletes build/ and every generated file except the Android and iOS icons, which stay because making the Android ones again needs Pillow. The Windows icon lives in cmake/generated/ and is deleted with it, so after a clean a machine without Pillow builds an .exe with no icon. The next build makes the rest again. Gradle and XcodeGen never run CMake, so the Android and iOS builds run tools/configure.py themselves first; rmp android does.