On this page
  1. The rule that outranks the others
  2. Where a change goes
  3. Names
  4. Headers
  5. Ownership and pointers
  6. Nothing throws
  7. Telling the game it made a mistake
  8. The .toml
  9. A new dependency is a licence decision
  10. Debug is sanitized, release is hardened
  11. Every shipped binary has a size budget
  12. A Linux job downloads nothing
  13. Tested to the point of paranoia
  14. What has already cost time
  15. Language

The rules

The framework's CLAUDE.md is its rulebook, written short for an agent that reads it every session. This page is the same rules for a person, each with the reason it exists. Most of them are held by a tool, so breaking one is a red check rather than a review comment; where a Guidelines page has the detail, this page links it instead of repeating it.

The rule that outranks the others#

The API has to be as simple as possible for the person making the game, and a main menu is three calls: rmp::ui::begin(), a rmp::ui::button() per choice, rmp::ui::end(). A feature that makes that longer is redesigned until it does not. The overview has the three questions every feature answers, and the three-function menu the whole argument. Every other rule here gives way to this one.

Where a change goes#

src/main.cpp is a dozen lines and ends at RMP_GAME(MainMenuScene);, and stays that way. It is the first file a new game's author opens, and what it shows them is how little a game needs. The demo game lives in src/scenes/, and it is not where a new mechanic goes: that is an example.

Examples are where to go big. Each is a small project of its own, built as its own target and booted by CI with a screenshot, and the ones in games/, ui/, scenes/ and input/ are played by a script whose frames are compared exactly. So an example is documentation that cannot rot: the day it stops working, CI says so.

A game in examples/games/ is playable from start to finish — win, lose, play again — or it does not belong there. A script that cannot win a game is news about the game, and the fix goes into the game, not into the script.

Names#

One spelling per kind of name, with no prefixes: types in PascalCase, constants and enum members in CONSTANT_CASE, everything else in snake_case, a private member with a leading underscore, and a leading underscore on a method only for the hooks the framework calls. A constant is never named like somebody else's macro, and a macro starts with RMP_. Naming has the table and the reason for each line. clang-tidy, -Wshadow and tools/naming_check.sh check it, the last in every branch of every #if, including the ones your platform does not compile.

Headers#

  • A new header is a module a game can choose. rmp/ui.h, rmp/assets.h, rmp/input.h: each is a part of the framework you can name and decide to use or not. Anything else goes into a header that already exists. Splitting for tidiness taxes the user, because every header is one more thing they have to know exists. One header per module says more.
  • The framework's headers do not include each other. A header under include/rmp/ forward-declares instead; where a type held by value makes that impossible, it includes the other and says at its top why. That keeps one header from dragging the rest of the framework into every file that includes it. The rule is about our headers only: the standard library, raylib and raymath are used as the job needs, and what each costs to include is measured, not forbidden.
  • rmp/config.h is in every public header, and a game never types it: it brings in the values the .toml hands the code, from a generated file that includes nothing else, so it costs next to nothing. tools/header_check.sh compiles each public header on its own, so one that forgets it fails there.
  • What a header costs is written down. tools/header_budget.txt holds the preprocessed size of each public header, measured in the build image. In the image a header that grows past its line fails; anywhere, a header without a line fails.

Ownership and pointers#

Whatever the framework allocates, opens or loads has an owner whose destructor gives it back. There is no bare new, delete, malloc or free under include/rmp/ or src/rmp/, and a raylib Load* or Unload* appears only in the file that owns what it makes; tools/ownership_check.sh refuses the rest, and its list of exceptions only shrinks. A game never has anything of the framework's to free, so it can never free it twice.

No declaration a game can name has a raw pointer or a C string in it. In its place: a value, a reference, a std::span, a std::optional, two overloads, or rmp::Ref for something that may be missing; std::string_view in and std::string out; and rmp::Handle for an object kept from one frame to the next. tools/pointer_check.py reads the headers' syntax tree and fails a public one; a pointer in detail:: or in a private member is allowed only with its line and its reason in tools/pointer_ratchet.txt, which only shrinks.

A callback is the framework's own Callback, not std::function, on purpose: std::function needs a callable it can copy, so a lambda that captures a std::unique_ptr would stop compiling.

Pointers and RAII shows each replacement in code, and Ownership explains handles.

Nothing throws#

There is no throw under src/rmp/ or include/rmp/, and a test of the test campaign fails one. A mistake in the game gets a safe value and a report instead, below. The one place exceptions exist is the property tests' own program, because RapidCheck's assertions throw. No exceptions has the reasons.

Telling the game it made a mistake#

A mistake the game can make every frame — an input action nobody defined, a pop() with no scene under it — is reported once, through RMP_REPORT_ONCE in src/rmp/internal.h, keyed by the place in the code that says it (and with RMP_REPORT_ONCE_KEYED, by a value too), never through a warned flag of its own. Sixty identical warnings a second would bury the one that matters. With [dev] strict = true the first one aborts a debug build, at the line that made it. A debug build also shows each one on screen, and a boot that reported one fails rmp test smoke.

