Skip to content

Building from Source

Zaldaryon edited this page Jul 8, 2026 · 9 revisions

Building from Source

Requirements

  • .NET 10 SDK
  • bash (Linux/WSL/Git Bash)
  • python3
  • git, curl, perl

Quick Start (Linux / WSL / Git Bash)

git clone https://github.com/Zaldaryon/Optimum.git
cd Optimum
make build    # downloads ~570MB client, decompiles, clones forks, patches, compiles
make test     # runs 208 unit tests
make run      # deploys DLLs + shaders to .vanilla/ and launches the client

The first make build takes 2-5 minutes depending on download speed. Subsequent builds take 5-10 seconds.

Quick Start (Windows PowerShell)

git clone https://github.com/Zaldaryon/Optimum.git
cd Optimum
.\scripts\bootstrap.ps1
dotnet build VintageStory.slnx -c Release

The bootstrap script downloads the official Windows installer, extracts it with innounp (fetched on first run), decompiles with ILSpy, clones the open-source forks at pinned refs, and applies patches.

What Bootstrap Does

  1. Downloads the official Vintage Story client archive for your platform (Linux tar.gz or Windows exe).
  2. Extracts it into .vanilla/win-x64/vintagestory/ (Windows) or .vanilla/linux-x64/vintagestory/ (Linux).
  3. Decompiles VintagestoryLib.dll and Vintagestory.dll with ilspycmd into build/snapshot/.
  4. Runs post-decompile fixup regex (ref-casts, GeneratedRegex, ErrorCallback alias, ambiguous calls).
  5. Clones the open-source forks (vsapi, Cairo, vsessentialsmod, vssurvivalmod, vscreativemod) at the refs pinned in forks.json.
  6. Applies patches from patches/ over both decompiled and fork sources.
  7. Copies Optimum-original sources from sources/ into the working tree.

Deploy

make deploy runs the Cecil IL patcher and copies the results into .vanilla/:

  • VintagestoryLib-patched.dll (vanilla assembly + 43 transplanted method bodies via Mono.Cecil, including the datapath.cfg reading in ClientProgram.Main)
  • Vintagestory.dll (recompiled client entry with Server GC)
  • VintagestoryAPI.dll (patched API with OptimumConfig and version tag)
  • VSEssentials.dll, VSSurvivalMod.dll, VSCreativeMod.dll (patched game mods)
  • cairo-sharp.dll (Cairo fork)
  • sources/shaders/*.fsh, *.vsh (optimized GLSL shaders)

Tests

make test

Runs 208 xunit tests. Tests read patches/ files directly instead of requiring a bootstrapped working tree, so dotnet test passes on any machine with the .NET SDK.

Makefile Targets

Target Description
make check Report installed tools (installs nothing)
make bootstrap Download, decompile, clone, patch
make build Bootstrap if needed, then compile
make clean Remove obj/ and bin/ from project dirs
make refresh Force full re-bootstrap
make patches Regenerate patches/ from the working tree
make deploy Run Cecil patcher, copy DLLs + shaders into .vanilla/
make run Build, deploy, launch client
make test Run unit tests
make package Build all release archives
make package-linux Linux tar.gz
make package-appimage Linux AppImage
make package-macos macOS .dmg
make package-win Windows zip

Clone this wiki locally