Pins - WittleWolfie/OwlcatModdingWiki GitHub Wiki

Pins

This wiki page contains a compilation of resources and tools shared in the mod-dev-technical channel of the Owlcat Games Discord. See Modding Resources for more resources.

Modding Starter Guide (Wolfie)

OwlcatNuGetTemplates (ADDB)

  • Description: NuGet templates for UnityModManager mods. Allows creating modding projects in one command. For KM, Wrath and RT.
  • Link: OwlcatNuGetTemplates

Modding Tools

Open

WW-Blueprint-Core (Wolfie)

BubblePrints (bubbles)

CinematicUnityExplorer v1.2.0 for WOTR, RT, and KM (hambeard)

  • Description: Compatible version of UnityExplorer with untested improvements for KM, Wrath and RT.
  • Link: GitHub Releases

SpriteGallery.Avalonia (Microsoftenator)

  • Description: A completed version of SpriteGallery with all features of the original.
  • Link: SpriteGallery.Avalonia

AssetStudio (Kurufinve)

  • Description: Working fork of AssetStudio, a tool that lets you inspect and dump Unity Bundle contents
  • Link: GitHub

Unity2Debug (hambeard)

BlueprintPurge (Fumihiko)

  • Description: Tool for removing blueprints/guids from save files. Wrath only I think...
  • Link: BlueprintPurge v0.5.0

Kingmaker DataViewer (Spacehamster)

dnSpy Debug Mono Runtime (Spacehamster)

  • Description: Debug mono runtime for dnSpy.
  • Link (Kingmaker): 2018.4.10
  • Link (Wrath): 2019.4.0

BubbleGauntlet-PRE (kadyn)

MewsifierConsole (Wolfie)

Resources and Tutorials

Open

Unity and Wwise versions (ADDB)

Repository containing decompiled RogueTrader code (ADDB)

Official Documentation for Modding Rogue Trader

Debugging with Unity Debugger (Narria)

  • Description: Instructions for debugging using Unity Debugger in Visual Studio.
  • Link: Debugging Guide

Unity UI Layout Crash Course (Narria)

Environment Variables Setup Guide

Open

C# Tutorials Series (Wolfie)

Profiling with dotTrace (Narria)

  • Description: Just set it up to launch WoTR under unity profiling and it works great. You don't even need to use the debug binary or anything.
  • Link: dotTrace Profiler

Tutorial Canvas(hambeard)

BubbleTeachesLesson (bubbles)

  • Description: Step-by-Step guide for creating a Wrath Owlcat Template mod.
  • Link: BubbleTeachesLesson0

Character Textures (Aberiu)

Open If we are talking about character textures:

D is diffuse
RGB - diffuse
A - opacity

M is mask
R - roughness
G - emissive
B - metalness
A - translucency (thickness map)

N - normals
RGB - normals
A - none

S - shadow mask
It used to contain only shadows, now it also has masks for painting stuff in unity (like class outfit colors)
R - color 1
G - color 2
B - shadow mask
A - none

Shadow is basically a black diffuse layer that we place between multiple regular diffuse layers. For example, if you put on some robe and an armor, on your character's skirt bodypart they will be both painted on the same mesh. To make the top layer (armor in this case) stand out better, we add a shadow between the two layers. Shadow only appears where you can see the bottom layer sticking out. Shadow is a mask, and it does 2 things: paints diffuse with black and fills roughness with white to remove any reflections in the shadow area.

Thickness is for our fake SSS shader. Lets the light pass through the mesh and light up the texture a bit. Like the real skin. Leave it black for anything except skin. For skin you have to bake a thickness map (xnormal does that, for example). If you fill it with white, it will cause a weird subtle shine all over your texture.

How to turn a model into a KingmakerEquipmentEntity via Unity Editor (Kurufinve)

Open
  1. drag'n'drop the model into the project. Create a GameObject for it and add a MeshRenderer to it. Drag'n'drop your model model onto it. Add "Bones" as children Game Objects - those are special-named game objects that will govern the skeleton animation. You generally wanna steal it from an existing body part such as some body. Save as prefab.
  2. Create a Scriptable Object of the Color Profile type. Import textures for coloring. Those are "ramps" - ramps are kind of Brightness thingy where n-th pixel (on the X axis) shows the visible color at n% light intensity where the intensity level is taken from the ramp mask as average luminosity or whatever it is called. Create a Scriptable Object of the Ramp Color Preset type. Each profile contains 2 indecies (primary and secondary color) pointing to one of color in the Color Profile.
  3. Create a Scriptable Object of Equipment Entity type. Drag'n'drop your colors onto its fields. You can add more ramps specific to this single EE, but generally you want to go with presets. Expand BodyParts array and press "+" to create new entries.
  4. Drag'n'drop the prefab of a body part from step 1 onto the Body Part's RendererPrefab field. Create a Material with Owlcat/Lit shader and drag'n'drop onto the Material field. Add more TextureDescriptions to the Textures array. Fill with imported Difuse, Normal, Mask. Shadow textures and assign Diffuse as Active texture. Set up flags to use those textures. Add primary and secondary ramps if needed as well as ramp mask (). You may use ramps for all 3 channels and you may have several Texture Descriptions for layering (for example, face body parts uses one description for skin and one more for lipstick and rouges). Rinse and repeat for all body parts.
  5. Create a blueprint of Kingmaker Equipment entity type and shove EE into it. You will need 1 EE for each race you need (in case you do equipment and not base bodies) for each gender

