Files
Papay-Shooter/debug/fp_weapon_capture.gd
T
Nicholas ButzkeandClaude Opus 5 2efc21b18d feat(menu): PLAY is one press, and the level cards are photographs
Reaching a game was Singleplayer → pick a level. Reaching a multiplayer game
was Multiplayer → Host Game → wait → pick a level → wait, and the gamemode
dropdown had exactly one entry which set a string nothing read.

PLAY now starts the last map and mode played, and says which — "Akiba Crossing
• Deathmatch" under the button, so pressing it is a promise rather than a leap.
Everything else on the home screen is a detour from that, which is the right
shape for a menu: the common case is a button, not a path. Hosting is one press
and lands in the lobby already hosting; the lobby puts map, mode, players and
start on ONE screen; Enter connects, so typing an address does not then require
reaching for the mouse.

This is the lesson HoYoverse published about Zenless Zone Zero's first months
more loudly than anything else they have written. Their postmortem on the TV
mode names three complaints — it took too long, it sat between the player and
the combat, and there was too much of it early — and 1.2 removed it from the
story entirely rather than shortening it. Time spent BEFORE the thing the
player came for is not neutral, it is a cost.

The cards were a two-stop gradient generated from two colours in a meta file,
whose hover state was `use_hdr = true` — not a visible change on any of them.
They are photographs now, shot by debug/map_preview_capture.gd, which took
three attempts to get right and each attempt is a comment in the file:

  - framing each map from OUTSIDE by merging every VisualInstance3D's AABB
    produced five tiny dioramas floating on a table, and one solid black
    rectangle. That is a minimap, and a minimap is not a photograph.
  - standing at a spawn point fixed three maps and left two black: fps_blockout
    is genuinely dark and most of its spawns face an unlit wall, and
    procedural_arena builds its geometry at runtime so no fixed offset is
    reliably inside it.
  - so the tool now RENDERS several vantages and scores each result — mean
    luminance times its standard deviation, because brightness alone picks the
    empty sky and variance alone picks a high-contrast corner of a dark room.
    Their product picks a photograph. A black rectangle passes any check that
    only asks whether the camera ended up somewhere sensible.

Also fixed, and caught by looking at the screenshot: the selected mode chip was
unreadable. Its glyph is ink on volt, and the theme gave every button a 5 px INK
outline — an ink glyph inside an ink outline is not outlined, it is five pixels
fatter, and on a small chip that is a solid blob. Button labels now carry no
outline at all, which is the same reasoning debug/ui_contrast_check.gd already
encodes: an outline separates a glyph from a backdrop it cannot beat alone, and
a label on a solid chip does not have that problem. The chips keep their heavy
ink border, so nothing about the drawn look changes.

`current_gamemode` is normalised on the way in, because it used to hold a
display string and six callers still pass one. An unrecognised id compares
unequal to GameMode.GUN_GAME and would silently disable that mode's weapon
issuing — half a mode is worse than none.

The menu's background character is the player's OWN skin holding their weapon,
rather than the box-and-capsule mannequin that stood there before.

spawn smoke 0, game modes 30/30, movement 11/11, contrast 108/108, HUD layout
PASS, weapon holds 0, dances 0.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-07-28 12:40:50 -04:00

157 lines
4.2 KiB
GDScript

