Files
claudeandClaude Opus 5.5 aa797580a7 #72: The packet ship, the lifeline mortar and the gull-kite
Eric chose option B on #72. The drop is now the GDD's launch:

- A packet ship sails a seeded straight line past the island, offshore,
  as close in as it can while keeping 45 m of open water from any land
  (eight-way probes; up to 32 headings, then the four world sides).
- Jump fires the lifeline mortar along the look heading. How high the
  player aims sets the charge (-10 to 45 degrees: 16 to 110 m/s over
  the ground; every shot climbs at 75 m/s). The climb can't be steered
  and the kite can't open until the arc tops out. Riders still aboard at
  the end are fired towards the middle of the island.
- Drop.reach() mirrors the fall for both ways down (kite at the top, or
  a fall with the kite opening by itself); bots, the soak and autoplay
  clients and the tutorial pilot aim with Drop.aim_charge().
- Bots fire at their landing spot once abeam of it, when in easy reach
  at their own staggered moment, or just before the route ends, and open
  the kite early only when the spot is beyond the rest of a fall.
- Art: VesselModels.ship() (two-masted packet, tanned square sails, a
  salt-white boot-top, a bowsprit and the mortar on its bed, mirrored to
  face the island), the figure's gull-kite (figure.py), and a lifeline
  cord from the muzzle to each player still climbing.
- Renamed barge to ship and wing-sail to gull-kite throughout code,
  tests, captures, docs and the tutorial text. make match now defaults to
  seed 2, where the scripted player still harvests and builds.

Closes #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:49:21 -05:00

181 lines
8.9 KiB
GDScript