WotR Character Atlas Layout (Aberiu)

Open

WotR Character Atlas Layout

Building WotR for dummies (seamato)

Open
  • STEP -2: Add this to Editor: https://gist.github.com/cstamford/1173cfdecf8ae7194e8ec5fcaaf2b9a1 . It will add two new menu options in the Assets top main menu thingy (apparently I can't remember how to words).
  • STEP -1: Put this file somewhere: https://gist.github.com/cstamford/95a37739c97df172ae3656df617824ba It lists all the variants used by all the shaders in the game - update the code above to load this file, since the path is hardcoded.
  • STEP 0: For any shader you wish to compile, you need to create a ShaderVariantCollection for it and include it in your asset bundle. This will force Unity to include all those variants. The code above will create one for you matching retail shader variants via Assets/Create ShaderVariantCollection. Note that the code is hardcoded to do Owlcat/Lit, just look for Lit.shader and OwlcatLitSVC to know what to edit!
.Append("Assets/RenderPipeline/CustomShaders/OwlcatLitSVC.asset")
.Append("Assets/RenderPipeline/OwlcatShaders/Shaders/Lit/Lit.shader")
  • STEP 1: Create your asset bundle via Assets/Build MyAssetBundle. NOTE: If you build it any other way, it will include about 100x more variants and it will take several hours to build.
  • STEP 2: Tadaa! It works! Minimal example in game:
if (Button("Swap Material Test")) {
    foreach (Renderer renderer in GameObject.FindObjectsOfType<Renderer>()) {
        Material[] materials = renderer.sharedMaterials;
        
        for (int i = 0; i < materials.Length; i++) {
            Material mat = materials[i];
            if (mat.shader.name == "Owlcat/Lit") {
                mat.shader = Shaders.LitReplacement; // you should load this from your asset bundle via the regular API
                materials[i] = mat;
            }
        }

        renderer.sharedMaterials = materials;
    }
}

WotR Race stuff (bubbles)

RT Template first time video guide (ADDB)

  • Description: Changing a value on a weapon via RT template
  • Link: YouTube

RT Vertex Groups of Human Base Body (ezfi)

  • Description: Documents the vertex groups of the RT human base body to help rigging new equipment; bones labeled ADJ have vertex groups
  • Link: Google Drive

RT Localization File guide (Fox)

  • Description: Notes created someone on how to do enGB.json
  • Link: Pastebin

RT Editor Template Guide on installing MicroPatches (microsoftenator2022)

  • Description: MicroPatches has bugfixes and new features for RT Template; this is an installation video
  • Link: YouTube

Unity Modding Template Adjustments and Fixes

Open
Edit Bundle Creation Script (microsoftenator2022)

Open \Assets\Editor\Build\Tasks\PrepareBundles.cs and change

	string assetPath = AssetDatabase.GUIDToAssetPath(assetGuid);
	string bundleName = m_LayoutManager.GetBundleForAssetPath(assetPath, m_ModificationParameters.TargetFolderName);
	if (bundleName == null)
	{
		continue;
	}

to

	string assetPath = AssetDatabase.GUIDToAssetPath(assetGuid);
	string bundleName = m_LayoutManager.GetBundleForAssetPath(assetPath, m_ModificationParameters.TargetFolderName);
	if (bundleName == null || bundleName.EndsWith("_content"))
	{
		bundleName = $"{m_ModificationParameters.TargetFolderName}_assets_all";
	}
Replace RT Template's Blueprint Patch Editor Script (microsoftenator2022)

Download the edited script and replace the original in \Assets\Code\GameCore\Editor\Blueprints\.

Fix the RT Template's FileNotFound Exception for references.xml on Startup (microsoftenator2022)

Open \Assets\Code\GameCore\Editor\Validation\ReferenceGraph.cs and change

        static ReferenceGraph()
        {
	        BlueprintsDatabase.OnPreSave += Graph.CleanReferencesInBlueprintWithId;
	        BlueprintsDatabase.OnSavedId += Graph.ParseFileWithId;
        }

to

        static ReferenceGraph()
        {
	        BlueprintsDatabase.OnPreSave += id => Graph?.CleanReferencesInBlueprintWithId(id);
	        BlueprintsDatabase.OnSavedId += id => Graph?.ParseFileWithId(id);
        }

        [InitializeOnLoadMethod]
        static void InitGraph()
        {
            if (!File.Exists("references.xml"))
            {
                Debug.LogWarning("references.xml does not exist. Creating reference graph.");
                CollectMenu();
            }
        }
