Tutorial 0: Inspecting In and Out of the Game - rspforhp/WildfrostModdingDocumentation GitHub Wiki
By Michael Coopman
Click here to toggle
Welcome prospective modders! This first part is intended for those who know the basics of coding and not much else. Ideally, you should have completed the Basic project setup. The latter parts require no coding experience and maybe be useful even if you are not planning to mod. The goal of this tutorial is to highlight ways of understanding the source code of the game. In particular, this tutorial will explain the basics of
- Object Browser: Used to read the source code of the game.
- Unity Explorer Mod: Used to explore Unity scenes while in-game, including implementation of cards, events, etc.
- Another Console Mod: Allows access to the command prompt for quick testing and searching.
All three are essential to modding the game well. There are a few others that are important to acquire but not explained in detail. They can be found in this Steam collection.
In the "GameRoot/Modded/Wildfrost_Data/Managed" folder, there is a file named Assembly-CSharp that should have been added to your references. This file contains the bulk of the code intended for Wildfrost. In the solution explorer, right-click Assembly-CSharp (se left picture) and click on "View in Object Browser" to view (see right picture). You should probably pin this Object Browser to make it quickly accessible.
Left-clicking on any class gives a summary of its fields and methods. Double-clicking takes you directly to the code. Most of the intricacies of the game can be found here; however, the code files only give a partial picture of how the game works. You cannot see how these classes work together in a Unity Scene. For example, opening CardData or StatusEffectData gives you what these classes can do, but it does not show you how the game implements them. For this, we move to the Unity Explorer mod. Before we move on, here is a partial list of some noteworthy classes.
Contains all events maintained by the game. For any mod beyond adding new units, charms, items, etc, knowing what events are available is helpful. More on this in the next tutorial.
Contains references to some important singleton objects. For example, getting to the player's deck would References.PlayerData.inventory.deck. So, adding a card, say Junk, to your deck would be References.PlayerData.inventory.deck.Add(Get<CardData>("Junk").Clone()).
The campaign node is what you see on the map. The EventRoutine is what happens after you click on the node.
CardData is the raw information, Entity is the logic of CardData, and Card is the appearance.
Implementation of status effects. Quite complex and varied. More on this in a future tutorial.
Unity Explorer Mod (credits to Kopie/Miya) [Link]
Go to the workshop and subscribe to the Unity explorer mod. (Note that the home page may not show anything. Go to Browse -> Items to find all of the mods).

Once you have subscribed to the mod, simply load up Wildfrost with mods. In the main menu, click the mods button and turn on the Unity Explorer mod. After waiting a few moments until the bell is lit, you will see something like this.

This explorer allows you to inspect what is currently happening in the game. Some noteworthy places to explore are:
Anytime in the game, you can find an instance of the AddressableLoader class by the following sequence of links Object Explorer -> Scene: Global -> AssetLoader -> AddressableLoader.

The AddressableLoader class deals with loading and unloading assets. In the IDE, you cannot see the assets it deals with. In the Unity Explorer, you can. By clicking the drop-down on "groups" and inspecting one of the groups shows you all the available assets of the category. Inspecting the CardData will give you a list of all the cards in the game.
Note that the list (not shown) is organized by the internal names of cards, which may not follow their displayed title ( Bear = Scaven, BerryPet = Booshu). If you ever wonder how a card is implemented using the CardData class, simply find its internal name on this list and inspect it. All properties, fields, and methods are there to be seen and changed (changes are not persistent between sessions). Try to do the same thing for StatusEffectData and CardUpgradeData as well.
Note
The Another Console mod now has a streamlined command for this: Inspect <DataFile> <name>. So, for example, reaching the page on Scaven (Bear) requires the command Inspect CardData Bear. Note that commands cannot be typed unless the Unity Explorer is hidden. More on this in the Another Console Mod section. Using the command is a much better way; the above section is kept only as an example on how to traverse a Unity Scene.
In the middle of a battle, you can inspect the cards on the field (Scene: Battle) or in your hand (Scene: UI). You could go to one of these scenes with the object explorer and navigate a long series of drop-downs until you find the desired cards, or you could use the UI option in the Inspector, click on a card, select NameTag (there are other similar choices), and click "View Parent" until you reach the card itself. Remember that Entity holds the logic while Card holds the graphics.

Note
The Another Console mod also streamlined this action: Simply hover over the card you want to inspect and type the command Inspect this. More on this in the next section.
Another Console Mod (credits to Hopeless/Hopeful) [Link]
If you have not already, go back to the workshop and subscribe to the Another Console mod. It is an invaluable tool for testing stuff in-game.
This mod gives you access to the command line by pressing "~". There are various useful commands for testing out mods such as skipping battles, gaining cards, or adding effects. Type help in the command line for more details. Note: While the Unity explorer is active, you cannot type in the command line. The solution is to simply close the Unity explorer through the red "F7" box. Turning it back on requires clicking the F7 key. This may cause an error message, but it is harmless (click "Oh No!"). The error can be prevented by remapping the Unite Explorer button to a different key.
One of the many useful features of Another Console Mod is the command to generate code for an existing card/effects in the style of the builders. Although you will not be writing code for existing cards/effects, seeing how they can be written will help you understand how the builder framework is used.


Below is a partial list of useful commands:
-
Add Effect <name> <amount>,Add Status <name> <amount>,Add Trait <name> <amount>,Add Upgrade <name> <amount>: If you are hovering over a card in battle, these commands will give the card the desired effect/status/trait/upgrade. -
Battle Win: Wins the battle. -
DataBuilder of <DataType> <name>: Creates working code on how to implement the card/effet/charm in question. This is useful for understanding -
Gain Card <name>: Places that card into you deckpack. If you are in a battle, it will also place the card into your hand. -
Gain Upgrade <name>: Places that crown/charm into your deckpack. -
Inspect <DataFile> <name>,Inspect this: Opens the Unity Explorer onto the data file in the master list or the Entity component of the hovered card. -
Kill/Kill All: Kills the hovered card or all enemy cards. -
Map Jump: Jump to a node on the map, skipping everything in between. -
Reroll: In an event, this command rerolls the current card choices in front of you. -
Spawn <name>: If you are hovering over an empty spot on the board, creates that card and places it into that empty spot.
There is a reference spreadsheet with as much data about the base game as can be fit. It can be found here or on the Vanilla References page.
Console Mod (credits to Kopie/Miya) [Link]
The console mod opens the console. Any code along the lines of Debug.Log() will output messages in the console. This is useful for debugging your own mod, but it can also clue you in on what else is happening internally (can you spot when the campaign battles are determined?). Recent logs are saved somewhere in the AppData/LocalLow/Deadpan Games/Wildfrost folder.
Mod Uploader (credits to Hopeless/Hopeful) [Link]
The Mod Uploader allows you to add tags to your mod when you publish it. Using some of the standard tags makes your mod more easily discoverable. See the next tutorial for how to publish a mod.


