Ashlar checks / tooling (push) Successful in 5s
- Shoulder view, auto shoulder switch, standing preview, deferred preview rotation, move 360, smooth view change and [Game] smooth movement are on by default. - Collision ease-out: the camera still snaps in on collision but eases back out (0.15 s half-life, 60 u/s minimum speed). - Aim mode: with a ranged weapon or a spell readied in third person the view stays over the shoulder, moves closer and narrows the FOV. Camera interface v2 adds getAimWeight and enable/disable functions. - Pure math in camera/ease.lua with unit tests; SCENARIO=camera with PASS/FAIL checks; docs in docs/ashlar/CAMERA.md. - ashlar-run.sh deletes stored Lua settings before each run so changed defaults are tested. Closes #29 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
109 lines
5.5 KiB
Bash
Executable File
109 lines
5.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Boots the built engine on the asset-free Game Template on a virtual display
|
|
# and saves a screenshot. Run docker/ashlar-build.sh first.
|
|
#
|
|
# SCENARIO=combat also loads docker/scenarios/combat, our own CC0 test content: a hostile duelist with a shield
|
|
# and blade fights the player, and block events are summarized at the end. SCENARIO=movement logs the player's
|
|
# speed as it starts, stops and reverses. SCENARIO=mantle jumps the player at a test ledge. SCENARIO=camera checks
|
|
# the third person camera: shoulder view, collision ease-out and aim mode. See docs/ashlar/SCENARIOS.md.
|
|
set -euo pipefail
|
|
|
|
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cache="${ASHLAR_CACHE_DIR:-$HOME/.cache/ashlar}"
|
|
scenario="${SCENARIO:-}"
|
|
if [ -n "$scenario" ]; then
|
|
boot_seconds="${BOOT_SECONDS:-150}"
|
|
else
|
|
boot_seconds="${BOOT_SECONDS:-90}"
|
|
fi
|
|
memory="${MEMORY:-6g}"
|
|
image="ashlar-build:trixie"
|
|
suite="$cache/content/example-suite"
|
|
run="$cache/run"
|
|
|
|
[ -x "$cache/build/openmw" ] || { echo "Run docker/ashlar-build.sh first." >&2; exit 1; }
|
|
[ -d "$suite" ] || git clone --depth 1 https://gitlab.com/OpenMW/example-suite.git "$suite"
|
|
|
|
docker build -q -t "$image" -f "$repo/docker/Dockerfile.ashlar" "$repo/docker" >/dev/null
|
|
|
|
mkdir -p "$run/home/.config/openmw"
|
|
# Start every run from the built-in Lua setting defaults. Stored values from an earlier run would otherwise hide
|
|
# changed defaults (the camera settings did exactly that).
|
|
rm -f "$run/home/.config/openmw/player_storage.bin" "$run/home/.config/openmw/global_storage.bin"
|
|
cat > "$run/home/.config/openmw/openmw.cfg" <<'EOF'
|
|
data="/cache/content/example-suite/game_template/data"
|
|
content=template.omwgame
|
|
EOF
|
|
scenario_mount=()
|
|
if [ -n "$scenario" ]; then
|
|
[ -f "$repo/docker/scenarios/$scenario/ashlar$scenario.omwscripts" ] \
|
|
|| { echo "Unknown scenario: $scenario" >&2; exit 1; }
|
|
printf 'data="/scenario"\ncontent=ashlar%s.omwscripts\n' "$scenario" >> "$run/home/.config/openmw/openmw.cfg"
|
|
scenario_mount=(--volume "$repo/docker/scenarios/$scenario:/scenario:ro")
|
|
fi
|
|
{
|
|
cat "$suite/settings.cfg"
|
|
printf '\n[Video]\nresolution x = 1280\nresolution y = 720\nwindow mode = 2\n'
|
|
} > "$run/home/.config/openmw/settings.cfg"
|
|
|
|
docker run --rm \
|
|
--memory="$memory" \
|
|
--user "$(id -u):$(id -g)" \
|
|
--env HOME=/cache/run/home \
|
|
--env DISPLAY=:99 \
|
|
--env LIBGL_ALWAYS_SOFTWARE=1 \
|
|
--volume "$cache:/cache" \
|
|
"${scenario_mount[@]}" \
|
|
--workdir /cache/build \
|
|
"$image" bash -uc "
|
|
Xvfb :99 -screen 0 1280x720x24 +extension GLX >/dev/null 2>&1 &
|
|
sleep 2
|
|
./openmw --skip-menu --new-game --no-sound $* > /cache/run/stdout.log 2>&1 &
|
|
game=\$!
|
|
sleep '$boot_seconds'
|
|
if ! kill -0 \$game 2>/dev/null; then
|
|
wait \$game; status=\$?
|
|
echo \"openmw exited early with status \$status\"
|
|
tail -40 /cache/run/stdout.log
|
|
exit 1
|
|
fi
|
|
import -window root /cache/run/boot.png
|
|
kill \$game
|
|
wait \$game 2>/dev/null
|
|
echo 'openmw still running at screenshot time'
|
|
exit 0
|
|
"
|
|
echo "Screenshot: $run/boot.png"
|
|
if [ -n "$scenario" ]; then
|
|
echo "Scenario $scenario:"
|
|
grep -E 'ASHLAR_(COMBAT|MANTLE)|Ashlar (block|reaction|stamina|mantle):|scripts/ashlar' "$run/stdout.log" \
|
|
| tail -60 || true
|
|
fi
|
|
if [ "$scenario" = movement ]; then
|
|
grep -E 'ASHLAR_MOVE .*(phase|reached|stopped)|Ashlar sprint:' "$run/stdout.log" || true
|
|
echo "Frames logged: $(grep -c 'ASHLAR_MOVE .* applied=' "$run/stdout.log" || true)"
|
|
for p in sprint tiredsprint sprintuse; do
|
|
echo "Highest speed in $p (share of run speed): $(grep -oP "ASHLAR_MOVE $p applied=\S+ speed=\K[0-9.]+" \
|
|
"$run/stdout.log" | sort -n | tail -1)"
|
|
done
|
|
elif [ "$scenario" = mantle ]; then
|
|
echo "Engine mantles: $(grep -c 'Ashlar mantle: .* climbs' "$run/stdout.log" || true)"
|
|
grep -E 'ASHLAR_MANTLE result' "$run/stdout.log" || true
|
|
elif [ "$scenario" = camera ]; then
|
|
grep -E 'ASHLAR_CAMERA (phase|interface|wall|bow)' "$run/stdout.log" || true
|
|
python3 "$repo/scripts/ashlar_camera_summary.py" "$run/stdout.log" || true
|
|
elif [ -n "$scenario" ]; then
|
|
echo "Player blocks: $(grep -ci 'Ashlar block: "player" blocked' "$run/stdout.log" || true)"
|
|
echo "Player parries: $(grep -ci 'Ashlar block: "player" blocked .* with weapon' "$run/stdout.log" || true)"
|
|
echo "NPC blocks: $(grep 'Ashlar block:' "$run/stdout.log" | grep -vci 'Ashlar block: "player" blocked' || true)"
|
|
echo "Flinches: $(grep -c 'Ashlar reaction: .* flinches' "$run/stdout.log" || true)"
|
|
echo "Interrupted wind-ups: $(grep -c 'Ashlar reaction: .* wind-up interrupted' "$run/stdout.log" || true)"
|
|
echo "Attacker staggers: $(grep 'Ashlar reaction: .* recoils' "$run/stdout.log" | grep -vc 'staggers 0s' || true)"
|
|
echo "Refused attacks (too tired): $(grep -c 'Ashlar stamina: .* too tired to attack' "$run/stdout.log" || true)"
|
|
echo "Capped attacks: $(grep -c 'Ashlar stamina: .* capped to' "$run/stdout.log" || true)"
|
|
# Between the duelist's "ignoreStagger on" and "off" markers, its hits set ignoreStagger and it must not flinch.
|
|
window="$(sed -n '/ASHLAR_COMBAT npc ignoreStagger on/,/ASHLAR_COMBAT npc ignoreStagger off/p' "$run/stdout.log")"
|
|
echo "ignoreStagger hits: $(grep -c 'npc hit successful=true.*ignoreStagger=true' <<<"$window" || true)"
|
|
echo "Duelist flinches in window: $(grep 'Ashlar reaction: .* flinches' <<<"$window" | grep -vci '"player" flinches' || true)"
|
|
fi
|