Create a Bundle Assets Mapping File on Build for the Wrath Template (microsoftenator2022)

Open Assets\Editor\Build\Tasks\PrepareArtifacts.cs, find:

			return ReturnCode.Success;
		}
	}
}

and replace with:

            const string bundlesLayoutFileName = "BundlesLayout.json";

            File.Copy(
                Path.Combine(intermediateFolderPath, bundlesLayoutFileName),
                Path.Combine(targetFolderPath, bundlesLayoutFileName));

			return ReturnCode.Success;
		}
	}
}

Open Assets\Editor\Build\Tasks\CreateManifestAndSettings.cs, find:

			return ReturnCode.Success;
		}
	}
}

and replace with:

            var values = m_ModificationSettings.Settings.BundlesLayout.GuidToBundle.Values.ToArray();

            File.WriteAllText(Path.Combine(buildFolderPath, "BundlesLayout.json"),
                JsonConvert.SerializeObject(values.Distinct()
                    .ToDictionary(
                        value => value,
                        value => m_ModificationSettings.Settings.BundlesLayout.GuidToBundle.Keys
                            .Where(key => m_ModificationSettings.Settings.BundlesLayout.GuidToBundle[key] == value)
                            .Select(guid => new { AssetPath = AssetDatabase.GUIDToAssetPath(guid), AssetGuid = guid }))));
			
			return ReturnCode.Success;
		}
	}
}

Add using Newtonsoft.Json; to the list at the top of the file.

Add labelled drop-down drawers for enum-based fields for Wrath template (Kurufinve)

Go the template's Assets\Editor\ folder and create a new script named LongAsEnumAttributePropertyDrawer.cs. Edit it and paste in the following:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace MyOwlcatModification
{
    [CustomPropertyDrawer(typeof(LongAsEnumAttribute), true)]
    public class LongAsEnumAttributePropertyDrawer : PropertyDrawer
    {
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var type = (attribute as LongAsEnumAttribute).EnumType;
            var result = EditorGUI.EnumPopup(position, label, Enum.ToObject(type, property.longValue) as Enum);
            property.longValue = (long)Enum.ToObject(type, result);
        }
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            return EditorGUIUtility.singleLineHeight;
        }
    }
}

Create a new script named LongAsEnumFlagsAttributeAsDropdownDrawer.cs and paste in the following:

using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;

namespace Kingmaker.Utility
{
    [CustomPropertyDrawer(typeof(LongAsEnumFlagsAttribute))]
    public class LongAsEnumFlagsAttributeAsDropdownDrawer : PropertyDrawer
    {
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.LabelField(new Rect(position.x, position.y, EditorGUIUtility.labelWidth, position.height), label);

            string text = property.hasMultipleDifferentValues ? "-multiple-  " : property.longValue == 0 ? "None  " : "";
            var enumType = (attribute as LongAsEnumFlagsAttribute).EnumType;
            var names = System.Enum.GetNames(enumType);

            foreach (string name in names)
            {
                long value = (long)System.Enum.Parse(enumType, name);
                if ((property.longValue & value) == value) text += string.Format("{0}, ", name);
            }
            text = text.Remove(text.Length - 2, 2);
            Rect popupRect = new Rect(position.x + EditorGUIUtility.labelWidth, position.y, position.width - EditorGUIUtility.labelWidth, position.height);
            if (GUI.Button(popupRect, new GUIContent(text), (GUIStyle)"miniPopup"))
            {
                GenericMenu menu = new GenericMenu();
                foreach (var name in names)
                {
                    long value = (long)System.Enum.Parse(enumType, name);
                    bool has = (property.longValue & value) == value;
                    menu.AddItem(new GUIContent("None"), property.longValue == 0, () =>
                    {
                        property.longValue = 0;
                        property.serializedObject.ApplyModifiedProperties();
                    });
                    menu.AddItem(new GUIContent(name), has, () =>
                    {
                        if (has) property.longValue ^= value;
                        else property.longValue |= value;
                        property.serializedObject.ApplyModifiedProperties();
                    });
                }
                menu.DropDown(popupRect);
            }
        }
    }
}

Dumps

Open

Kingmaker 2.1.7b dump (ADDB)

  • Description: Dump created with KingmakerDataminer.
  • Link: dump

Kingmaker GUID Database (Spacehamster)

  • Description: Here is the current database of GUIDs found in mods, these are new GUIDs and in game ones. It's unknown if the original blueprint is modified by the mod author. If you have any troubles with a certain GUID this should help you narrow it down.
  • Link: GUID Database

Kingmaker Blueprint JSON Dumps (Spacehamster)

Wrath AssetId to Bundle Mapping File (Microsoftenator)

Wrath Shaders Info (seamato)

  • Description: All variants per shader, and metadata per shader including all properties and paths inside bundles
  • Link: Gist

RogueTrader AssetId to Bundle Mapping File (Microsoftenator)

RogueTrader CAB to Bundle Mapping File (Microsoftenator)

⚠️ **GitHub.com Fallback** ⚠️