Policy 3 (headless + Unreal): walkable ring always first; at rest/arrival LOD0-2 before far; walking interleaves near:far ~4:1 toward heading; fast travel admits far coarse tiles right after the walkable ring. Hysteresis: walking 0.75/0.35 m/s, fast 12/8 m/s. Headless, far holes while moving 30 m/s: L77 9.0% / L79 77.2% / L80 8.9%. Cold LOD0-2 ready (one clean protocol, medians): SW 1.30, FI 3.61, TN 3.07, VS 1.43 s. Unreal 30 m/s traces end 2,233/2,237 loaded (commandlet readiness exit 1) for all policies. Passage zero-padding cut: ~50% fewer passage iterations on active tiles, max 6.6 cm surface displacement, no sign flips; not adopted yet (padding sweep next). World unchanged (v213). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
116 lines
5.7 KiB
Python
116 lines
5.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Run the L77/L79/L80 headless moving-camera and dwell protocol."""
|
|
from __future__ import annotations
|
|
import csv
|
|
import json
|
|
import re
|
|
import subprocess
|
|
import time
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l80/movement/headless"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARY = ROOT / "Saved/Linux/l80/bin/VoxelForgeCoreHeadless-l80-clean-clang"
|
|
CAMERA = (19.166015625, -14.2001953125, -753.3740234375)
|
|
POLICIES = {0: "L77", 2: "L79", 3: "L80"}
|
|
SPEEDS = {"walk": 1.4, "fast": 30.0}
|
|
SAMPLE = re.compile(r"^\[L79MovingSample\] (.*)$", re.M)
|
|
SUMMARY = re.compile(r"^\[L79MovingSummary\] (.*)$", re.M)
|
|
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
|
|
|
|
|
def run(policy: int, speed_name: str) -> tuple[dict, list[dict]]:
|
|
label = f"{speed_name}-{POLICIES[policy]}"
|
|
log = OUT / f"{label}.log"
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
camera = ",".join(f"{v:.12f}" for v in CAMERA) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"timeout", "1740s", str(BINARY), str(DATA), "--world-assembler-prototype",
|
|
"--stream-benchmark", "--stream-pipeline", "--workers=8", "--clip-radius=3",
|
|
"--max-clip-level=8", "--max-level=8", f"--camera={camera}",
|
|
"--profile-lod-work", f"--stream-scheduler-policy={policy}",
|
|
f"--moving-camera-speed-mps={SPEEDS[speed_name]:.1f}",
|
|
"--moving-camera-duration-s=12", "--moving-camera-dwell-s=5",
|
|
]
|
|
start = time.monotonic()
|
|
with log.open("w", encoding="utf-8") as output:
|
|
result = subprocess.run(command, cwd=ROOT, stdout=output,
|
|
stderr=subprocess.STDOUT, check=False, timeout=1740)
|
|
content = log.read_text(encoding="utf-8", errors="replace")
|
|
samples = [dict(FIELDS.findall(match.group(1))) for match in SAMPLE.finditer(content)]
|
|
summary_match = SUMMARY.search(content)
|
|
engine = dict(FIELDS.findall(summary_match.group(1))) if summary_match else {}
|
|
if result.returncode or not samples or not engine:
|
|
raise SystemExit(f"moving-camera run failed or trace missing: {log}; exit={result.returncode}")
|
|
for row in samples:
|
|
for name in ("policy", "speed_mps", "t_s", "near_ready_pct", "far_missing_pct",
|
|
"far_hole_pct", "far_stale_max_s", "generation_failures"):
|
|
row[name] = float(row[name])
|
|
row["label"] = label
|
|
if int(float(engine.get("generation_failures", "-1"))) != 0:
|
|
raise SystemExit(f"tile generation failure: {log}")
|
|
run_info = {
|
|
"label": label, "policy": POLICIES[policy], "policy_id": policy,
|
|
"speed": speed_name, "speed_mps": SPEEDS[speed_name],
|
|
"exit_code": result.returncode, "wall_s": round(time.monotonic() - start, 3),
|
|
"samples": len(samples), "engine_summary": engine,
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L80HeadlessMoveRun] " + json.dumps(run_info, sort_keys=True), flush=True)
|
|
return run_info, samples
|
|
|
|
|
|
def main() -> int:
|
|
if not DATA.is_file() or not BINARY.is_file():
|
|
raise SystemExit(f"missing input: {DATA} or {BINARY}")
|
|
runs, all_samples = [], []
|
|
schedule = [(policy, speed) for speed in ("walk", "fast")
|
|
for policy in (0, 2, 3)]
|
|
for policy, speed in schedule:
|
|
row, samples = run(policy, speed)
|
|
runs.append(row)
|
|
all_samples.extend(samples)
|
|
(OUT / "runs-partial.json").write_text(
|
|
json.dumps(runs, indent=2) + "\n", encoding="utf-8")
|
|
summary = []
|
|
for speed_name, speed in SPEEDS.items():
|
|
for policy in POLICIES.values():
|
|
rows = [row for row in all_samples
|
|
if row["speed_mps"] == speed and int(row["policy"]) ==
|
|
next(pid for pid, name in POLICIES.items() if name == policy)]
|
|
moving = [row for row in rows if row.get("phase") == "move"]
|
|
dwell = [row for row in rows if row.get("phase") == "dwell"]
|
|
summary.append({
|
|
"speed": speed_name, "speed_mps": speed, "policy": policy,
|
|
"moving_samples": len(moving), "dwell_samples": len(dwell),
|
|
"far_holes_moving_mean_pct": round(sum(r["far_hole_pct"] for r in moving)
|
|
/ max(1, len(moving)), 3),
|
|
"far_holes_moving_max_pct": max((r["far_hole_pct"] for r in moving), default=None),
|
|
"near_ready_moving_mean_pct": round(sum(r["near_ready_pct"] for r in moving)
|
|
/ max(1, len(moving)), 3),
|
|
"near_ready_moving_min_pct": min((r["near_ready_pct"] for r in moving), default=None),
|
|
"far_holes_dwell_last_pct": dwell[-1]["far_hole_pct"] if dwell else None,
|
|
"near_ready_dwell_last_pct": dwell[-1]["near_ready_pct"] if dwell else None,
|
|
"first_all_far_ready_s": next(
|
|
(r["engine_summary"].get("first_all_far_ready_s") for r in runs
|
|
if r["speed"] == speed_name and r["policy"] == policy), None),
|
|
"generation_failures": next(
|
|
(r["engine_summary"].get("generation_failures") for r in runs
|
|
if r["speed"] == speed_name and r["policy"] == policy), None),
|
|
})
|
|
(OUT / "summary.json").write_text(
|
|
json.dumps({"runs": runs, "summary": summary}, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
sample_path = OUT / "samples.csv"
|
|
if all_samples:
|
|
with sample_path.open("w", newline="", encoding="utf-8") as stream:
|
|
writer = csv.DictWriter(stream, fieldnames=list(all_samples[0]))
|
|
writer.writeheader()
|
|
writer.writerows(all_samples)
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|