Everything the next agent needs to run the Phase 2 optimisation loop on a machine that can launch the client: - analysis/client-perf/: LEVERS (ranked levers + corrections), BENCH-MATRIX (world, scenes, config IDs, blocks B0-B14 with decision rules), PLAYER-TUNING, SPAWN-TUNING, research briefs, the jar scanner and its output, observed default configs, and proposed-configs/ (build.py generates tiers and bench variants and fails on unknown keys; apply_variant.py applies a variant and merges options.txt). - analysis/client-perf/bench/onion-bench/: bench-world datapack (scene teleports, Create grid, mob pen, sound storm, 120 s teleport tour). - analysis/audit/: the static recipe/dependency audit, including gen_fixes.py, which generates the shipped Paxi datapack and was never tracked. - phase0/: per-machine measurement harness (Steam Deck, 7700K/1060, 6700K/1080 Ti). - .pi/journal.md: running work log; read it first. All of it is packwizignored, so nothing here ships to players.
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Apply a generated variant to a Minecraft instance (game closed!).
|
|
|
|
python3 apply_variant.py <ID> <path/to/.minecraft> # e.g. C1, dh-r64, T-deck
|
|
|
|
Copies every config file of out/<ID>/ over the instance. options.txt is
|
|
*merged* key by key, so GUI scale, resolution, keybinds etc. survive variant
|
|
switches. Prints what changed. Stdlib only; works on Windows too.
|
|
"""
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
|
|
|
|
def merge_options(src, dst):
|
|
new = dict(l.split(":", 1) for l in src.read_text().splitlines() if ":" in l)
|
|
lines = dst.read_text().splitlines() if dst.exists() else []
|
|
seen, out, changed = set(), [], []
|
|
for l in lines:
|
|
k = l.split(":", 1)[0]
|
|
if k in new:
|
|
seen.add(k)
|
|
if l != f"{k}:{new[k]}":
|
|
changed.append(f"{k}:{new[k]}")
|
|
l = f"{k}:{new[k]}"
|
|
out.append(l)
|
|
for k, v in new.items():
|
|
if k not in seen:
|
|
out.append(f"{k}:{v}")
|
|
changed.append(f"{k}:{v} (added)")
|
|
dst.write_text("\n".join(out) + "\n")
|
|
return changed
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) != 3:
|
|
sys.exit(__doc__)
|
|
vid, game = sys.argv[1], Path(sys.argv[2])
|
|
src = HERE / "out" / vid
|
|
if not src.is_dir():
|
|
sys.exit(f"{src} missing - run build.py first")
|
|
if not (game / "mods").is_dir():
|
|
sys.exit(f"{game} doesn't look like a .minecraft dir (no mods/)")
|
|
for f in sorted(p for p in src.rglob("*") if p.is_file()):
|
|
rel = f.relative_to(src)
|
|
dst = game / rel
|
|
if rel.as_posix() == "options.txt":
|
|
for c in merge_options(f, dst):
|
|
print(f"options.txt {c}")
|
|
continue
|
|
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
shutil.copyfile(f, dst)
|
|
print(f"copied {rel.as_posix()}")
|
|
(game / "BENCH_VARIANT.txt").write_text(vid + "\n")
|
|
print(f"applied {vid}; recorded in BENCH_VARIANT.txt")
|
|
|
|
|
|
main()
|