Skip to content

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 toolRole
assets/fields/<id>.tomlA bundled pack, one per registered game
assets/fields/manifest.tsvThe registry: which ids ship, with game name and year
assets/fields/DEFAULTWhich registered id each artifact WPILib year loads by default
tools/packs/sync-bundled-pack.pyGenerates enum identities and embedded copies for Java, Python, C++ and the editor
tools/packs/test_bundled_packs.pyUnit tests for the registry rules and the generator
rust/core/src/field.rsparse_game_pack, the only parser; every binding and the wasm build call it
website/src/content/docs/reference/formats/game-pack-toml.mdxThe 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.

TOML
[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.

  1. The direct route decodes with the private pack_toml module, a reader for the plain subset packs use (single-segment tables, bare keys, unescaped strings, numbers, booleans, arrays). Anything outside that subset returns None and the toml crate reads the text instead. The toml crate fallback never changes the result. The tests agrees_with_the_toml_crate_on_edited_pack_text and the corpus tests at the end of field.rs compare both readers on every TOML under assets/fields/, tests/fixtures/planning/fields/ and website/public/examples/, plus spliced variants.
  2. The decoded RawGamePackV2 has deny_unknown_fields on the root, [field] and [[obstacles]], so a misspelled key is an error. [[terrain]] entries flatten and tolerate extra keys emitted by authoring tools.
  3. validate_v2 converts raw tables into GamePack. It checks the origin and symmetry spellings, requires positive finite lengthM and widthM, parses each shape (parse_shape), checks bounds (check_shape_in_bounds), rejects duplicate ids, derives mirrored geometry and enforces the 64-entry limits.
  4. The probed route reads [meta] alone first, so a wrong version reports 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 arrayRust typePlanner meaning
[[obstacles]]ObstaclePermanent structure, never drivable
[[terrain]]TerrainRouted around unless a leg names it with .cross(id); at most 64
[[regions]] without effectZoneA label for containment and aim queries
[[regions]] with effect = "avoid"AvoidZoneSoft 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:

symmetryLoad-time derivationRuntime pose flip
rotational (default)Red = blue rotated 180 degrees about the pivotSame rotation
mirrorRed = blue reflected across x = pivot.x; headings map to pi - thetaSame reflection
noneNothing derived; author both halvesFalls 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, so hub exists once per alliance.
  • An explicitly authored element on the opposite alliance with the same id suppresses the derived copy.
  • mirror = false on a blue element skips derivation. mirror = true is 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	2024

The 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>.toml exists.
  • No two ids map to the same enum name (game-2026 and game2026 both become kGame2026).
  • 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=latest

A 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:

OutputContents
java/src/main/java/com/tempo/GamePacks.javaenum GamePacks with id(), gameName(), year(), fromId, and one static factory per pack (REBUILT_2026())
python/tempo/game_packs.pyclass GamePacks(Enum); members are callable and return the loaded pack
python/tempo/packs/<id>.toml, manifest.tsv, DEFAULTPackage-data copies; stale .toml copies are deleted
python/tempo/_pack_defaults.pyDEFAULTS = {year: id}, already resolved
cpp/include/tempo/GamePacks.hclass GamePacks with enum Id, all(), from_id, factories
cpp/src/internal/BundledPacks.hEach pack as a string literal, kDefaultPack selected by #if TEMPO_PACK_YEAR == <year>, and bundled_toml
cpp/src/BundledPacks.cppGamePacks::from_id, GamePack::bundled, factory bodies
cpp/include/tempo/packs/<Name>.hPublic tempo::packs::k<Name>Toml constants kept for source compatibility
gui/web/src/features/packs/bundledData.tsPACK_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.

Shell
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.

BuildYear inputWhere the default ends up
Java-PwpilibYear=2026 or 2027copyDefaultPack 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
PythonThe installed RobotPy’s year, at runtimeTempo.bundled_game_pack() reads DEFAULTS[year] from tempo/_pack_defaults.py, or the newest year’s without RobotPy
EditorFixed to 2026DEFAULT_BUNDLED_PACK = defaultBundledPack(2026) in bundledRegistry.ts

Details per build:

  • Java: syncBundledPacks (an Exec task) runs before compileJava and before any 2027 source-generation task, so the 2027 translation sees the generated enum members. Gradle throws if the year’s default is unregistered or latest is ambiguous.
  • C++: cpp/CMakeLists.txt runs the sync tool at configure time and fails the configure on error. manifest.tsv and DEFAULT are configure dependencies, so editing either re-runs CMake. A year without a DEFAULT row 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’s wpilib version 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 in tempo/packs/, and fails otherwise.
  • Editor: gui/web/vite.config.ts runs 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):

  1. A pack given to TempoConfig.withGamePack(...).
  2. In tests, a pack installed with Tempo.useGamePackForTesting / use_game_pack_for_testing.
  3. tempo/game.toml in the deploy directory.
  4. 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).

