< Back

Slay the Spire 2 Mods

The modded main menu, displaying Singleplayer as an option even though there is a current run saved (indicated by the "Abandon Run" button)

The modded multiplayer main menu, similarly showing Host as an option with a current multiplayer run saved

The modded singleplayer continue menu

The modded singleplayer abandon menu

The modded multiplayer continue menu

Languages: C#

Technologies: Godot, Harmony, BepinEx

Skills: Reverse Engineering

Overview

More Saves

I found it frustrating that Slay the Spire 2 did not allow for multiple concurrent multiplayer save files, as it’s extremely inconvenient when trying to play with different friend groups, so I implemented this mod to solve that issue!

Fix Modded Profile Sync

Upon receiving feedback from a player that their saves were not transferring between devices, despite verifying that More Saves was interacting correctly with the steam cloud, I discovered that there was a race condition between Slay the Spire 2 loading mods and syncing its cloud saves. This mod fixed that issue, and I also reported it to the developers who fixed it in the next patch.

Technical Details

More Saves

Code Structure

All patches are located in /Patches/SavePathPatch.cs. The backend functionality is in RunSaveManagerPatch and SaveManagerPatch, while the other patches hook into the UI. /Screens/ contains the code which produces the new UI elements.

Save Path Modification

Slay the Spire 2’s run saving functionality uses semi-hard-coded paths - they use static string properties, which by default refer to /<profile>/saves/current_run.save/ and /<profile>/saves/current_run_mp.save/. To allow for multiple simultaneous saves I hook into these string properties and redirect them to /<profile>/saves/MoreSaves/<run>.spsave (or .mpsave for multiplayer runs), where <run> is determined by properties of the run.

These properties are serialized when a run is created, continued or abandoned, and then the default in-game functionality is used - allowing STS2’s internal serialization to entirely change without breaking the mod (as long as it still uses the static string properties, which seems likely to persist unless the devs implement their own multi-save functionality).

STS2’s progression capabilities are already resilient to issues created by different runs completing at different times, since this functionality is already required by the ability to have separate singleplayer and multiplayer runs.

UI

To keep the UI consistent with the base game I use the multiplayer join menu as a base for my new sub-screens. NewBaseScreen.cs handles stripping the base interactions and also provides common functionality, while the other files in /Screens/ implement the sub-screen specific behaviour.

Fix Modded Profile Sync

The game uploaded modded profiles to the steam cloud as expected. Steam cloud data was downloaded once, upon the game launch. However, the startup logic began syncing the local and cloud files before the function call which set the IsRunningModded flag. Because of this, modded profiles were very unlikely to have their data properly downloaded and synced, as the IsRunningModded flag is used to determine profile paths (specifically, whether ‘modded/’ should be appended).

The mod used a patch on LaunchMainMenu, checking whether the IsRunningModded flag was set. If not, the patch did nothing, but if it was it forced the cloud to be synced again.