Task #19: UFO model built from primitives

UFOs no longer reuse the crow's bird mesh. EnemySystem.build_ufo_mesh()
merges the mesh arrays of two CylinderMesh hull halves, a TorusMesh rim, a
hemisphere SphereMesh dome and eight small sphere lights into one ArrayMesh
(about 1.65 m across, -0.13..0.45 m about its origin), with per-part vertex
colors and (glow, metalness) in UV.

A second HordeRenderer (ufo_renderer) draws it with the new
game/resources/ufo.gdshader: albedo from COLOR, no flap, a slow spin and bob
with a per-enemy phase, chasing rim lights, and the bird shader's hit flash
(INSTANCE_CUSTOM.g) and night_glow. Both batches mirror the dense slots
(write_new, move_slot, clear), and commit_render scales each slot to nothing
in the batch that doesn't draw its type. DayNight now takes a list of enemy
materials and sets night_glow on both.

UFOs get their own arrival cue (kenney/digital/powerUp2.ogg, previously
unused) instead of the crow's caw. HordeRenderer.is_drawn() backs the new
test_roster checks: a UFO is drawn by the UFO batch only, a crow by the
bird batch only, a thief by neither, also after a swap-removal; and the
saucer's size and centering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-06 12:55:14 -04:00
parent 26b735d3e6
commit 9cb01f1ede
8 changed files with 264 additions and 35 deletions

View file

@ -176,7 +176,10 @@ func _ready() -> void:
add_child(characters)
var mat := ShaderMaterial.new()
mat.shader = load("res://game/resources/thief.gdshader") as Shader
enemies.setup(config, nav, behavior, EnemySystem.build_bird_mesh(0.0055), mat, zones.playable.grow(12.0))
var ufo_mat := ShaderMaterial.new()
ufo_mat.shader = load("res://game/resources/ufo.gdshader") as Shader
enemies.setup(config, nav, behavior, EnemySystem.build_bird_mesh(0.0055), mat, zones.playable.grow(12.0),
EnemySystem.build_ufo_mesh(), ufo_mat)
characters.setup(enemies, config)
enemies.characters = characters
loot.animals = animals
@ -251,7 +254,7 @@ func _ready() -> void:
day_night.name = "DayNight"
add_child(day_night)
day_night.characters = characters
day_night.setup(campaign, sun, world_environment.environment, player, mat)
day_night.setup(campaign, sun, world_environment.environment, player, [mat, ufo_mat])
build = BuildMode.new()
build.name = "Build"
add_child(build)