You make mods?

Keep your VPK. Add a companion.

What you get

The cost is one small text file per release. Players with no mod manager see no change.

Two ways to ship

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.

How to make a companion (.patch) file

  1. List the files in your VPK that the game VPK also holds.
  2. Decompile each one from the game VPK into folder a.
  3. Decompile each one from your VPK into folder b. Use the same decompiler release.
  4. Check that both folders hold each file at its VPK path.
  5. Diff the two folders, and add a header.
  6. Name the companion after your VPK, plus .patch: pak50_dir.vpk gets pak50_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

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.