POURQUOI : les remontées "aucun chemin NavMesh" (Pixel 8 Pro) sont indisable sur émulateur et le gamelog ne montre que le symptôme. Ces scripts Python reproduisent SANS rendu ni émulateur : - la génération procédurale (MapManager.loadProceduralMap porté au ligne près : java.util.Random, ordre HashMap, connecteurs, verrous, solidité, portes) ; - NavMesh.init (fillIn, liens marche/chute/saut) et getPath (BFS) ; - le spawn Exterminate (raycast de sol, ±1500 px vertical) ; - un oracle physique (marche / chute par bord / saut <= 3 lignes) pour séparer l'isolation RÉELLE des liens manquants. Les drapeaux fix_notch / fix_left_bound / _resolve_links reproduisent exactement le patch NavMesh/Behaviour pour les mesures avant/après. Résultats cités dans le commentaire de NavMesh.resolveNavCell.
79 lines
2.8 KiB
Python
79 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Test sur cartes COMPLETES dont le segment de spawn est spwn_16x16_a
|
|
(signature : étagère pleine largeur à la ligne 255, plancher 256 x0..15).
|
|
Positions EXACTES du log v0.12.x :
|
|
ennemi (1059.455, 25400) ; joueur (56..499, 26100 / 26900)
|
|
"""
|
|
import sys
|
|
sys.path.insert(0, "tools/sim")
|
|
from navmesh_connectivity import (load_segments, generate_map, NavMeshSim,
|
|
standable, JavaRandom)
|
|
|
|
ENEMY = (1059.455, 25400.0)
|
|
JOUEURS = [(56.25, 26100.0), (499.35, 26100.0), (464.0, 26900.0),
|
|
(120.0, 26900.0), (432.0, 26900.0)]
|
|
|
|
|
|
def resolve(sim, np, x, y):
|
|
if np is not None and not np.links:
|
|
i = int(round(x / 100.0)); j = int(round(y / 100.0)) + 1
|
|
for d in (-1, 1):
|
|
if 0 <= i + d < sim.W and sim.nav[i + d][j].links:
|
|
return sim.nav[i + d][j], " fb->(%d,%d)" % (i + d, j)
|
|
return np, ""
|
|
|
|
|
|
def is_spawn_a(sim):
|
|
"""Signature de spwn_16x16_a posé à (0,256) : plancher 256 pleine largeur."""
|
|
return all(sim.coll(x, 256) for x in range(0, 16)) and \
|
|
all(not sim.coll(x, 255) for x in range(0, 16))
|
|
|
|
|
|
def main():
|
|
segs = load_segments()
|
|
n_a = 0
|
|
agg = {}
|
|
tested = 0
|
|
for k in range(200):
|
|
seed = 1_000_000 + k * 7919
|
|
solid, _, _ = generate_map(seed, segs)
|
|
sim0 = NavMeshSim([row[:] for row in solid])
|
|
# signature sur la solidité BRUTE (avant fill) : col 0..15 ligne 256 solide
|
|
if not all(solid[x][256] == 1 for x in range(16)):
|
|
continue
|
|
n_a += 1
|
|
if n_a > 25:
|
|
break
|
|
for fixes in (False, True):
|
|
sim = NavMeshSim([row[:] for row in solid])
|
|
sim.init((20.0, 20.0), fix_notch=fixes, fix_left_bound=fixes)
|
|
en, einfo = resolve(sim, sim.get_nav_point(*ENEMY), *ENEMY)
|
|
key = fixes
|
|
agg.setdefault(key, {"ok": 0, "fail": 0, "detail": []})
|
|
for (px, py) in JOUEURS:
|
|
pn, pinfo = resolve(sim, sim.get_nav_point(px, py), px, py)
|
|
if pn is None:
|
|
agg[key]["fail"] += 1
|
|
continue
|
|
path = sim.get_path(en, pn)
|
|
tested += 1
|
|
if len(path):
|
|
agg[key]["ok"] += 1
|
|
else:
|
|
agg[key]["fail"] += 1
|
|
if len(agg[key]["detail"]) < 3 and not fixes:
|
|
agg[key]["detail"].append("seed=%d joueur=(%d,%d)" % (seed, px, py))
|
|
print("maps avec spawn 'a' testées :", n_a)
|
|
for fixes in (False, True):
|
|
a = agg.get(fixes, {"ok": 0, "fail": 0})
|
|
s = a["ok"] + a["fail"]
|
|
print("fixes=%-5s : %d/%d positions joueur atteignables (%.0f%%) %s" %
|
|
(fixes, a["ok"], s, 100.0 * a["ok"] / max(s, 1),
|
|
a.get("detail", [])))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|