extends TestCase
## Issue A5: world art. Points of interest, build piece states, the ship and chests,
## and no placeholder meshes left in the game.
## Primitive meshes that would be stand-ins for real models. PlaneMesh (the sea's
## shader surface) and QuadMesh (screen passes and rain) are surfaces, not models.
const PLACEHOLDER_CLASSES: Array[String] = ["BoxMesh", "SphereMesh", "CylinderMesh", "CapsuleMesh", "PrismMesh", "TorusMesh", "TextMesh", "PlaceholderMesh", "PlaceholderMaterial", "PlaceholderTexture"]
const PLACEHOLDER_WORDS: Array[String] = ["stand-in shape", "placeholder mesh", "blockout", "art pass replaces"]
static var _island: Island
static var _pois: PoiSet
func _placed() -> PoiSet:
if _pois == null:
_island = Island.generate(2)
_pois = PoiSet.generate(_island)
return _pois
func test_no_placeholder_meshes_or_resources_remain() -> void:
var files: PackedStringArray = PackedStringArray()
_collect("res://src", files)
_collect("res://assets", files)
assert_true(files.size() > 100, "found the game's files (%d)" % files.size())
for path: String in files:
assert_false(path.get_file().to_lower().contains("placeholder"), "%s is named as a placeholder" % path)
if not (path.ends_with(".gd") or path.ends_with(".tscn") or path.ends_with(".tres") or path.ends_with(".gdshader")):
continue
var text: String = FileAccess.get_file_as_string(path)
for name: String in PLACEHOLDER_CLASSES:
assert_false(text.contains(name), "%s uses %s" % [path, name])
var lower: String = text.to_lower()
for word: String in PLACEHOLDER_WORDS:
assert_false(lower.contains(word), "%s says '%s'" % [path, word])
func test_every_poi_is_dressed_within_its_parts() -> void:
var placed: PoiSet = _placed()
var kinds: Dictionary = {}
var known: Array[String] = [Poi.LOOK_TARRED_WOOD, Poi.LOOK_PLANK, Poi.LOOK_STONE, Poi.LOOK_ROOF, Poi.LOOK_PAINT, Poi.LOOK_SALT, Poi.LOOK_LAMP, Poi.LOOK_WINDOW]
for poi: Poi in placed.pois:
kinds[poi.kind] = true
var bounds: AABB = poi.parts[0]["box"]
var parts: int = 0
for part: Dictionary in poi.parts:
assert_true(known.has(String(part["look"])), "%s: unknown look %s" % [poi.kind, part["look"]])
bounds = bounds.merge(part["box"])
parts += 1
var mesh: ArrayMesh = PoiMesher.build(poi.parts)
var vertices: int = mesh.surface_get_array_len(PoiMesher.SURFACE_SOLID)
# Dressed, not one box per part: boards, courses and tiles add many.
assert_true(vertices > parts * 36 * 2, "%s: %d vertices for %d parts" % [poi.kind, vertices, parts])
assert_true(bounds.grow(0.06).encloses(mesh.get_aabb()), "%s: mesh %s strays outside its parts %s" % [poi.kind, mesh.get_aabb(), bounds])
for kind: String in PoiSet.ORDER:
assert_true(kinds.has(kind), "seed 2 has a %s to check" % kind)
func test_poi_meshes_are_the_same_every_time() -> void:
var poi: Poi = _placed().pois[0]
var first: PackedVector3Array = PoiMesher.build(poi.parts).surface_get_arrays(0)[Mesh.ARRAY_VERTEX]
var second: PackedVector3Array = PoiMesher.build(poi.parts).surface_get_arrays(0)[Mesh.ARRAY_VERTEX]
var first_colours: PackedColorArray = PoiMesher.build(poi.parts).surface_get_arrays(0)[Mesh.ARRAY_COLOR]
var second_colours: PackedColorArray = PoiMesher.build(poi.parts).surface_get_arrays(0)[Mesh.ARRAY_COLOR]
assert_eq(first, second)
assert_eq(first_colours, second_colours)
func test_huts_have_windows_that_do_not_block() -> void:
var placed: PoiSet = _placed()
var windows: int = 0
for poi: Poi in placed.pois:
for part: Dictionary in poi.parts:
if part["look"] == Poi.LOOK_WINDOW:
windows += 1
assert_false(poi.solids.has(part["box"]), "%s: a window is solid" % poi.kind)
assert_true(windows >= 4, "the island's huts have windows (%d)" % windows)
func test_the_light_glows_on_its_own_surface() -> void:
for poi: Poi in _placed().pois:
if poi.kind != "lighthouse":
continue
var mesh: ArrayMesh = PoiMesher.build(poi.parts)
assert_eq(mesh.get_surface_count(), 2)
var lit: StandardMaterial3D = mesh.surface_get_material(PoiMesher.SURFACE_LAMP)
assert_true(lit.emission_enabled)
return
assert_true(false, "seed 2 has a lighthouse")
func test_wear_and_building_stages() -> void:
assert_eq(PieceMesher.wear_of(0, 300), PieceMesher.INTACT)
assert_eq(PieceMesher.wear_of(101, 300), PieceMesher.INTACT)
assert_eq(PieceMesher.wear_of(102, 300), PieceMesher.WORN)
assert_eq(PieceMesher.wear_of(201, 300), PieceMesher.BATTERED)
assert_eq(PieceMesher.wear_of(299, 300), PieceMesher.BATTERED)
assert_eq(PieceMesher.built_of(0, 60), 1.0)
assert_eq(PieceMesher.built_of(60, 60), 0.25, "just placed still shows its first step")
assert_eq(PieceMesher.built_of(30, 60), 0.5)
assert_eq(PieceMesher.built_of(1, 60), 1.0)
assert_eq(PieceMesher.built_of(5, 0), 1.0)
func test_piece_meshes_show_wear_and_building_inside_their_box() -> void:
var slot: Vector4i = Vector4i(0, 0, 0, StructureSet.SLOT_WALL_X)
var boxes: Array[AABB] = StructureSet.boxes_for(StructureSet.WALL, slot, 0)
for material: int in 3:
var counts: Dictionary = {}
for wear: int in [PieceMesher.INTACT, PieceMesher.WORN, PieceMesher.BATTERED]:
var mesh: ArrayMesh = PieceMesher.build(boxes, material, 7, wear)
assert_true(boxes[0].grow(0.001).encloses(mesh.get_aabb()), "material %d wear %d stays in the wall" % [material, wear])
counts[wear] = mesh.surface_get_array_len(0)
assert_true(counts[PieceMesher.BATTERED] < counts[PieceMesher.INTACT], "material %d: battered strips are knocked out" % material)
var intact_colours: PackedColorArray = PieceMesher.build(boxes, material, 7).surface_get_arrays(0)[Mesh.ARRAY_COLOR]
var worn_colours: PackedColorArray = PieceMesher.build(boxes, material, 7, PieceMesher.WORN).surface_get_arrays(0)[Mesh.ARRAY_COLOR]
assert_ne(intact_colours, worn_colours, "material %d: wear shows" % material)
var half: ArrayMesh = PieceMesher.build(boxes, material, 7, PieceMesher.INTACT, 0.5)
var whole: ArrayMesh = PieceMesher.build(boxes, material, 7)
assert_true(half.surface_get_array_len(0) < whole.surface_get_array_len(0), "material %d: half built shows less" % material)
assert_true(boxes[0].grow(0.001).encloses(half.get_aabb()))
var ramp: AABB = PieceMesher.build_ramp(Vector4i(0, 0, 0, StructureSet.SLOT_VOLUME), 0, 0, 3).get_aabb()
var ramp_half: AABB = PieceMesher.build_ramp(Vector4i(0, 0, 0, StructureSet.SLOT_VOLUME), 0, 0, 3, PieceMesher.BATTERED, 0.5).get_aabb()
assert_true(ramp.grow(0.001).encloses(ramp_half))
func test_structure_view_redraws_a_piece_when_its_state_changes() -> void:
var sim: Simulation = Simulation.new(3, SimGround.flat())
var piece: StructureSet.Piece = sim.structures.add(StructureSet.WALL, Materials.STONE, Vector4i(2, 0, 2, StructureSet.SLOT_WALL_X), 0, 0, 0, sim.ground)
var view: StructureView = StructureView.new()
view.setup(sim.structures)
assert_eq(view.meshes_built, 1)
assert_eq(view.shown_state(piece.id), [PieceMesher.INTACT, 0.25])
view.sync()
assert_eq(view.meshes_built, 1, "nothing changed, nothing rebuilt")
sim.structures.set_progress(piece.id, piece.build_ticks, 0)
view.sync()
assert_eq(view.meshes_built, 2)
assert_eq(view.shown_state(piece.id), [PieceMesher.INTACT, 1.0])
var events: Array[Dictionary] = []
sim.structures.damage(piece.id, roundi(piece.max_health * 0.5), "test", sim.ground, events)
view.sync()
assert_eq(view.shown_state(piece.id), [PieceMesher.WORN, 1.0])
sim.structures.damage(piece.id, roundi(piece.max_health * 0.3), "test", sim.ground, events)
view.sync()
assert_eq(view.shown_state(piece.id), [PieceMesher.BATTERED, 1.0])
assert_eq(view.meshes_built, 4)
assert_eq(view.drawn_count(), 1)
view.free()
func test_ship_and_chest_models() -> void:
var ship: AABB = VesselModels.ship().get_aabb()
assert_near(ship.position.y, -VesselModels.HULL_DEPTH, 0.05, "hull bottom")
assert_true(ship.position.y < -Tuning.SHIP_DECK_HEIGHT, "the keel is under the waterline")
var tallest: float = 0.0
for mast: Vector2 in VesselModels.MASTS:
tallest = maxf(tallest, mast.y)
assert_near(ship.end.y, tallest, 0.3, "the mainmast is the top")
assert_true(ship.size.x >= 2.0 * VesselModels.HULL_HALF_BREADTH and ship.size.x < 12.0, "the yards are the widest part")
assert_true(ship.size.z >= 2.0 * VesselModels.HULL_HALF_LENGTH, "hull and bowsprit length")
# The mortar stands on the deck between the passengers and the foremast.
assert_true(VesselModels.MORTAR_AT.z - 0.8 > 2.5 * EntityView.DECK_SPACING + 0.3, "clear of the passengers")
assert_true(VesselModels.MORTAR_AT.z + 1.0 < VesselModels.MASTS[0].x, "clear of the foremast")
var chest: AABB = VesselModels.chest().get_aabb()
assert_near(chest.position.y, 0.0, 0.001, "chests stand on the ground")
assert_near(chest.size.y, VesselModels.CHEST_SIZE.y + 0.01, 0.02)
assert_true(chest.size.x < VesselModels.CHEST_SIZE.x + 0.1)
func _collect(dir_path: String, into: PackedStringArray) -> void:
var dir: DirAccess = DirAccess.open(dir_path)
if dir == null:
return
for name: String in dir.get_files():
into.append(dir_path.path_join(name))
for name: String in dir.get_directories():
if not name.begins_with("."):
_collect(dir_path.path_join(name), into)