This repository has been archived on 2026-05-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AgrarianGameArchive/Scripts/verify_wildlife_performance_limits.py
T

79 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Validate MVP wildlife performance-limit wiring."""
from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
def read(relative_path: str) -> str:
path = ROOT / relative_path
if not path.exists():
raise AssertionError(f"Missing required file: {relative_path}")
return path.read_text(encoding="utf-8")
def require(content: str, needle: str, context: str) -> None:
if needle not in content:
raise AssertionError(f"Missing {needle!r} in {context}")
def main() -> int:
errors: list[str] = []
checks = {
"Source/AgrarianGame/AgrarianWildlifeBase.h": [
"bEnablePerformanceLimits",
"FullUpdateRadius",
"FarUpdateIntervalSeconds",
"ShouldRunServerThink",
"GetNearestPlayerDistanceSquared",
"ServerThinkAccumulator",
],
"Source/AgrarianGame/AgrarianWildlifeBase.cpp": [
"ShouldRunServerThink(DeltaSeconds)",
"ServerThinkAccumulator += DeltaSeconds",
"FMath::Square(FullUpdateRadius)",
"FarUpdateIntervalSeconds",
"SetActorTickEnabled(false)",
"TNumericLimits<float>::Max()",
],
"Source/AgrarianGame/AgrarianWildlifeSpawnManager.h": [
"MaxActiveWildlife",
],
"Source/AgrarianGame/AgrarianWildlifeSpawnManager.cpp": [
"GetActiveWildlifeCount() >= MaxActiveWildlife",
],
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add performance limits.",
"nearby wildlife updates normally",
"far wildlife batches server",
],
"Docs/TechnicalDesignDocument.md": [
"Wildlife Performance Limits",
"FullUpdateRadius",
"FarUpdateIntervalSeconds",
"MaxActiveWildlife",
],
}
for relative_path, needles in checks.items():
try:
content = read(relative_path)
for needle in needles:
require(content, needle, relative_path)
except AssertionError as exc:
errors.append(str(exc))
if errors:
for error in errors:
print(f"ERROR: {error}", file=sys.stderr)
return 1
print("PASS: wildlife performance limits are wired and documented.")
return 0
if __name__ == "__main__":
raise SystemExit(main())