re: the autopilot now survives, and kills
Three measurements, then a pilot built on them. * Hull is position+0x154. Found by anchoring on a field the definition already had solved (HP = 1500) rather than scanning for a value that falls: an undamaged craft must contain its own definition's number. Confirmed by the trace across a death -- 30/60/90 per hit, negative at 0, GAME OVER on screen. * RT accelerates, LT brakes, and the throttle is a persistent setting (488 -> 1510 -> 174 units/s, measured as displacement per second of the craft's own position, so no speed field was needed). This overturns the earlier "RT is not the throttle", which came from assuming the control and hunting for a field. * Shield is probably position+0x430 (== definition MaxValue 400), not yet confirmed live -- nothing had damaged it. pilot.py is a state machine on damage (ENGAGE / EVADE / RETIRE) that treats turrets as keep-out zones instead of targets. It flew Stage 02 for 300 s with the hull untouched at 1500/1500 and took the first confirmed kill (WARPLANES 0001); every run the day before was dead inside 35 s. Two bugs the live run exposed and this fixes: gating the guns on the commanded direction keeps them cold whenever avoidance is steering (gate on the target instead), and an orbit-plus-brake rule made it circle one attacker for 40 s outside its own firing cone. Also: boot to in-flight is now ~100 s unattended, because wait_flight.sh waits for the HUD's own shield bar instead of a fixed 75 s sleep that lavapipe does not honour; entities2.py picks the attitude block by matching the measured flight path (taking the first orthonormal block gave a bone/camera frame); and the entity-heap scan is numpy instead of a per-word Python loop. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,24 +180,35 @@ def main():
|
||||
"(" + ",".join(f"{v:+.3f}" for v in row) + ")" for row in M))
|
||||
if len(sys.argv) > 3 and found:
|
||||
import json
|
||||
# forward axis = the row closest to our direction of travel
|
||||
vdir = None
|
||||
# Which of the orthonormal blocks is the CRAFT's attitude? The one
|
||||
# with a row along the direction of travel. Taking found[0] is what
|
||||
# produced a config with rot_delta -0x764 and a nonsense forward
|
||||
# axis: several blocks inside the object are orthonormal (bone or
|
||||
# camera frames), and only the craft's own has a row that tracks
|
||||
# where the craft is going.
|
||||
p0 = np.array(pos)
|
||||
time.sleep(0.35)
|
||||
p1 = np.array(struct.unpack(">3f", os.pread(fd, 12, off)))
|
||||
if np.linalg.norm(p1 - p0) > 1e-3:
|
||||
vdir = (p1 - p0) / np.linalg.norm(p1 - p0)
|
||||
rot_delta, M, rot_stride = found[0]
|
||||
row, sign = 2, 1
|
||||
if vdir is not None:
|
||||
step = p1 - p0
|
||||
if np.linalg.norm(step) < 1e-3:
|
||||
sys.exit("craft is not moving — cannot bind the forward axis")
|
||||
vdir = step / np.linalg.norm(step)
|
||||
best = None
|
||||
for d, M, st in found:
|
||||
cs = [float(M[r] @ vdir) for r in range(3)]
|
||||
row = int(np.argmax([abs(c) for c in cs]))
|
||||
sign = 1 if cs[row] > 0 else -1
|
||||
print(f"# forward axis = row {row} (sign {sign:+d}), "
|
||||
f"cos={cs[row]:+.3f}")
|
||||
r = int(np.argmax([abs(c) for c in cs]))
|
||||
if best is None or abs(cs[r]) > abs(best[3]):
|
||||
best = (d, M, st, cs[r], r)
|
||||
rot_delta, M, rot_stride, cos, row = best
|
||||
sign = 1 if cos > 0 else -1
|
||||
print(f"# attitude block pos{rot_delta:+#07x} stride {rot_stride}: "
|
||||
f"forward = row {row} (sign {sign:+d}), cos={cos:+.3f}")
|
||||
if abs(cos) < 0.9:
|
||||
print("# WARNING: no block tracks the flight path (|cos| < 0.9)"
|
||||
" — the craft may be drifting hard; re-run while flying straight")
|
||||
cfg = {"def_delta": delta, "rot_delta": rot_delta,
|
||||
"rot_stride": rot_stride,
|
||||
"fwd_row": row, "fwd_sign": sign,
|
||||
"fwd_row": row, "fwd_sign": sign, "fwd_cos": round(cos, 4),
|
||||
"va_lo": ENT_VA_LO, "va_hi": ENT_VA_HI}
|
||||
json.dump(cfg, open(sys.argv[3], "w"), indent=1)
|
||||
print("# wrote " + sys.argv[3] + ": " + json.dumps(cfg))
|
||||
|
||||
Reference in New Issue
Block a user