Gameplay and UI - Research tree at the mothership gates which structures can be built and grants permanent fleet-capacity upgrades (GameState.SKILL_TREE, SkillTreeView). Node depth is derived from prerequisites, so the layout cannot drift out of step with the dependencies. - Building info popup before committing to a build, with per-building cost and description. - Ship crafter redrawn as a space factory with an assembly animation; mothership redrawn as a radial flagship; command centre as a plotting hub. - Keyboard and mouse support (WASD, Q/E pivot, wheel zoom) for the web build. - UI and font scaled up for phone use, via a custom Theme resource - gui/theme/default_font_size does not reach the default theme. - Asteroids no longer spawn on top of the fleet's start position. - Fleet formation origin derived from the layout's own offsets rather than the centroid, fixing the lurch when a lopsided formation started moving. - Fleet.stop() brakes from the ship's TRUE motion (velocity + fleet_velocity). Ship zeroes its velocity when seated in its slot even while the anchor drags that slot forward, so braking from velocity alone stopped the fleet dead instead of coasting - and whether it did depended on the frame rate. Animation architecture (issue #10) - Buildings, projectiles and explosion VFX no longer animate by redrawing. Static geometry is rasterised once in _draw(); moving parts are NeonPiece children animated through node properties, which reuse the cached geometry. Every NeonDraw call expands into four antialiased polylines, so redrawing to move something re-tessellated all of it. Test suite (issue #8): 1075s -> ~55s - Runs from a copy on Termux's own filesystem. The project lives on Android's FUSE bridge, read through proot, where load("res://Main.tscn") alone cost 8.5s per test against ~2s natively - and nearly every test loads it. - Runs 6 tests at a time, in a single proot-distro login, with output buffered per test and printed only on failure. - --fixed-fps 60 pins delta instead of measuring the wall clock, so a test's result no longer depends on how busy the machine is. Without it, parallelism made two tests fail on 2 of 3 runs. - A test passes only if it both exits 0 and prints ": PASS". - 38 tests, green on three consecutive runs. Bundles Carrois Gothic SC (Apache 2.0) with its licence text. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
93 lines
2.9 KiB
Shell
93 lines
2.9 KiB
Shell
#!/bin/bash
|
|
# Runs INSIDE the proot-distro Ubuntu container - do not call this directly,
|
|
# call tests/run_tests.sh from Termux instead.
|
|
#
|
|
# It exists as its own file so the whole suite runs in ONE `proot-distro
|
|
# login`: entering the container costs ~0.5s, which used to be paid 38 times
|
|
# over. Everything below is the container-side half of the runner.
|
|
#
|
|
# Args: <project_dir> <jobs> <verbose> <test_file_name>...
|
|
|
|
set -uo pipefail
|
|
|
|
PROJECT_DIR="$1"; shift
|
|
JOBS="$1"; shift
|
|
VERBOSE="$1"; shift
|
|
|
|
GODOT_BIN="/root/Godot_v4.7.1-stable_linux.arm64"
|
|
cd "$PROJECT_DIR" || exit 2
|
|
|
|
tests=("$@")
|
|
total=${#tests[@]}
|
|
if (( total == 0 )); then
|
|
echo "no tests matched"
|
|
exit 2
|
|
fi
|
|
|
|
outdir="$(mktemp -d)"
|
|
trap 'rm -rf "$outdir"' EXIT
|
|
|
|
# Import once, serially, before anything runs in parallel. Godot writes to
|
|
# .godot/ while importing; several instances discovering a cold cache at the
|
|
# same moment would race on it. After this the workers only read it.
|
|
"$GODOT_BIN" --headless --import --quit >/dev/null 2>&1
|
|
|
|
run_one() {
|
|
local name="$1"
|
|
local log="$outdir/$name.log"
|
|
local start end
|
|
start=$(date +%s%N)
|
|
# --fixed-fps pins delta to exactly 1/60 instead of measuring the wall
|
|
# clock. Without it a test's `elapsed` counts REAL seconds, so running
|
|
# several at once stretches every frame and the gameplay under test sees
|
|
# deltas it never sees in the game: ships overshoot their braking curve,
|
|
# settle late, and tests time out for no reason but load. That made
|
|
# test_camera_settles and test_planet_prompt_map_interaction fail on 2 of
|
|
# 3 parallel runs. Pinned, a test simulates the same 60fps whatever else
|
|
# the phone is doing, and its result no longer depends on how busy the
|
|
# machine was.
|
|
"$GODOT_BIN" --headless --fixed-fps 60 -s "res://tests/$name" >"$log" 2>&1
|
|
local rc=$?
|
|
end=$(date +%s%N)
|
|
local ms=$(( (end - start) / 1000000 ))
|
|
|
|
# Two independent criteria, because either one alone can lie: a test that
|
|
# crashes before reaching its verdict exits non-zero without ever printing
|
|
# FAIL, and a hypothetical `quit(0)` on a failing path would exit clean
|
|
# while the log says otherwise.
|
|
if (( rc == 0 )) && grep -q ": PASS" "$log"; then
|
|
printf 'PASS %6dms %s\n' "$ms" "$name" > "$outdir/$name.status"
|
|
else
|
|
printf 'FAIL %6dms %s (exit %d)\n' "$ms" "$name" "$rc" > "$outdir/$name.status"
|
|
fi
|
|
cat "$outdir/$name.status"
|
|
}
|
|
|
|
running=0
|
|
for name in "${tests[@]}"; do
|
|
run_one "$name" &
|
|
running=$(( running + 1 ))
|
|
if (( running >= JOBS )); then
|
|
wait -n
|
|
running=$(( running - 1 ))
|
|
fi
|
|
done
|
|
wait
|
|
|
|
failed=0
|
|
for name in "${tests[@]}"; do
|
|
if ! grep -q '^PASS' "$outdir/$name.status" 2>/dev/null; then
|
|
failed=$(( failed + 1 ))
|
|
echo
|
|
echo "=== $name FAILED, full output ==="
|
|
cat "$outdir/$name.log" 2>/dev/null
|
|
elif [[ "$VERBOSE" == "1" ]]; then
|
|
echo
|
|
echo "=== $name ==="
|
|
cat "$outdir/$name.log" 2>/dev/null
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo "$(( total - failed ))/$total passed"
|
|
(( failed == 0 ))
|