2.8 Bundled and deployed game packs
How a game pack is written, parsed, registered, generated into every binding,
baked into each artifact, and chosen on a robot. Read it before editing anything
under assets/fields/, adding a season, or changing which pack an artifact
loads by default.
The pieces
| File or tool | Role |
|---|---|
assets/fields/<id>.toml | A bundled pack, one per registered game |
assets/fields/manifest.tsv | The registry: which ids ship, with game name and year |
assets/fields/DEFAULT | Which registered id each artifact WPILib year loads by default |
tools/packs/sync-bundled-pack.py | Generates enum identities and embedded copies for Java, Python, C++ and the editor |
tools/packs/test_bundled_packs.py | Unit tests for the registry rules and the generator |
rust/core/src/field.rs | parse_game_pack, the only parser; every binding and the wasm build call it |
website/src/content/docs/reference/formats/game-pack-toml.mdx | The user-facing format reference |
Bindings never parse TOML themselves. Java (GamePack.fromToml), Python
(GamePack.from_toml) and C++ (GamePack::from_toml) pass the text to the core
through tempo_load_pack, and the editor passes it to the wasm PackHandle and
parse_pack. A pack the core accepts is accepted everywhere. Java and Python cap
pack text at 4 MiB (MAX_PACK_BYTES in GamePack.java and game_pack.py).
The TOML format
The public format has a single schema version, SUPPORTED_SCHEMA_VERSION = 1 in
field.rs. The reference page documents every key for teams, and this section covers
what the parser does with them.
[meta]
name = "REBUILT 2026"
year = 2026
version = 1
[field]
lengthM = 16.541
widthM = 8.0693
origin = "alwaysBlue"
symmetry = "rotational"
[[obstacles]]
id = "trenchLeft"
shape = "rectangle"
minM = [4.03, 6.485]
maxM = [5.225, 6.79]
mirrorH = "trenchRight"Parse path
parse_game_pack tries parse_game_pack_direct first and falls back to
parse_game_pack_probed, and both return the same value for the same text.
- The direct route decodes with the private
pack_tomlmodule, a reader for the plain subset packs use (single-segment tables, bare keys, unescaped strings, numbers, booleans, arrays). Anything outside that subset returnsNoneand thetomlcrate reads the text instead. Thetomlcrate fallback never changes the result. The testsagrees_with_the_toml_crate_on_edited_pack_textand the corpus tests at the end offield.rscompare both readers on every TOML underassets/fields/,tests/fixtures/planning/fields/andwebsite/public/examples/, plus spliced variants. - The decoded
RawGamePackV2hasdeny_unknown_fieldson the root,[field]and[[obstacles]], so a misspelled key is an error.[[terrain]]entries flatten and tolerate extra keys emitted by authoring tools. validate_v2converts raw tables intoGamePack. It checks the origin and symmetry spellings, requires positive finitelengthMandwidthM, parses each shape (parse_shape), checks bounds (check_shape_in_bounds), rejects duplicate ids, derives mirrored geometry and enforces the 64-entry limits.- The probed route reads
[meta]alone first, so a wrongversionreports its own error before strict-parse complaints about unknown fields.
A text containing schemaVersion is first tried as the internal legacy layout
(RawGamePack, validate), and if that parse fails, parsing continues with the public
format. The legacy layout exists for archived fixtures such as
tests/fixtures/planning/fields/rebuilt2026Legacy.toml and is not part of the
public format.
GamePack records a PackSource hash of the exact text. Plan-graph caches key
bakes on it, so a cache shared by two different packs never serves one pack’s bake
to the other, and two packs parsed from the same text share the hash and can share a
bake. Equality between packs compares content only.
Element buckets
| TOML array | Rust type | Planner meaning |
|---|---|---|
[[obstacles]] | Obstacle | Permanent structure, never drivable |
[[terrain]] | Terrain | Routed around unless a leg names it with .cross(id); at most 64 |
[[regions]] without effect | Zone | A label for containment and aim queries |
[[regions]] with effect = "avoid" | AvoidZone | Soft keep-out, in the default mask when enabled (default true); at most 64 |
GamePack::element_kind resolves an id to its bucket. The Composer uses that
answer, because .cross(id) needs terrain and zone containment needs a region.
Origin
origin is "alwaysBlue" (corner origin, x in [0, lengthM]) or
"fieldCenter" (x within lengthM/2 of zero). For alwaysBlue the mirror
pivot is fieldCenterM, defaulting to the field midpoint, and for fieldCenter it
is [0, 0]. The bundled packs are authored alwaysBlue, and robots must feed poses
in the pack’s frame. The WPILib year changes nothing about a pack’s coordinates.
Alliance, symmetry and ids
Elements default to alliance = "blue" (default_alliance_blue). A pack authors
the blue half and neutral elements, and the red half is derived at load time from
symmetry:
symmetry | Load-time derivation | Runtime pose flip |
|---|---|---|
rotational (default) | Red = blue rotated 180 degrees about the pivot | Same rotation |
mirror | Red = blue reflected across x = pivot.x; headings map to pi - theta | Same reflection |
none | Nothing derived; author both halves | Falls back to rotation, since a flip must land somewhere |
GamePack::mirror_point and GamePack::mirror_pose dispatch on the stored
SymmetryKind, so a flipped robot pose uses the same transform that built the
red elements. The free function mirror_point always rotates and is wrong for a
mirror pack, so callers holding a pack use the method.
Id rules, all enforced in validate_v2:
- A derived red element keeps its blue id. Ids are unique per
(id, alliance)within a bucket, sohubexists once per alliance. - An explicitly authored element on the opposite alliance with the same id suppresses the derived copy.
mirror = falseon a blue element skips derivation.mirror = trueis legal only on blue elements (check_mirror_requires_blue), because derivation runs blue -> red only.mirrorH = "otherId"adds a same-alliance copy reflected across the horizontal center line under the new id (same_alliance_shapes). It must name a non-empty, different id. The copy is then alliance-mirrored like any blue element.
Bindings expose the result through the pack-symmetry and pack-bucket FFI blocks in
ffi.rs. The cross-binding rules for mirrored headings are in
tests/fixtures/api/mirroredHeadings.json.
Registration
assets/fields/manifest.tsv has one tab-separated row per shipped game:
rebuilt-2026 REBUILT 2026
reefscape-2025 REEFSCAPE 2025
crescendo-2024 CRESCENDO 2024The columns are id, game name and four-digit game year. registry() in
tools/packs/sync-bundled-pack.py enforces:
- The id matches
[a-z][a-z0-9]*(-[a-z0-9]+)*. - No duplicate id and no empty name.
assets/fields/<id>.tomlexists.- No two ids map to the same enum name (
game-2026andgame2026both becomekGame2026). - At least one row.
Blank lines and lines starting with # are ignored. The game year in the manifest
drives latest resolution, and the [meta] year inside the TOML is informational.
Season defaults
assets/fields/DEFAULT maps artifact WPILib years to packs:
2026=rebuilt-2026
2027=latestA value is either a registered id or latest. latest resolves at build time to
the unique newest registered game whose year is no later than the artifact year.
A tie fails with ambiguous latest pack ... name an id in DEFAULT, and a year with
no eligible game fails too. The 2026 artifact is pinned to rebuilt-2026, and the 2027
artifact resolves latest, which is rebuilt-2026 until a 2027 game is registered.
test_adding_games_preserves_pinned_seasons_and_moves_latest checks that adding
games of any year, in any row order, leaves the pinned year alone and moves only
latest.
Gradle (java/build.gradle) and the editor (bundledRegistry.ts) repeat the
latest resolution in their own languages. The rules are the same in all three
places, so a change to them is a change in three files.
The sync tool
tools/packs/sync-bundled-pack.py reads the registry and writes:
| Output | Contents |
|---|---|
java/src/main/java/com/tempo/GamePacks.java | enum GamePacks with id(), gameName(), year(), fromId, and one static factory per pack (REBUILT_2026()) |
python/tempo/game_packs.py | class GamePacks(Enum); members are callable and return the loaded pack |
python/tempo/packs/<id>.toml, manifest.tsv, DEFAULT | Package-data copies; stale .toml copies are deleted |
python/tempo/_pack_defaults.py | DEFAULTS = {year: id}, already resolved |
cpp/include/tempo/GamePacks.h | class GamePacks with enum Id, all(), from_id, factories |
cpp/src/internal/BundledPacks.h | Each pack as a string literal, kDefaultPack selected by #if TEMPO_PACK_YEAR == <year>, and bundled_toml |
cpp/src/BundledPacks.cpp | GamePacks::from_id, GamePack::bundled, factory bodies |
cpp/include/tempo/packs/<Name>.h | Public tempo::packs::k<Name>Toml constants kept for source compatibility |
gui/web/src/features/packs/bundledData.ts | PACK_SOURCES, a raw import of each TOML |
Enum names follow the id, so reefscape-2025 becomes Java and Python
GamePacks.REEFSCAPE_2025 and C++ GamePacks::kReefscape2025. Every output is
tracked, so commit them with the registry change. No binding file is edited by hand.
Before writing any embedded copy, generated() asks git ls-files whether each
registered TOML is tracked and refuses with git add assets/fields/<id>.toml before generating embedded copies otherwise. This is the embed rule from
Fixtures applied to packs.
python3 tools/packs/sync-bundled-pack.py # write outputs
python3 tools/packs/sync-bundled-pack.py --check # exit 1 and list stale files
python3 -m unittest discover -s tools/packs -p 'test_bundled_packs.py'tools/packs/test_bundled_packs.py covers registry validation (duplicate ids, missing
sources, unsafe ids, colliding enum names), default resolution (unknown,
duplicate, empty and too-early years), generator output for a second game in every
binding, and that cpp_literal round-trips whitespace, quotes, backslashes,
non-ASCII text and line endings.
How each artifact bakes its default
Builds from a checkout run the sync tool first, then fix the default for its WPILib
year. A Python build from a source archive without tools/packs/sync-bundled-pack.py
(python/hatch_build.py checks for it) uses the package data synced earlier.
| Build | Year input | Where the default ends up |
|---|---|---|
| Java | -PwpilibYear=2026 or 2027 | copyDefaultPack copies every registered TOML and manifest.tsv into com/tempo/packs/ and writes the resolved id to com/tempo/packs/DEFAULT; BundledPackLoader.defaultPack() reads it |
| C++ | CMake TEMPO_WPILIB_YEAR (default 2026) | TEMPO_PACK_YEAR=${TEMPO_WPILIB_YEAR} selects detail::kDefaultPack in BundledPacks.h; Tempo::bundled_game_pack() returns it |
| Python | The installed RobotPy’s year, at runtime | Tempo.bundled_game_pack() reads DEFAULTS[year] from tempo/_pack_defaults.py, or the newest year’s without RobotPy |
| Editor | Fixed to 2026 | DEFAULT_BUNDLED_PACK = defaultBundledPack(2026) in bundledRegistry.ts |
Details per build:
- Java:
syncBundledPacks(anExectask) runs beforecompileJavaand before any 2027 source-generation task, so the 2027 translation sees the generated enum members. Gradle throws if the year’s default is unregistered orlatestis ambiguous. - C++:
cpp/CMakeLists.txtruns the sync tool at configure time and fails the configure on error.manifest.tsvandDEFAULTare configure dependencies, so editing either re-runs CMake. A year without aDEFAULTrow hits#error "No bundled game pack default for TEMPO_PACK_YEAR". - Python: one wheel serves every year in
SUPPORTED_YEARS(tempo/_wpilib_version.py), so the default follows the installed RobotPy’swpilibversion in a wheel and a source checkout alike. The wheel build checks that each supported year has a default and that every registered TOML is intempo/packs/, and fails otherwise. - Editor:
gui/web/vite.config.tsruns the sync tool when Vite loads its config, for dev and production builds alike.
Switching years in one build directory must refresh these outputs. Java’s
copyDefaultPack declares wpilibYear as an input, and CMake needs a reconfigure with
the new TEMPO_WPILIB_YEAR.
Choosing a pack on the robot
Tempo.configure picks the active pack in this order (Tempo.selectPack in Java,
Tempo.configure in python/tempo/tempo_facade.py, Tempo::configure in
cpp/src/Facade.cpp):
- A pack given to
TempoConfig.withGamePack(...). - In tests, a pack installed with
Tempo.useGamePackForTesting/use_game_pack_for_testing. tempo/game.tomlin the deploy directory.- The artifact’s bundled default.
Steps 3 and 4 are one function per binding: PackSelection.load
(java/src/main/java/com/tempo/PackSelection.java), load_active_pack
(python/tempo/_pack_selection.py) and detail::load_active_pack
(cpp/src/PackSelection.cpp).
| Binding | Deploy directory |
|---|---|
| Java | WPILib Filesystem.getDeployDirectory(); headless tests without WPILib natives use src/main/deploy under the working directory |
| C++ | wpilib::filesystem::GetDeployDirectory(); the WPILib-free build uses src/main/deploy under the working directory |
| Python | RobotPy’s deploy directory through _wpi_compat; without wpilib installed, deploy under the working directory |
Discovery rules, identical in all three:
- No
tempo/directory: bundled default. tempo/exists but is not a directory: error.- Immediate entries whose name ends in
.toml, compared case-insensitively, are candidates. Other files are ignored. - Zero candidates: bundled default.
game.tomlamong the candidates: it loads. Any others are ignored with one warning that lists them (ignoring extra game packs in deploy/tempo: ...). GradleRIO deploys withdeleteOldFiles = false, so a renamed or removed pack stays on the robot beside the new one, and refusing it would stop a robot whose project holds one file.- A lone candidate not named exactly
game.toml: it loads with a warning to rename it. - Several candidates and no
game.toml: error listing them (deploy/tempo holds several game packs and none is named game.toml (...)). - The candidate to load is not a regular file: error. Invalid TOML: error from the core, with no fallback to another candidate.
- Candidates are listed by the UTF-8 bytes of their file names, which is not Java’s
Stringorder for names outside the basic plane. Each warning prints once per process.
tests/fixtures/api/packSelection.json holds the shared cases, each with the pack
chosen, the error and the warning (Python prints them without the deleteOldFiles
sentences listed under gradleAdvice, since a RobotPy project has no build.gradle
and robotpy deploy replaces the deployed folder), run by
PackSelectionTest.java, python/tests/test_pack_selection.py and
cpp/tests/test_pack_selection.cpp. A named selection (GamePack.bundled(id) or a
GamePacks member) always loads its own TOML, whatever the artifact default.
The editor
gui/web/src/features/packs/ holds pack handling:
bundledRegistry.tsparsesmanifest.tsvandDEFAULT(raw Vite imports fromassets/fields/) together with the generatedbundledData.ts, and throws on a malformed row, a missing source or a duplicate id.presets.tsbuilds apreset-<id>document per registered pack. These are the default packs: stored packs that are edited, renamed and deleted like any other. Packs whose year has an entry inBUILTIN_FIELDS_BY_YEAR(images/fieldImages.ts: 2024, 2025 and 2026) start on that render with its corner calibration; other years start without a backdrop. The renders are PathPlanner’s, listed in Licenses and notices.packStore.tsseeds the defaults into empty storage and records the ids it has offered intempo.packs.defaults.v1(tempo-pack-defaults-v1.jsonon desktop). On load, a default missing from that list is added, so a new manifest row reaches existing storage once; a listed default that is gone was deleted and stays gone. Storage written before the list existed gets each missing default unless it holds no packs at all. A default counts as missing when no stored pack has its id and none has its shipped TOML. An unedited default (TOML equal topresetSource) is replaced when the shipped TOML changes; an edited one is left alone.preset-<DEFAULT_BUNDLED_PACK.id>is activated when no selection is persisted.getActivePackTomlreturnspackTomlForCore(toml).defaultPacks.tslists the missing defaults and restores them (restoreDefaultPacks, the Restore default packs button in the pack switch and on the empty Field screen). Restoring adds each missing default as shipped under itspreset-id and changes no stored pack.- A default reaches the robot the way any pack does: Copy to robot and Live update
write the active pack’s TOML to the deploy file, so an edited default deploys as
edited. Generated robot code names no
GamePacksmember. toml/forCore.tsconverts editor-only syntax before the core sees it. Inch keys (lengthIn,minIn, and the rest ofIN_KEY_FORintoml/units.ts) become metre keys and the editor metadata keysfieldImageandfieldImageCornersare removed. The core rejects both as unknown keys.PackCreator.tsx,PackImportModal.tsxandpackDoc.tscover authoring and import. The quick switch (app/QuickSwitch.tsx,PackSwitchActions.tsx) lists packs.
The desktop shell’s Code sync panel copies the active pack to the robot project
(deployPack.tsx with the Tauri commands read_deploy_pack and
write_deploy_pack in gui/desktop/src/code_sync.rs). The target is
src/main/deploy/tempo/game.toml for Java and C++ and deploy/tempo/game.toml
for RobotPy. Writing is manual and desktop-only. The write sends the contents read
at preview time and fails if the file changed since. A replaced file is backed up
under the app data directory, the project root is checked by guard_root, and
paths through symbolic links are refused.
Unregistered packs and test data
A TOML outside manifest.tsv is never a bundled pack in a robot artifact, even under
assets/fields/. Packs used as test data are kept elsewhere and the robot artifacts do
not embed them, and the editor’s guided course imports its own practice pack as text
(gui/web/src/tutorial/practiceWorkspace.ts):
| Location | Use |
|---|---|
tests/fixtures/planning/fields/ | Archived geometry for traces, terrain and simulator batteries; see its README.md |
website/public/examples/reefscape-2025.toml | The docs download, a copy of the registered assets/fields/reefscape-2025.toml served by the static site; website/scripts/content.test.mjs fails if the two differ by a byte |
gui/web/src/tutorial/practice-pack.toml | The guided course’s field, independent of the registry |
Many Rust, Java, Python, C++ and editor tests also read
assets/fields/rebuilt-2026.toml directly or through GamePacks.REBUILT_2026.
An edit to that file moves their geometry, so run the full suites after changing it.
The archived fixtures stay byte-for-byte unchanged when the bundled pack changes.
Adding a game
- Write
assets/fields/<id>.tomlwithversion = 1, anorigin, asymmetry, and the blue half of the field. Load it through any binding or the editor to catch parse errors early. git add assets/fields/<id>.toml. The sync tool refuses untracked sources.- Append
<id>\t<Game name>\t<year>toassets/fields/manifest.tsv. - Run
python3 tools/packs/sync-bundled-pack.py. Expect changes toGamePacks.java,game_packs.py,python/tempo/packs/(new TOML andmanifest.tsv),_pack_defaults.pyif alatestrow moved,GamePacks.h,BundledPacks.h,BundledPacks.cpp, a newcpp/include/tempo/packs/<Name>.h, andbundledData.ts. - Run
python3 tools/packs/sync-bundled-pack.py --checkandpython3 -m unittest discover -s tools/packs -p 'test_bundled_packs.py'. - Run the Python gate (
cd python && sh run-suites.sh).test_every_registered_pack_loads_and_plansinpython/tests/test_pack_selection.pyloads eachGamePacksmember, searches a bounded grid for a free short route and plans it through the native core. A pack that cannot load or plan fails. - Expect the API snapshots to change: a new factory in
java.txtandcpp.txt, and the new size ofall()incpp.txt, which the maintainers regenerate. - Run the Java, C++ and editor builds, which regenerate and compile the outputs.
- For a backdrop in the editor, add the image to
gui/web/public/fields/with its license notice and add its year and calibration toBUILTIN_FIELDS_BY_YEARinimages/fieldImages.ts. - Commit the TOML, the manifest row, every generated file and the API snapshots together.
Changing the season default
- Register the season’s game as above if it is not already in
manifest.tsv. - Edit the artifact year’s line in
assets/fields/DEFAULT, or leave alatestrow to follow the newest eligible game without an edit. - Run
python3 tools/packs/sync-bundled-pack.py._pack_defaults.py,python/tempo/packs/DEFAULTand thekDefaultPackbranches inBundledPacks.hchange. - Rebuild each supported artifact year: Java with
-PwpilibYear=2026and2027, C++ with eachTEMPO_WPILIB_YEAR, and the Python wheels once. - For the editor’s starting pack, change the year passed to
defaultBundledPackinbundledRegistry.ts. - Update docs that name the default:
website/src/content/docs/concepts/game-packs.mdx,website/src/content/docs/reference/api/game-pack.mdxandwebsite/src/content/docs/reference/api/configuration.mdxshowGamePacks.REBUILT_2026and state which years it serves.
A default change does not move the tutorial’s lesson geometry
(practice-pack.toml), the archived fixtures in tests/fixtures/planning/fields/,
or tests that name a pack explicitly.