Merge pull request #1187 from ludovic111/fix/world-spawn-one-worker
🤖 Agent: merged after integration wave 2 on the desktop (integ/w2 @ 38307d15 = main c16b41ab + this wave): fmt, clippy -D warnings, workspace + launcher + telemetry-server tests, release build and every affected parity harness pass; the 3 harness failures and the panel test passed on rerun (known flakes).
This commit is contained in:
@@ -17,13 +17,13 @@ stops; Horizon's (`horizon-client --dedicated --nogui`) creates its own from
|
||||
the same server.properties and stops; the `spawn` position of both
|
||||
level.dat files is compared.
|
||||
|
||||
Vanilla is not deterministic everywhere: trees of neighbouring chunks
|
||||
overlap on chunk corners, and which one is placed last depends on the order
|
||||
the server's worker threads decorate the chunks. A spawn column on such a
|
||||
corner can then stand on different leaves from one vanilla run to the next.
|
||||
When the spawns differ, vanilla creates the world up to RETRIES more times;
|
||||
Horizon's spawn passes if one of vanilla's runs gives it too, and the seed is
|
||||
reported as varying in vanilla.
|
||||
Trees of neighbouring chunks overlap on chunk corners, and which one is
|
||||
placed first depends on the order the chunks are decorated. With several
|
||||
worker threads vanilla's order changes from run to run (seed
|
||||
-2080727421395798566 spawned at Y 64, 66 or 72), so its server runs with one
|
||||
(`-Dmax.bg.threads`, Util.maxAllowedExecutorThreads): the chunks are then
|
||||
decorated in its scheduler's order, the one Horizon follows
|
||||
(decoration_order::vanilla_order), and every run gives the same spawn.
|
||||
|
||||
Seeds: the player report's seed (1891623539983467248: Horizon spawned at
|
||||
-48 -48, vanilla at 152 145), the chunk generation harness's seeds and
|
||||
@@ -54,7 +54,6 @@ except ImportError:
|
||||
|
||||
NAME = 'world-spawn-parity'
|
||||
REPORT = 1891623539983467248
|
||||
RETRIES = 3
|
||||
SEEDS = [REPORT, 12345, -7046029254386353131, 987654321987, 4242, -1, 0x5DEECE66D, 20260607, 777, 0]
|
||||
RESOURCES = lab.RESOURCES
|
||||
|
||||
@@ -132,7 +131,8 @@ def main():
|
||||
oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
'compile-rust', timeout=3600)
|
||||
binary = target_dir() / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
# One worker thread: the chunks decorated in a fixed order (see above).
|
||||
vanilla_server = ['java', '-Xmx2g', '-Dmax.bg.threads=1', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', RESOURCES, '--dedicated', '--nogui']
|
||||
os.environ['HORIZON_NO_AUDIO'] = '1'
|
||||
|
||||
@@ -140,27 +140,20 @@ def main():
|
||||
t0 = time.time()
|
||||
a = world_spawn(vanilla_server, build / f'vanilla-{seed}', seed, f'vanilla-{seed}')
|
||||
b = world_spawn(horizon_server, build / f'horizon-{seed}', seed, f'horizon-{seed}')
|
||||
runs = [a]
|
||||
while b not in runs and len(runs) <= RETRIES:
|
||||
runs.append(world_spawn(vanilla_server, build / f'vanilla-{seed}-{len(runs)}', seed, f'vanilla-{seed}-{len(runs)}'))
|
||||
return seed, runs, b, time.time() - t0
|
||||
return seed, a, b, time.time() - t0
|
||||
|
||||
spawn_diffs, varying = [], []
|
||||
spawn_diffs = []
|
||||
with ThreadPoolExecutor(args.jobs) as pool:
|
||||
for seed, runs, b, took in pool.map(one, all_seeds):
|
||||
ok = b in runs
|
||||
for seed, a, b, took in pool.map(one, all_seeds):
|
||||
ok = a == b
|
||||
if not ok:
|
||||
spawn_diffs.append(seed)
|
||||
elif len(set(runs)) > 1:
|
||||
varying.append(seed)
|
||||
seen = ', '.join(' '.join(map(str, r)) for r in dict.fromkeys(runs))
|
||||
print(f'{"ok " if ok else "DIFF"} {seed}: vanilla {seen} / horizon {b[0]} {b[1]} {b[2]} '
|
||||
print(f'{"ok " if ok else "DIFF"} {seed}: vanilla {a[0]} {a[1]} {a[2]} / horizon {b[0]} {b[1]} {b[2]} '
|
||||
f'(origin chunk {vanilla[seed][2]} {vanilla[seed][3]}; {took:.0f}s)', flush=True)
|
||||
if ok:
|
||||
for path in build.glob(f'*-{seed}*'):
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
print(f'World spawns: {len(all_seeds) - len(spawn_diffs)}/{len(all_seeds)} seeds match in {time.time() - started:.0f}s'
|
||||
+ (f'; vanilla itself gave several spawns for {len(varying)}: {varying}' if varying else ''))
|
||||
print(f'World spawns: {len(all_seeds) - len(spawn_diffs)}/{len(all_seeds)} seeds match in {time.time() - started:.0f}s')
|
||||
if origin_diffs or spawn_diffs:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user