Changes at runtime
An addon's asset ops of the kinds group, erp, db and lang don't rewrite the game's files: the build writes them to swofty/assets.json, and swofty_core applies them in memory while the game boots, so the game folder keeps its stock files.
This is the runtime route; Deliveries lists which kinds take it. You write the changes in op files, from an engine plugin, or from a launcher plugin's build hook.
An addon in full
{
"schema_version": 1,
"id": "example.runtime",
"name": "Runtime example",
"version": "1.0.0",
"author": "Your Name",
"compat": { "game": "f1_25" },
"operations": {
"assets": ["assets/runtime.json"]
}
}{
"schema_version": 1,
"ops": [
{ "op": "erp.put-resource",
"erp": "2025_asset_groups/ui_package/flow_boot.erp",
"resource": "eaid://ui_package/art/textures/press_start/ps_logo.tif.image",
"source": "erp/logo.erp" },
{ "op": "lang.set", "language": "*", "key": "lng_team_tor_hashtag", "value": "AlphaTauri" },
{ "op": "db.set", "select": "entrants.teams.team[_metadata_=toro_rosso_26]", "field": "display_name_code", "value": "AT" }
]
}Install and enable the addon, then build the profile to check what it planned:
swofty addons install example-runtime
swofty addons enable example.runtime
swofty buildThen start the game. swofty_core logs each change under [assets] in swofty/loader.log:
[assets] resources: overlay ERP swofty/assets/resources/0.erp prebuilt by the launcher (... bytes, 1 resource(s): 1 replaced, 0 added) for 1 target ERP(s): 2025_asset_groups/ui_package/flow_boot.erp
[assets] gamedb: 1 edit(s) in ...; addons loaded at the early stage
[assets] gamedb: 1 overwritten, 0 created, 0 retyped, 0 skipped; ... record(s) (class probes included)
[assets] lang: added 1 string(s) from swofty/assets/lang/all.lng for 'eng' at priority ... (Loc_Add_LangTable returned ...); lookup "lng_team_tor_hashtag" -> "AlphaTauri" (the mod table is searched first)Replace a texture
Put your new texture in an .erp archive in the addon, under the stock texture's resource name. erp.put-resource copies it over the stock resource:
{
"schema_version": 1,
"ops": [
{ "op": "erp.put-resource",
"erp": "2025_asset_groups/ui_package/flow_boot.erp",
"resource": "eaid://ui_package/art/textures/press_start/ps_logo.tif.image",
"source": "erp/logo.erp" }
]
}erpis the game archive that holds the resource. To list its resource names, runpython3 tools/erp.py <archive> '*'(Textures and models).sourceis the archive in your addon that holds the resource."as"gives it a different name in the game archive; if that name doesn't exist there, the resource is added.- The build puts your changed resources in an overlay archive under
swofty/assets/resources/and lists it inresource_erps. Every asset group that listsflow_boot.erpreads this overlay archive first. - Keep the stock resource's type, argument and fragment layout and sizes. If your resource changes them, the build leaves it out of the overlay and reports a warning.
erp.replace-resourceanderp.add-resourceuse the overlay archive too. Anerp.remove-resourcein the build rewrites the game archives instead.
[assets] resources: overlay ERP swofty/assets/resources/0.erp prebuilt by the launcher (... bytes, 1 resource(s): 1 replaced, 0 added) for 1 target ERP(s): 2025_asset_groups/ui_package/flow_boot.erpAdd or change strings
lang.set sets one string: "*" sets it in every language, and a code such as eng in just that language. lang.table loads a whole .lng file from your addon:
{
"schema_version": 1,
"ops": [
{ "op": "lang.set", "language": "*", "key": "lng_team_tor_hashtag", "value": "AlphaTauri" },
{ "op": "lang.set", "language": "eng", "key": "lng_example_hint", "value": "Runtime example loaded" },
{ "op": "lang.table", "language": "eng", "source": "lang/extra_eng.lng" }
]
}swofty_formats::lngwrites.lngfiles.- A key the game doesn't have is added, so a database field such as
name_loc_tagcan refer to it (In-game text). - The build merges every addon's strings into one table per language under
swofty/assets/lang/. When the game loads a language, the core adds that table after the stock table, and your strings win over the stock ones.
[assets] lang: added 2 string(s) from swofty/assets/lang/eng.lng for 'eng' at priority ... (Loc_Add_LangTable returned ...); lookup "lng_example_hint" -> "Runtime example loaded" (the mod table is searched first)Edit the database
Database ops take the form of database operations, with the db. prefix:
{
"schema_version": 1,
"ops": [
{ "op": "db.set", "select": "entrants.teams.team[_metadata_=toro_rosso_26]", "field": "display_name_code", "value": "AT" },
{ "op": "db.put-record", "key": "0xf01d03c7a1b2c3d4", "type": 0, "value": "01000000" }
]
}db.put-recordwrites one raw record by path or hash:typeis its tag andvalueits bytes in hex.- The build applies every op to a copy of the database, then writes each record that differs from stock to
db_editsand setsearly_stage. The game's database file stays stock. - The early stage loads your addons before the game builds its database, so the core applies every edit as the database loads.
- If your build removes records, writes a record of tag 10, 15 or 16, or writes one whose value is not text, it writes the database file instead and reports a warning.
[assets] gamedb: 2 overwritten, 0 created, 0 retyped, 0 skipped; ...Register an asset group
The engine loads content by asset group. group.register adds a group to its asset manifest, pointing at archives in the game folder:
{
"schema_version": 1,
"ops": [
{ "op": "file.put", "source": "erp/showcar.erp", "target": "2025_asset_groups/example_package/showcar.erp" },
{ "op": "group.register",
"group": "asset_groups/example_package/showcar.assetgroup",
"erp": "2025_asset_groups/example_package/showcar.erp" }
]
}file.putships the archive. Loose files are copied into the game folder at build, or served fromswofty/overlay/if your profile turns on the experimentalfilefeature.erpslists several archives,depsnames groups that must load first, andtemplatenames a stock group to copy settings from.- A car group in the
teams/folder of its template's package also gets the template's archives that sit right in thatteams/folder and thaterpsdoesn't list, after its own. The 2025 My Team cars read the shared car (teams/fom_car/) fromteams/common_fom.erp; every other car reads its shared parts fromteams/common.erp. The core logs[assets] <group>: added <archive> from its template <template>for each one. - The core skips groups already in the stock manifest. If a database field points at a stock group whose archive is missing, the session load hangs.
- Database fields such as a track's
worldAssetGrouprefer to the group. Tracks use this route: each track's archive goes to2025_asset_groups/environment_package/tracks/<code>/<code>.erp, with one group per world, bake and probe set (How tracks are installed).
Driver heads
A file.put of 2025_asset_groups/animation_package/scenes/cinematics/drivers/heads/<label>.erp adds a driver head when no entrants.animation.driver_heads.driver_head row has the label <label>, in the stock database or from an addon's add-row:
{
"schema_version": 1,
"ops": [
{ "op": "file.put", "source": "heads/my_driver.erp",
"target": "2025_asset_groups/animation_package/scenes/cinematics/drivers/heads/my_driver.erp" },
{ "op": "file.put", "source": "heads/my_driver_malerig.erp",
"target": "2025_asset_groups/animation_package/scenes/cinematics/drivers/heads/my_driver_malerig.erp" }
]
}The build then adds, with your addon as the origin:
- an
add-rowcopied frommale_ls222, or fromfemale_ls112for a female head, that sets_metadata_to<label>,model_pathandmodel_path_female_rigfrom the head model in your archive,has_morph_datato whether you putmorph_poses/<label>.erp,available_for_customisationtoFalse, and a newstat_id; - a
group.registerfor each archive you put amongheads/<label>.erp,heads/<label>_malerig.erp,morph_poses/<label>.erpandmorph_poses/<label>_malerig.erp, withlando_norris's groups as templates, orfemale_ls493's for a female head.
Rules:
- A head is female when its model sits under
heads/female_*or you putheads/<label>_malerig.erp. The male-rig archive's model becomesmodel_path; without one,model_pathis empty. - An archive without a head model gets no row, and the build warns.
- Add your own row with
add-rowto set other values. The build then adds no row and no groups for that head. - A driver or character whose
headan addon changes to a label with no driver head row keeps the game's head, and the build names the addon in a warning. - From launcher 1.5.12, helpers list the heads the profile's addons put with the
profile_headshost call (Profile heads).
From an engine plugin
An engine plugin adds the same entries at plugin init with swofty/assets.hpp. File paths are files in your addon's folder, swofty/addons/<id>/:
#include <swofty/assets.hpp>
#include <swofty/mixin.hpp>
namespace assets = swofty::assets;
SWOFTY_ON_LOAD
{
std::string_view erps[] = {"2025_asset_groups/ui_package/flow_boot.erp"};
assets::Fragment logo[] = {{"files/ps_logo.bin"}}; // fourcc and flags left empty: the stock resource's values
assets::put_resource("eaid://ui_package/art/textures/press_start/ps_logo.tif.image", logo, erps);
assets::lang_set("*", "lng_team_tor_hashtag", "AlphaTauri");
if (assets::db_set("0xf01d03c7a1b2c3d4", "int", "1") == assets::Result::late)
swofty::log("[livery] the database was already built");
}
SWOFTY_ADDON()"operations": {
"native": [{ "dll": "native/livery.dll", "early": true, "files": ["files/"] }]
}"early": trueloads your plugin before the game database, sodb_setapplies. Without it, your plugin loads at the window trigger anddb_setreturnslate.fileshas the build copy the files the calls name intoswofty/addons/<id>/.- Check each call's result:
ok,late,unavailableorinvalid.swofty/loader.logalso has one[assets] api:line per call:
[assets] api: example.livery (livery.dll) lang_set * lng_team_tor_hashtag -> ok
[assets] api: example.livery (livery.dll) db_set 0xf01d03c7a1b2c3d4 = 1 -> late: the core loaded at the window stage, after the game database loadedAsset API has every call and when each one is accepted.
From a build hook
A launcher plugin's build reply, or Addon::build in a built-in addon, returns the same ops. They run after your addon's declared ops and take the same routes.
Team Simplified merges .serps mods this way. For each enabled mod, it returns db.put-record, db.remove-record, erp.put-resource, erp.remove-resource and lang.set, with sources in its data root:
{ "op": "erp.put-resource", "erp": "2025_asset_groups/...", "resource": "eaid://...",
"source": { "root": "data", "path": "library/my-mod/files/car.erp" } }Reference
- Asset API: every op kind, sources, deliveries, order and conflicts, and the native calls.
- Operations: every
operationsfield and the route each one takes. - Database operations: the selector and value forms that
db.*ops share. - How tracks are installed: a track delivered through asset groups and database edits.