What you get
- Your mod works next to other mods. You get fewer "mod X broke your mod" reports.
- Patch day stops as an emergency. Managers keep your mod alive if Valve did not touch your lines.
- If Valve did touch your lines, the patch shows the exact spot to fix.
- Your release flow stays. Same tools, same VPK, same download page.
- Players can read what your mod changes. That builds trust.
The cost is one small text file per release. Players with no mod manager see no change.
Two ways to ship
- VPK plus companion. Recommended to start here. Ship your VPK as today, with only adding one
.patchfile next to it. Players with no mod manager see no change. - Plain DiffMod. Ship diffs alone, with no VPK. A manager builds the mod past fresh game files. Not recommended unless you know all your users use DiffMod compatible mod manager. See the spec.
Shape your mod for small diffs
A companion holds diffs for game files that your VPK replaces. New files stay in the VPK. Small diffs merge with other mods and survive game updates.
- Put new panels, styles, and scripts in new files.
- Place new files under a folder named after the mod, for example
panorama/styles/compact_hud/. - Hook new files into game files with small edits, such as one include line.
- Prefer style edits over layout edits.
How to make a companion (.patch) file
- List the files in your VPK that the game VPK also holds.
- Decompile each one from the game VPK into folder
a. - Decompile each one from your VPK into folder
b. Use the same decompiler release. - Check that both folders hold each file at its VPK path.
- Diff the two folders, and add a header.
- Name the companion after your VPK, plus
.patch:pak50_dir.vpkgetspak50_dir.vpk.patch. Managers find the pair by this name.
GAME="…/common/Deadlock/game"
F=panorama/layout/hud.vxml_c
Source2Viewer-CLI -i "$GAME/citadel/pak01_dir.vpk" -d -o a -f "$F"
Source2Viewer-CLI -i mymod/pak50_dir.vpk -d -o b -f "$F"
{
printf '# spec: diffmod/v1\n'
printf '# decompiler: source2viewer-cli/20.1\n'
printf '# title: Compact HUD\n'
diff -ru a b
} > mymod/pak50_dir.vpk.patch
Repeat the decompile step for each shared file. The result looks like this. Paths are illustrative.
# spec: diffmod/v1
# decompiler: source2viewer-cli/20.1
# title: Compact HUD
--- a/panorama/layout/hud.xml
+++ b/panorama/layout/hud.xml
@@ -2,6 +2,7 @@
<styles>
<include src="s2r://panorama/styles/hud.vcss_c" />
<include src="s2r://panorama/styles/hud_common.vcss_c" />
+ <include src="s2r://panorama/styles/compact_hud/main.vcss_c" />
</styles>
<scripts>
<include src="s2r://panorama/scripts/hud.vjs_c" />
Check it
The companion must apply to the game copy and reverse apply to your VPK copy.
(cd a && git apply --check ../mymod/pak50_dir.vpk.patch)
(cd b && git apply -R --check ../mymod/pak50_dir.vpk.patch)
Managers run the same reverse check. If it fails, they treat your VPK as a plain VPK.
Ship it
- Put the
.vpkand its.vpk.patchin one folder of your archive. - If your mod has variants, give each variant VPK its own companion in the same folder.
- Cover each game file that your VPK replaces.
- Do not put new files in the companion. The VPK ships them.
- After a game update, managers can rebuild stale files for players. Reissue your VPK and companion when you can.
Questions
My mod is complex: it changes the UI and also swaps images, models or sounds. Should I add a companion?
Yes, if your VPK replaces any .xml, .css or .js game file. No, if your mod only swaps images, models or sounds: a companion would be redundant.
For a mod that does both, ship the VPK as today and add a companion. The companion holds diffs for the .xml, .css and .js files, because those are the files that clash and break after game updates. Images, models and sounds stay in the VPK and load as they do today: the last load wins. Your mod loses nothing, and its UI parts get merges and repairs.
My mod only swaps skins, textures, models or sounds. Do I need a companion?
No. Version 1 covers only .xml, .css and .js files. Your VPK replaces none of them, so a companion would not do anything useful. Ship your VPK as today. Collisions for these types of mods are already well handled by mod managers.
Can Valve ban players who use DiffMod?
Very unlikely. The game only ever loads VPKs. With no clash and no stale file, it loads your VPK exactly as today. For a clash, a repair or a plain DiffMod, the mod manager builds the files on the player's PC and packs them into a VPK. The diffs themselves never reach the game. Minify, a Dota 2 mod tool, builds its mods the same way: it decompiles game files, applies the mod changes and compiles the result with the resourcecompiler. Its maker says that no one has been banned for its mods. Still, only Valve decides.