capture drivers: real 1x, one window at a time

A POKEPORT_DRIVER run is deliberately unpaced -- main.lua's pacingEnabled()
returns false whenever the variable is set, so love.run spins as fast as the
machine allows and takes one Game:update(1/60) per turn of the loop. Right
for a screenshot script, wrong for a recording: "wait 180 frames" is three
seconds only by coincidence of hardware.

No engine change needed. The loop is blocked while the driver coroutine is
running, so sleeping inside it before each yield paces the whole thing -- one
logic step per one sixtieth of real time, 1x by construction. Measured with
DS_AUTOCLOSE: asked for 6.0s, took 6.31s, and it errs slow rather than fast.

shiny_one.lua does ONE encounter and then never finishes, which is how the
window stays up: main.lua quits the moment a driver coroutine goes dead. So
closing the window by hand is what ends the take. shiny_run.sh launches the
five in turn and blocks on each, so the next never opens over the top of one
still being recorded, and a bad take can just be closed and re-run.

It also puts options.lua back afterwards. The game persists the whole options
table mid-run, so every capture leaves its display settings on disk.
This commit is contained in:
DramaticShape
2026-08-08 13:22:52 -04:00
parent 322defbbd0
commit 120f9716b6
3 changed files with 299 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Five shiny encounters, five outdoor places, one window at a time.
#
# bash mods/DramaticShapeVoxelMod/tests/shiny_run.sh
#
# Run from the PROJECT ROOT.
#
# Each Pokemon gets its OWN game window, launched only after the previous one
# has been closed -- the loop blocks on the process, so closing the window is
# what advances it. Nothing is on a timer, so a take can be as long as it
# needs to be, and a bad one can just be closed and re-run.
#
# The battles run at true 1x: tests/shiny_one.lua paces itself against the
# wall clock, because a POKEPORT_DRIVER run is otherwise unpaced and goes as
# fast as the machine can manage.
set -u
LOVE=${LOVE:-/c/Program Files/LOVE/lovec.exe}
DRIVER=mods/DramaticShapeVoxelMod/tests/shiny_one.lua
# species | level | map | cell x | cell y
RUNS=(
"BLASTOISE|45|PALLET_TOWN|5|6"
"PIDGEOTTO|32|ROUTE_1|5|8"
"GYARADOS|45|CERULEAN_CITY|10|12"
"CHARIZARD|50|ROUTE_4|10|5"
"NINETALES|42|ROUTE_25|12|5"
)
OPTS="$APPDATA/LOVE/pokemon-love2d/options.lua"
if [ -f "$OPTS" ]; then
cp "$OPTS" "$OPTS.shiny_run_backup"
echo "backed up options.lua"
fi
i=0
for row in "${RUNS[@]}"; do
i=$((i + 1))
IFS='|' read -r SPECIES LEVEL MAP CX CY <<< "$row"
echo ""
echo "=== $i/5 $SPECIES at $MAP ==="
echo " close the window when you are done recording it"
DS_SPECIES="$SPECIES" DS_LEVEL="$LEVEL" DS_MAP="$MAP" \
DS_CX="$CX" DS_CY="$CY" \
POKEPORT_DRIVER="$DRIVER" "$LOVE" .
done
# The game persists the whole options table mid-run (OverworldBattle.forceOG),
# so a run leaves the display settings it used on disk. Put them back.
if [ -f "$OPTS.shiny_run_backup" ]; then
cp "$OPTS.shiny_run_backup" "$OPTS"
echo ""
echo "options.lua restored"
fi
echo "done -- five encounters"