Build and install a mod
A build turns your project into package files and patches. An install puts them, with your scripts, into a Sunrise mod folder. Mods explains how Sunrise loads it.
Set the mod details
An install needs mod details. If they are missing, Studio opens this dialog for you.
- Choose Build > Mod details….
- Fill the fields.
- Press Save.
| field | holds |
|---|---|
| Id | a lowercase reverse-domain id, such as dev.example.mod |
| Version | MAJOR.MINOR.PATCH, such as 1.0.0 |
| Name | the name on the Mods page |
| Description | optional text |
| Authors, one per line | optional names |
| Source URL | optional link |
| Dependencies | Add dependency, then the mod id, Minimum and optional Maximum version |
| Incompatible mod ids, one per line | mods that cannot load with this one |
| Cheat | loading this mod stops the player’s progress from being saved that session |
| Config | Add config entry, then Key, Type, Default and Name |
Problems show in the dialog. Save stays disabled until they are fixed. mod.json has the rules for every field.
Build packages
- Choose Build > Build packages, press Build packages in the toolbar, or press
Ctrl+Shift+B.
The build runs in the background. The status bar shows the stage and a progress bar, then the result
with an Open folder button. Each build goes into a new folder, named by date and time, inside the
project’s build folder. A build never writes into the installation.
To build somewhere else, choose Build > Build to folder… and pick an empty folder outside the installation.
The Build tab of Project changes lists the packages written and the object edits compiled.
Open output folder opens the build folder. Each build also writes a receipt that lists the files,
the new tags, the packages it needs, the dependency and manifest edits, and the merge data files.
Each package except a startup replacement gets a .merge file beside it, so Sunrise can merge it
with other mods that patch the same package.
How a build works explains them.
Build and install
- Close the game.
- Choose Build > Build and install.
Studio checks the mod details, builds the project, and installs it in
bin/x64/Sunrise/mods/<mod id>. New packages go to packages, patches of installed packages go to
patches, and scripts and SDK modules go to scripts and sdk. Each .merge file goes beside its
package. An install replaces the whole mod folder. When it is done, the status bar says Mod
installed. Restart the game to load it.
If the Mission Graph has unsaved changes, Studio asks to save them first. If the game holds the mod’s files, the install fails. Close the game and install again.
Update a running game
Update running game sends changed scripts and changed package data to a game that is already running. It does not need Attach on the Live tab.
Before the first update:
- Install the mod with Build and install. A mod installed by an older Studio has no live state; install it once more.
- In the game’s
settings.json, setstudio_attachtotrue. See Connect to a running game. - Start the game.
To update, save your mission scripts, then choose Build > Update running game. Or turn on Live on the Live tab; see Connect to a running game.
Studio builds the project and compares it with what the installed mod serves.
- Changed package entries go into a new package file beside the earlier ones. The game loads it and answers for each changed tag. Updating a running game has the detail.
- Changed script files are replaced and deleted scripts removed. The game swaps the scripts when each mission reaches a safe point. Studio waits up to 30 seconds.
The status bar shows the game’s answer. The Live tab lists each changed tag and its result:
| result | meaning |
|---|---|
| applied, tier 1 | Sunrise uses the new data now: spawn tables, scenario layouts and vendors |
| applied, tier 2 | the game wrote the new values into the copy it holds in memory |
| next spawn | the same, for data the game reads when something spawns |
| need Reload bubble | the game writes the new values into the tag the next time it loads it |
| need a restart | the client loads this change only at startup; see below |
| changed in the game | the game holds other bytes than Studio expected, so it wrote nothing |
| refused | the game could not load the new files, or the patch does not fit; the old data stays |
Studio sends a patch when every changed byte is a number and the tag keeps its size. A reference, a count or a changed size is never patched; it needs a restart.
The game writes a patch into the tag each time it loads the tag, until it restarts. It also writes the patch into the copy it holds now (tier 2) when every changed number is in a part of a tag marked safe to patch. Damage scales, light rows, effect emitters, static transforms, placements and material techniques are marked. Whether each marked kind shows its change at once is unverified.
Update running game writes nothing and asks for Build and install when any of these changed:
mod.json;- an SDK module;
activity_sdk.pack, which holds the activity SDK rows of the project’s destinations;- whether the mod has a
scriptsfolder; - a new package, a new entry in a package, or a package the project no longer builds;
- a dependency record.
If a script does not compile, the old scripts keep running. A mission that is not bound or not started yet needs an activity restart. This step is unverified end to end with Studio.
Reload bubble
Reload bubble on the Live tab shows a change that says need Reload bubble. The game does one of two things, and the status bar shows its reply.
| reply | what the game did | when |
|---|---|---|
| The game is loading region N again | wrote the kept patches into the tags it holds, moved the player to the region’s spawn and built the region again | a private session, and the game holds the tag of every kept patch |
| The next launch lands in bubble N | stored the player’s current bubble as a forced destination | any other case |
After the second reply, leave the world, by going to orbit or by Change Character in the game menu, then launch again. Afterwards press Clear active override in Sunrise’s mission launch panel.
The game reads a placed static and an entity placement once, when the destination loads. In game, a moved static and a moved entity get the second reply. The new launch shows a static moved in a project destination in its new place.
A change that says need a restart shows only after a game restart. The client reads its package list once, at startup.
Build and install and Update running game have no default keys. Set them in Shortcuts and presets.
Limits
- Edits and config bindings on startup
_unp1_packages cannot be installed. Build packages still builds the edits, as full replacements. - New packages need an ID from
0100to0CFF. See Package IDs. - A project with no package edits, scripts or SDK modules has nothing to install.
- Update running game and Reload bubble need exactly one game running from your installation. Update running game also needs the mod installed once with Build and install.