That is for mistakes in the game, and only those. A condition of the machine — no sound device, a folder it cannot write — is a plain TraceLog(), said once by the state that remembers it, with a comment beside it saying why it is not a report: strict mode would abort a correct game on a CI runner or a player's locked-down computer. Turning one of those into a report breaks strict mode. And reading something never reports at all: reading rmp::Value through a path that is not there creates nothing and says nothing.

The .toml#

A .toml that cannot work fails in tools/configure.py, in its first second, naming the exact line, what is wrong and what to write instead — not at cmake --preset, and not on a runner twenty minutes later. Every combination that cannot work is a refusal with a reason, and every refusal has a test in tests/configure_test.py. A mistake in the configuration that reaches the compiler is a bug in configure.py. The config pipeline explains why.

Nothing secret goes in it: no keystore, token or password. Values yes, secrets no; a secret lives in the repository's GitHub secrets.

A new dependency is a licence decision#

Every vendored component has a row in THIRD_PARTY_LICENSES.md, and tools/license_db.py --check, in rmp test config, fails one without it. Copyleft fails, LGPL included, because neither iOS nor a static musl build can link dynamically; non-commercial and unknown licences fail. A component under a licence that asks for changes to be marked is either pinned unmodified by sha256 in thirdparty/FROZEN_VERSIONS.md or marked modified with a PATCHES.md beside it. The raylib the framework ships is modified, so no page may call it unchanged. Licences has the whole list.

A vendored header goes on four include lists, not one: the rmp target in CMakeLists.txt, Android's own CMakeLists.txt under raymob/, the iOS project tools/configure.py generates, and the Windows job's pass over the examples. Getting all but one of them right looks exactly like getting them all, until a platform you did not build says file not found, so a test holds every folder under thirdparty/ with a header to all four.

Debug is sanitized, release is hardened#

Every debug build of the framework — the library, the examples, every test program — runs under AddressSanitizer and UndefinedBehaviorSanitizer, because the framework's own [dev] sanitize lists both. CI sets RMP_REQUIRE_SANITIZERS, so a machine that cannot run them fails at configure instead of testing nothing in silence. A check that measures time allows for the slowdown when RMP_SANITIZE is defined. Every target built from our sources is compiled with -Wall -Wextra, and the framework's own checks with RMP_WERROR, which makes a warning an error.

A release flag goes in only when it costs 3 % or less of the unpacked binary, measured on the build that ships; position-independent executables are the one exception, on by Omar's decision, because without them address randomisation moves everything but the program itself. Security has every flag with what it protects against and what it costs.

Every shipped binary has a size budget#

tools/size_budget.txt holds the size of every binary a release ships, and a step of every release job holds it there: within 1.5 % of its line it passes in silence, up to 10 % it passes with a warning that names the new size, and past 10 % it fails — growing or shrinking. Growth is allowed; it is a decision, and the commit that grows a binary writes the new line. The size budget shows the file and how one run's log updates it.

A Linux job downloads nothing#

Every compiler, tool and library the Linux jobs use is in the build image, pinned by digest. A download during a job is a single point of failure that no pinning fixes: the checksum can be right and the network still be down, and twenty minutes of jobs fail for a reason that has nothing to do with the code. A new tool is a new image and a new digest, in thirdparty/FROZEN_VERSIONS.md and in every workflow that names the image; tools/versions_check.sh fails when any two disagree.

Tested to the point of paranoia#

Anything that can be tested is tested, and a test asserts what actually happened, not that a command exited 0: a job can go green having run none of its script, and a suite can pass having run a part of its tests. For an option, that means every valid value, every invalid one, the wrong type, the empty value and the combinations that cannot work.

And a test you have not seen fail is not a test yet. Every test and every gate is seen red on the mistake it exists for — planted by hand, and found exactly once — before its green is trusted; the pull request says what was seen red.

When a mistake can be described precisely, a machine rejects it: a clang-tidy check, a refusal in configure.py, a test, a gate. A rule that lives only in a document is kept until the day somebody has not read it. The pages on tests, examples and e2e, properties, fuzzing and mutation and coverage and gates are how.

What has already cost time#

The second half of the framework's CLAUDE.md is a list of mistakes that each cost a run, a day or a release once, every one found by reproducing it rather than by reading code: that riscv64 runs under an emulator, that macOS ships bash 3.2, that a BSD job's script can exit 0 having run half of itself, that pushing cancels a CI run, and more. Read the entry for an area before you change it. It is cheaper than finding it again.

Language#

Code, comments, documentation and commit messages are in English. A name in a comment is spelled exactly as in the code, so a rename renames the comments too.

Next: writing tests.