Files
windroost/p2_godot_sample/scripts/gameplay_attack_capture.gd
T
wushenghua 9ae977935c art: record real gameplay clip with manual-click-triggered hero attack
Owner said the effects can be reviewed locally, so I reviewed a 5 s real
auto-battle frame-by-frame (static screenshots had missed it). Added a capture
that injects an authoritative click_enemy event during real rendered gameplay
and records 90 frames, so the newly wired play_team_attack() can be seen on the
real event path. Frame review confirmed H01 in a spear-thrust attack pose at
mid-click (f16) vs upright idle after recovery (f45).

Encoded a 3 s 720p MP4 with real ElevenLabs BGM + provenance:
PRODUCTION/source/store/promo/windroost_attack_gameplay.mp4.
Genuine gameplay footage, not an AI cinematic. Intermediate frames gitignored.

Full gate P2_CHECKS_PASS. prototype/ untracked.
2026-11-18 10:56:03 +08:00

61 lines
2.0 KiB
GDScript

extends SceneTree
## Record real rendered gameplay WITH a manual click, so the newly wired
## play_team_attack() fires on the authoritative event path. Outputs numbered
## PNGs for frame review / mp4 encoding. Real window rendering (opengl3).
const OUTPUT_DIR := "res://artifacts/gameplay_attack_frames/"
const LOGICAL := Vector2i(390, 844)
const SCALE := 3
const FRAMES := 90
func _init() -> void:
_run.call_deferred()
func _wait_frames(count: int) -> void:
for _i in range(count):
await process_frame
func _run() -> void:
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(OUTPUT_DIR))
var root := get_root()
await _wait_frames(4)
root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
root.content_scale_size = LOGICAL
root.size = LOGICAL * SCALE
await _wait_frames(4)
var shell := load("res://scenes/game_root.tscn").instantiate() as GameRoot
root.add_child(shell)
shell.reset_profile_for_test()
shell.start_node("R1-C01-N02")
await _wait_frames(10)
var battle := shell.get_battle()
battle.set_process(false) # drive sim manually; UnitViews still get real delta
# Baseline frames before the click (idle breathing).
for i in range(12):
var img0 := root.get_texture().get_image()
img0.save_png(ProjectSettings.globalize_path(OUTPUT_DIR.path_join("frame_%04d.png" % i)))
await process_frame
# Authoritative manual actions: a click then a storm command. These drive
# play_team_attack() through _scan_battle_events(), the real player path.
P2BattleSim.inject_input(battle.state, {
"time": float(battle.state["time"]), "type": "click_enemy",
"target_id": str(battle.state["enemies"][0]["content_id"]),
})
for i in range(12, FRAMES):
battle.advance_by_delta(0.03) # processes the event + advances sim
var img := root.get_texture().get_image()
img.save_png(ProjectSettings.globalize_path(OUTPUT_DIR.path_join("frame_%04d.png" % i)))
await process_frame
root.remove_child(shell)
shell.queue_free()
print("ATK_CAPTURE frames=%d" % FRAMES)
quit(0)