BindingDeploy directory
JavaWPILib 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
PythonRobotPy’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.toml among the candidates: it loads. Any others are ignored with one warning that lists them (ignoring extra game packs in deploy/tempo: ...). GradleRIO deploys with deleteOldFiles = 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 String order 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.ts parses manifest.tsv and DEFAULT (raw Vite imports from assets/fields/) together with the generated bundledData.ts, and throws on a malformed row, a missing source or a duplicate id.
  • presets.ts builds a preset-<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 in BUILTIN_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.ts seeds the defaults into empty storage and records the ids it has offered in tempo.packs.defaults.v1 (tempo-pack-defaults-v1.json on 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 to presetSource) 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. getActivePackToml returns packTomlForCore(toml).
  • defaultPacks.ts lists 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 its preset- 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 GamePacks member.
  • toml/forCore.ts converts editor-only syntax before the core sees it. Inch keys (lengthIn, minIn, and the rest of IN_KEY_FOR in toml/units.ts) become metre keys and the editor metadata keys fieldImage and fieldImageCorners are removed. The core rejects both as unknown keys.
  • PackCreator.tsx, PackImportModal.tsx and packDoc.ts cover 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):

LocationUse
tests/fixtures/planning/fields/Archived geometry for traces, terrain and simulator batteries; see its README.md
website/public/examples/reefscape-2025.tomlThe 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.tomlThe 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

  1. Write assets/fields/<id>.toml with version = 1, an origin, a symmetry, and the blue half of the field. Load it through any binding or the editor to catch parse errors early.
  2. git add assets/fields/<id>.toml. The sync tool refuses untracked sources.
  3. Append <id>\t<Game name>\t<year> to assets/fields/manifest.tsv.
  4. Run python3 tools/packs/sync-bundled-pack.py. Expect changes to GamePacks.java, game_packs.py, python/tempo/packs/ (new TOML and manifest.tsv), _pack_defaults.py if a latest row moved, GamePacks.h, BundledPacks.h, BundledPacks.cpp, a new cpp/include/tempo/packs/<Name>.h, and bundledData.ts.
  5. Run python3 tools/packs/sync-bundled-pack.py --check and python3 -m unittest discover -s tools/packs -p 'test_bundled_packs.py'.
  6. Run the Python gate (cd python && sh run-suites.sh). test_every_registered_pack_loads_and_plans in python/tests/test_pack_selection.py loads each GamePacks member, searches a bounded grid for a free short route and plans it through the native core. A pack that cannot load or plan fails.
  7. Expect the API snapshots to change: a new factory in java.txt and cpp.txt, and the new size of all() in cpp.txt, which the maintainers regenerate.
  8. Run the Java, C++ and editor builds, which regenerate and compile the outputs.
  9. For a backdrop in the editor, add the image to gui/web/public/fields/ with its license notice and add its year and calibration to BUILTIN_FIELDS_BY_YEAR in images/fieldImages.ts.
  10. Commit the TOML, the manifest row, every generated file and the API snapshots together.

Changing the season default

  1. Register the season’s game as above if it is not already in manifest.tsv.
  2. Edit the artifact year’s line in assets/fields/DEFAULT, or leave a latest row to follow the newest eligible game without an edit.
  3. Run python3 tools/packs/sync-bundled-pack.py. _pack_defaults.py, python/tempo/packs/DEFAULT and the kDefaultPack branches in BundledPacks.h change.
  4. Rebuild each supported artifact year: Java with -PwpilibYear=2026 and 2027, C++ with each TEMPO_WPILIB_YEAR, and the Python wheels once.
  5. For the editor’s starting pack, change the year passed to defaultBundledPack in bundledRegistry.ts.
  6. Update docs that name the default: website/src/content/docs/concepts/game-packs.mdx, website/src/content/docs/reference/api/game-pack.mdx and website/src/content/docs/reference/api/configuration.mdx show GamePacks.REBUILT_2026 and 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.

esc

Loading search...