For adopters who just want to use the Factory, no build is needed — grab a released HumankindAssetFramework.dll. Build only if
you’re changing the plugin.
HumankindAssetFramework.dll)Needs the .NET SDK. The project file is HumankindAssetFramework.csproj. Put a References\ folder next to the .csproj containing:
BepInEx.dll + 0Harmony.dll + MonoMod.RuntimeDetour.dll + MonoMod.Utils.dll + Mono.Cecil.dll — from
<Humankind>\BepInEx\core\ (the MonoMod/Cecil trio are Harmony’s own runtime deps — the unit suite EXECUTES
patches for the shared-seam census tests)UnityEngine*.dll + Newtonsoft.Json.dll — from <Humankind>\Humankind_Data\Managed\
(Newtonsoft is provided by the game at runtime — used for robust registry parsing, since UnityEngine.JsonUtility
silently returns empty in the game’s Mono runtime; Private=false, so it’s not copied into the built plugin.
No Amplitude DLL is needed — the plugin’s only compile-time game surface is string-based reflection; the vestigial
Amplitude.Mercury.Animation.dll reference was dropped 2026-08-17.)No game installed? pwsh tools/fetch-refs.ps1 collects every reference DLL from public sources
(nuget.org, the BepInEx release, BepInEx’s unstripped-Unity mirror) — this is what CI uses; it never overwrites
DLLs you already copied from the game. GitHub Actions builds + runs the full test suite on every push
(.github/workflows/ci.yml), along with every source-only guard — docs links, binding-catalog surface, hot path,
parse shape, editor source, and registry schema parity. Both halves now live in this repo, so parity needs no sibling
checkout. See
Testing.md for which guards run in which lane, and why the hook is not enough on its own.
Then:
dotnet build -c Release
and copy both bin\Release\HumankindAssetFramework.dll and bin\Release\Haf.Schema.dll → <Humankind>\BepInEx\plugins\
— or just run bash tools/deploy-plugin.sh, which copies both. Haf.Schema.dll (netstandard2.0) is the shared model
schema that ModelDef (editor) and ModelEntry (plugin) both inherit — the build produces it automatically via a
ProjectReference, but the plugin won’t load without it (BepInEx reports the missing dependency), so the two ship
together. The editor package consumes the same tracked DLL from editor/Plugins/Haf.Schema.dll.
Refresh the tracked editor DLL when
Haf.Schemachanges. The editor compiles against the DLL undereditor/, not the source project, so a schema change is invisible on the editor side until that in-repo artifact is refreshed — and the failure looks like a compile error naming a type that plainly does exist ('PackValidator' does not contain a definition for 'ValidatePack'), which reads as your mistake rather than a stale binary. Hit exactly this on 2026-08-23 adding the wrapper rules. Iftools/editor_compile_check.shreports a member that you can see inHaf.Schema/, copy the DLL before believing it:cp Haf.Schema/bin/Release/netstandard2.0/Haf.Schema.dll editor/Plugins/Haf.Schema.dll
The push remembers the last parity PASS (2026-10-31). A parity run that passes writes tools/parity-stamp.txt, a
digest of every file the parity drills compile, run or read; the push’s parity stamp step compares it and SKIPs,
naming the files, when a Blender script, a ported editor/*.cs or a drill fixture changed since. Commit the stamp
the parity run writes beside such a change. See Testing.
The push gate runs no Blender and no Blender-parity drill (2026-10-30). The nine drills that hold the C# ports to
Blender’s own output are the gate’s parity mode (HAF_GATE=parity: bash tools/blender_parity.sh, or the Bake Tests
row Do the C# ports still match Blender?, which runs exactly that from Unity) and need Blender there; a push runs the
build, the tests, the source guards and the Unity-backed drills only. A record of Blender’s output (HAF_ORACLE=record
with tools/refresh_blender_oracle.sh, then replay) remains an option of the parity mode for an offline rerun; nothing
requires it. See Testing. Blender is still needed for the editor’s own uses below
and for the Bake Tests rows that run it.
Blender is needed for .blend import, animated-model import, and for Strip parts / Reduce-to-tris on what the
Factory cannot prepare itself — auto-detected under Program Files, or point the Factory Settings override /
EditorPrefs 'ENC.blenderPath' at blender.exe. Since 2026-10-08 a static .glb/.gltf with a reduce target is
stripped and reduced in process (BlenderPrep, the same file Blender’s prep_model.py would write as far as the
converter reads it); Blender still does an OBJ source, a strip without a reduce, and any model the in-process prep
names in the console (“model prep: using Blender because …” — an animated file, a JPEG whose alpha is read, an
object under a bone, …). Since 2026-11-02 an .fbx is read natively and prepped in process like a .glb, unless the reader names a limit; an
animated file of any format is prepped by Blender, and in a static bake without prep an .fbx the native reader leaves
by name goes to Unity’s own FBX importer, said in the Console. Static GLB/OBJ/FBX bakes with neither Strip nor Reduce need no Blender: the GLB path uses the
self-contained packaged editor/Tools~/glbconv/glbconv.exe (no .NET install required, and its Weld & simplify option decimates without
Blender). A dotnet glbconv.dll fallback exists for local dev.
The heavy geometry passes shell out to headless Blender (editor/Tools~/prep_model.py, rig_anim.py, blend_export.py)
rather than being written in C# (the prep of a .glb/.gltf is the exception since 2026-10-08: an exact port of what
Blender does there, held to Blender’s output by the push gate, with prep_model.py as its fallback). The scripts are Python, but Python is only the remote control — the actual
decimation/import/export executes inside Blender’s C/C++ core:
glbconv’s Weld & simplify vertex clustering — survives as the
Blender-free fallback, but clustering averages UVs across seams (scrambles textured skins) and eats thin features,
which is exactly why the COLLAPSE path was added..blend conversion and the animated pipeline (armature slimming,
clip baking, FBX export) — Strip/Reduce ride an install the modder already has for those.glbconv would eliminate both the Blender
dependency for static models and the round-trip cost. Blender would remain only for what genuinely needs a DCC:
.blend files and animation. Tracked in Framework-Review.md.dotnet test Tests/HumankindAssetFramework.Tests.csproj -c Release
An xUnit suite (net471) over the pure registry/parse/era layer — the half that touches no live-game reflection,
and where the bugs have historically been. Needs the same gitignored References\ DLLs as the plugin build (mirrored
into the test bin). Full detail — what’s covered, what’s deliberately out of scope and why, how to add a test — is in
Testing.md.
The gate cleans up after itself (2026-11-08). Its first step, tools/temp_sweep.sh, removes the gate’s and the
drills’ own temporary directories older than two days from your %TEMP%, by their exact generated names only
(haf-<producer>.XXXXXXXXXX); it never touches another program’s files and never fails the gate. A new script that
makes a temporary directory must use that name form and add its producer to the sweeper’s list, or
Tests/test_temp_sweep.py fails. If the gate is suddenly many times slower, compare bash.exe -c : with sh.exe -c :
from PowerShell; a large gap was a stuck per-file state on bash.exe that a reboot cleared.
ENCReload/Tools/package-release.sh builds the player download: the Humankind mod and the HAF plugin that
renders its custom units, in one reproducible artifact.
bash Tools/package-release.sh # -> Distribution/release/ENCReload-<ver>.zip
bash Tools/package-release.sh --no-zip # stage only (fast, for inspection)
bash Tools/package-release.sh --haf <dir> # explicit plugin checkout
Two numbered folders, because the halves install to different roots — the mod is a Humankind Community module, the plugin is a BepInEx DLL, and no single “extract here” covers both:
| In the zip | Goes to |
|---|---|
1_Humankind_game_folder/BepInEx/ |
the Humankind install (the folder with Humankind.exe) |
2_Community_mods_folder/ENCReload.<guid>.<ver>/ |
the Community folder the player’s other mods are in |
READ_ME_FIRST.txt is generated from a tracked template (Tools/release/) with the version and module GUID
substituted, so the shipped instructions cannot drift from what shipped. The plugin is built by the script,
never collected from wherever a DLL happened to be lying — the hand-made v0.1.0 zip ended up 178 commits behind
master exactly that way.
The stale-bundle guard is why this is a script and not a checklist. pack.json’s skel/atlas/clip GUIDs
point into the asset bundle, so a re-bake after the last mod build produces a pair that looks fine and is
broken — “waiting for leaves to load…” forever, or a scrambled texture from a mismatched mesh/atlas pair. The
script refuses to package when any baked asset (or pack.json) is newer than the bundle: the same rule the
District Factory’s health check already applies at authoring time, moved to where it would otherwise reach a
player. It excludes the bake-test fixtures by the same three prefixes the delete guard uses
(__feat_ / __smoketest__ / __convgate__) — a leftover fixture is newer than everything and would otherwise
fail every package.
The Model Factory and other authoring windows live in editor/ and install through Unity Package
Manager. They compile and run in the host Unity project; ENCReload is the reference consumer. Packaged Blender and
converter helpers live under editor/Tools~, and HafPackageContext supplies safe guest-project defaults and derives
the guest pack identity. The deleted baker/ editor snapshot must not return: it was a drifting second source.
The editor package ships editor/Plugins/x86_64/hafkernels.dll (Windows Editor-only, x86_64), built from native/
by bash tools/build_native_kernels.sh. It holds the kernels that were measured to be the editor tools’ hot spots
(2026-10-21 to 28): the Lab probe’s custom-normal encode and decode, visibility BVH build and world transform
(hafkernels.cpp, hafnormals.cpp); the reduce’s edge collapse (hafdecimate.cpp); the Workshop fuse’s exposure
ladders from above and from the side (hafcolumn.cpp), twin census (haftwin.cpp) and weld classes (hafweld.cpp);
the Vehicle Lab reduce stage’s BMesh build, double search and limited dissolve (hafbmesh.cpp); the PNG codec’s
scanline unfilter and pixel expansion, row packing, checksums, composition fills and zlib compression, and SHA-256
through Windows CNG, for the native FBX reader’s textures (hafpng.cpp, with libdeflate 1.26 vendored under
native/libdeflate/, MIT; 2026-11-02).
Nothing is installed for it: the DLL is part of the package.
g++ and gcc on PATH - libdeflate’s C is compiled by gcc into objects
the DLL links), -O2 -ffp-contract=off -fno-fast-math and SSE only,
so the C++ rounds exactly as the C# it replaces; cosf/sinf are resolved from ucrtbase.dll at load, never from
mingw’s libm (the decode computes with Blender’s C runtime). Without g++ the script fails loud and builds nothing.native/deterministic.py), so a fresh build with the same toolchain equals the committed DLL byte for byte. The native
kernels drill in the push gate rebuilds and compares; a DLL that does not match its sources fails the push.HAF_NATIVE_KERNELS=0
keep the managed path. The native kernels drill compares probe and prep outputs on its reader fixtures (excluding
export_skin_bonechild.glb) and saved GLB/glTF recipe sources on x64 .NET Framework; its Unity Mono leg checks the
same fixtures and the three smallest recipe sources against those managed hashes. Fuse kernels have separate unit
and Workshop golden checks; Testing
records their Unity comparisons. The Bake Tests window’s Kernels dropdown (2026-10-28) runs selected kernel-reaching
rows twice under Both, with the kernels and with the C# twins, against each row’s existing oracle. Select the relevant
catalog/recipe rows for broad coverage; missing inputs, cached validations and named fallbacks remain visible in their
results. The Blender-only Vehicle Lab golden rows run once; Generate backend acceptance exercises C# Generate.
The loader row fails when the DLL did not load (or skips for deliberate HAF_NATIVE_KERNELS=0). The hosts marshal
differently: a bool[] crosses as four bytes a flag in Mono, so native array parameters use blittable elements,
with flags as byte[]. HafNativeKernels.Status says which path runs; the HafNativeKernels wrappers validate buffers
before entering C++.haf_kernels_version() must equal HafNativeKernels.Version (8 since 2026-11-02); bump both
on any ABI change. A mismatch is not an error, it is the managed path — and a Unity editor never unloads a native
plugin, so after rebuilding or updating the DLL restart Unity. An ABI-version mismatch selects managed fallback;
an update that keeps the same ABI version can continue running the old native implementation until that restart.baker/ still holdsTwo live things that exist only here, and are built from here:
baker/glbconv/ — the single source of truth for the GLB→OBJ converter (2026-08-17). Build with
dotnet publish -c Release, deploy the exe to editor/Tools~/glbconv/, and A/B-diff the OBJ output
before deploying (procedure in baker/glbconv/BUILD.md).baker/reactor_silhouette.py — the headless-Blender district silhouette helper
(District-Dedicated-Visual.md).