Vollständiger, engineunabhängiger Regelkern (Luneraria.Core, ohne UnityEngine): Partie mit sechs Plätzen und zwei Teams, private Planung mit atomarer Übernahme, Gold, Käufe, Aufwertungen, Formation, drei Lanes mit zwei Laneturmen und zwei Basistürmen je Team, Ancients, unbegrenzte Wellen, Helden mit Stufen, Items und Talenten, Angriffschampions, Bossgrotte mit Anspruch, Entsendung, Kopfgeld und dreirundiger Sperre, Bots und Siegbedingung (nur Ancient-Fall). Serverautoritative Befehlsschnittstelle. - Deterministisch: fester Takt, geordnete Maps, fortlaufende IDs, kein Zufall, keine Uhr, keine Threads - Tabellen einmal aus Godot erzeugt (tools/port/gen_content.py) - Golden-Referenzen aus Godot (tools/godot-golden): 19 Szenarien, 120 Snapshots, 51.221 Werte, Abweichung 0 (Toleranzen dokumentiert) - Tests: content 75, core 91, m2 73, golden 157, determinism 6 = 402/402 - Leistung (M5): Simulationsschritt 0,259 ms statt 1,587 ms in GDScript - Referenzfehler R1 im Bot-Gedächtnis bewusst übernommen und dokumentiert - Geplante Helden (Lucy, Ghaliga, Siegfried, Feena) im Datenmodell, inaktiv - Doku unter docs/port (U1-RULES, PORT-STATUS, PORT-QA, U2 bis U5) Unity-Editor-Lauf offen: Die Unity-Lizenz ist noch nicht aktiviert; gebaut und getestet mit dem .NET 8 SDK auf Unitys Sprachstand (C# 9, .NET Standard 2.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.8 KiB
GDScript
45 lines
1.8 KiB
GDScript
extends Node
|
|
## Godot counterpart of tools/dotnet/Luneraria.Core.Bench: the same fixture, measured in GDScript.
|
|
## Run: sh tools/godot-golden/run_godot.sh sim_bench --out=<file.json>
|
|
|
|
func _ready() -> void:
|
|
var out: String = ""
|
|
for arg: String in OS.get_cmdline_user_args():
|
|
if arg.begins_with("--out="):
|
|
out = arg.substr(6)
|
|
var samples: Array[float] = []
|
|
var units: int = 0
|
|
for block: int in range(5):
|
|
var fresh := LuneMatch.new()
|
|
fresh.setup({"seed": 5, "human_slot": -1})
|
|
fresh.round_number = 13
|
|
for slot: int in range(6):
|
|
fresh.players[slot].draft.gold = 100000
|
|
LuneBot.plan(fresh, slot, "ausgewogen")
|
|
fresh.begin_combat()
|
|
units = fresh.combat.mobile_count()
|
|
var started: int = Time.get_ticks_usec()
|
|
for i: int in range(200):
|
|
fresh.step_combat()
|
|
samples.append((Time.get_ticks_usec() - started) / 1000.0 / 200.0)
|
|
samples.sort()
|
|
var match_started: int = Time.get_ticks_usec()
|
|
var rounds: int = 0
|
|
for seed: int in [1, 2, 3]:
|
|
var state := LuneMatch.new()
|
|
state.setup({"seed": seed, "human_slot": -1})
|
|
while state.phase != LuneMatch.Phase.OVER and state.round_number <= 60:
|
|
for slot: int in range(6):
|
|
LuneBot.plan(state, slot)
|
|
state.begin_combat()
|
|
state.finish_combat()
|
|
rounds += 1
|
|
var match_ms: float = (Time.get_ticks_usec() - match_started) / 1000.0
|
|
var report := {"engine": Engine.get_version_info().string, "mobile_units_at_start": units, "sim_step_ms_median": samples[samples.size() / 2],
|
|
"step_blocks_ms": samples, "bot_matches_seeds_1_2_3_ms": match_ms, "bot_match_rounds": rounds, "ms_per_round": match_ms / rounds}
|
|
print("SIM_BENCH ", JSON.stringify(report))
|
|
if not out.is_empty():
|
|
var file := FileAccess.open(out, FileAccess.WRITE)
|
|
file.store_string(JSON.stringify(report, "\t"))
|
|
file.close()
|
|
get_tree().quit()
|