extends SceneTree
## Dev tool: screenshot first-person weapon choreography — reload phases for
## representative weapons (mag / boltmag / tube / break), the knife slash,
## and the fire kick. Run:
## godot --path . --windowed --resolution 1280x720 -s res://debug/fp_weapon_capture.gd -- <out_dir>
var _frames := 0
var _out_dir := "."
var _player: Node = null
var _wman: Node = null
var _mode := "boot"
var _phase_frame := 0
var _step := 0
# [tag, slot, weapon_id, screenshot fractions of reload_time]
# Slots 11+ so the loadout's own weapons get properly hidden by _equip_slot
# (re-spawning INTO an occupied slot leaves the old node visible).
var _weapons := [
["m4", 11, "m4", [0.12, 0.25, 0.38, 0.55, 0.72, 0.9]],
["awp", 12, "awp", [0.3, 0.6, 0.85]],
["rocket", 13, "rocket_launcher", [0.25, 0.55, 0.8]],
["shotgun", 14, "double_barrel_shotgun", [0.25, 0.6, 0.9]],
]
var _wi := 0
var _shots: Array = []
var _reload_T := 0.0
var _reload_start_ms := 0
func _initialize() -> void:
var args := OS.get_cmdline_user_args()
if args.size() > 0:
_out_dir = args[0]
change_scene_to_file("res://ui/main_menu/main_menu.tscn")
func _process(_delta: float) -> bool:
_frames += 1
if _mode == "boot":
if _frames == 40:
var nm = root.get_node_or_null("NetworkManager")
if nm and nm.has_method("start_singleplayer_match"):
nm.start_singleplayer_match(GameMode.DEATHMATCH)
change_scene_to_file("res://scenes/maps/test_level/test_level.tscn")
elif _frames >= 160:
for p in root.find_children("*", "CharacterBody3D", true, false):
if p.has_method("get_visual_model") and p.is_multiplayer_authority():
_player = p
break
if not _player:
printerr("fp_capture: no player")
return true
_wman = _player.get_node_or_null("HeadPivot/Camera3D/WeaponManager")
if not _wman:
for c in _player.find_children("*", "Node", true, false):
if c.name == "WeaponManager":
_wman = c
break
if not _wman:
printerr("fp_capture: no WeaponManager")
return true
_player.set_physics_process(false)
_player.global_position = Vector3(0, 1.2, 14)
_mode = "spawn"
return false
if _mode == "spawn":
# Force-spawn the test weapons into known slots.
for w in _weapons:
_wman._spawn_weapon(w[1], w[2])
_mode = "next_weapon"
return false
if _mode == "next_weapon":
if _wi >= _weapons.size():
_mode = "knife_equip"
_phase_frame = 0
return false
var entry: Array = _weapons[_wi]
_wman._equip_slot(entry[1])
_phase_frame = 0
_mode = "reload_start"
return false
if _mode == "reload_start":
_phase_frame += 1
if _phase_frame < 15:
return false
var entry: Array = _weapons[_wi]
var w = _wman.weapons.get(entry[1])
if w == null:
_wi += 1
_mode = "next_weapon"
return false
# Drain ammo state and kick off the reload.
w._start_reload()
_reload_T = w.reload_time
_shots = entry[3].duplicate()
_reload_start_ms = Time.get_ticks_msec()
_mode = "reload_watch"
return false
if _mode == "reload_watch":
var entry: Array = _weapons[_wi]
var elapsed := (Time.get_ticks_msec() - _reload_start_ms) / 1000.0
if _shots.size() > 0:
if elapsed >= float(_shots[0]) * _reload_T:
_snap("fp_%s_reload_%d" % [entry[0], entry[3].size() - _shots.size() + 1])
_shots.pop_front()
elif elapsed >= _reload_T + 0.3:
_wi += 1
_mode = "next_weapon"
return false
if _mode == "knife_equip":
_wman._equip_slot(4)
_phase_frame = 0
_mode = "knife_swing"
return false
if _mode == "knife_swing":
_phase_frame += 1
if _phase_frame == 20:
var knife = _wman.weapons.get(4)
if knife and knife.has_method("_swing"):
knife._swing()
elif _phase_frame == 26:
_snap("fp_knife_windup")
elif _phase_frame == 32:
_snap("fp_knife_slash")
elif _phase_frame >= 60:
_mode = "kick"
_phase_frame = 0
return false
if _mode == "kick":
_phase_frame += 1
if _phase_frame == 5:
_wman._equip_slot(11)
elif _phase_frame == 30:
var w = _wman.weapons.get(11)
if w:
w._fire()
elif _phase_frame == 33:
_snap("fp_m4_kick")
return true
return false
return false
func _snap(tag: String) -> void:
var img := root.get_viewport().get_texture().get_image()
var path := _out_dir + "/" + tag + ".png"
img.save_png(path)
print("fp_capture: saved ", path)