Skip to content

Testing and Debugging

modargo edited this page Apr 17, 2026 · 9 revisions

Using the dev console

With mods enabled, you can open/close the dev console by pressing any of ~, `, *, ', or Shift+8. In the dev console, type help to see the list of commands, or help commandname to see help for a specific command (e.g. help card).

The dev console allows you to quickly test most types of content by immediately spawning it and has a variety of other useful commands too.

Reading the game logs

If the game crashes, freezes, hangs, or otherwise behaves strangely while testing your mod, you should check the game's logs for any errors.

If you're developing a mod, it's useful to be able to look at the logs immediately when things go wrong. While on the main menu of the game, go to Mod Configurations -> BaseLib and check "Open log window on startup". This makes the log window open automatically whenever you run the game.

Alternatively, you can run the showlog command in the dev console. This immediately opens the log window, and it will stay open until you quit the game, but you will need to run the command again to reopen the log window after restarting.

Logs are also saved to a file. If the game is still open, you can run open logs in the dev console to open your file explorer at the logs directory. Otherwise, you can navigate there yourself. It will normally be at one of the following locations:

  • Windows: %appdata%/SlayTheSpire2/logs
  • MacOS: ~/Library/Application Support/SlayTheSpire2/logs
  • Linux: ~/.local/share/SlayTheSpire2/logs

godot.log in this directory contains the most recent logs.

Once you can see the logs, you should check for any lines that mention errors. They will usually reference something in your mod, although not always.

You can refer to this guide on Reading a stack trace to try and understand stack traces of errors you find.

Logging your own information

If you want your mod to add information to the log file, you can do this using the Logger field in your MainFile (the template comes with this by default), e.g. MainFile.Logger.Info("Some useful information."). This can be helpful if you have complex or error-prone code; logging details of the steps your code is taking can help narrow down issues.

Testing Multiplayer Locally

Initial Setup

Create a file named steam_appid.txt in your sts2 directory with the contents 2868840. This allows launching the game without going through Steam.

Launching Instances

  • Host: Launch the game with the -fastmp host_standard command line argument.

  • Client: Launch the game with the -fastmp join argument. After a brief delay, it will join your other game.

Testing with 3+ Players

To test with more than 2 players, you will additionally need to pass the -clientId argument for the additional clients. The default clientId is 1000. For example, to have a 3rd player join use the arguments -fastmp join -clientId 1001. and -clientId 1002 for the 4th player.

Scripting

Below are example scripts that run the number of instances specified as a command line argument. You'll most likely have to adjust the path to the sts2 executable.

Windows

setlocal enabledelayedexpansion

start "" "SlayTheSpire2.exe" -fastmp host_standard

set /A NUM_CLIENTS=%1-2

for /L %%i in (0,1,!NUM_CLIENTS!) do (
    set /A CID=1000+%%i
    start "" "SlayTheSpire2.exe" -fastmp join -clientId !CID!
)

Linux/Mac

#!/usr/bin/env bash

./SlayTheSpire2 -fastmp host_standard &

for ((i=0; i<($1-1); i++)); do
    cid=$((1000 + i))
    ./SlayTheSpire2 -fastmp join -clientId "$cid" &
done

wait

Attaching a Debugger

Initial Setup

Create a file named steam_appid.txt in your sts2 directory with the contents 2868840. This allows launching the game without going through Steam.

Copying the pdb

In order for breakpoints to work correctly, you need to copy the pdb to the folder where your mod's dll is. You can do it manually, or add the following to the end of your CopyToModsFolderOnBuild Target in your .csproj (assuming you're using the ModTemplate)

<Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="$(ModsPath)$(MSBuildProjectName)/" />

Creating a Launch Profile

In Rider, go to Run / Debug Configuration > Edit Configurations. Click Add New Configuration (+) > .Net Executable, and fill out the Executable and Working Directory. Then click OK.

Visual Studio

In Visual Studio, go to Menu > Debug > Debug Properties and fill out the Executable and Working Directory.

Launching the Game

At this point, you should be able to launch sts2 from the configuration you've created.

Enabling External Source Debugging

This will allow you to step into code from other mods or sts2 itself.

In Rider, go to Settings > Build, Execution, Deployment > Debugger > .Net Languages, and enable Enable external source debug

Visual Studio

In Visual Studio, go into Menu > Tools > Options > Debugging > General, and Disable Enable Just My Code

Clone this wiki locally