#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>
This commit is contained in:
@@ -40,25 +40,25 @@ func test_offline_play_goes_through_the_same_client_against_a_local_server() ->
|
||||
assert_null(session.link)
|
||||
assert_null(session.game.net, "no socket: the packets are handed across")
|
||||
var server: ServerLoop = session.local.loop
|
||||
var seen_barge: bool = false
|
||||
var seen_ship: bool = false
|
||||
var most_figures: int = 0
|
||||
var landed_frame: int = -1
|
||||
for frame: int in 60 * 150:
|
||||
session.pump(FRAME)
|
||||
if session.view != null:
|
||||
most_figures = maxi(most_figures, session.view.entities.figure_count())
|
||||
if session.view.entities.barge().visible and session.mirror.own_id != 0:
|
||||
if not seen_barge:
|
||||
seen_barge = true
|
||||
if session.view.entities.ship().visible and session.mirror.own_id != 0:
|
||||
if not seen_ship:
|
||||
seen_ship = true
|
||||
var figure: Node3D = session.view.entities.figure_of(session.mirror.own_id)
|
||||
assert_not_null(figure, "the client's own player is drawn")
|
||||
assert_true(figure.position.distance_to(session.view.entities.barge().position) < 6.0, "on the barge's deck")
|
||||
assert_true(figure.position.distance_to(session.view.entities.ship().position) < 6.0, "on the ship's deck")
|
||||
assert_true(session.view.camera.position.distance_to(figure.position) < 9.0, "the camera is on its shoulder")
|
||||
if landed_frame < 0 and session.game.playing() and _own().drop_state == Drop.NONE:
|
||||
landed_frame = frame
|
||||
if landed_frame >= 0 and frame > landed_frame + 60 * 8:
|
||||
break
|
||||
assert_true(seen_barge)
|
||||
assert_true(seen_ship)
|
||||
assert_true(landed_frame > 0, "the scripted player leapt and came down")
|
||||
assert_eq(session.phases[0], Match.DROP)
|
||||
assert_eq(most_figures, 4, "all four players were drawn at once")
|
||||
|
||||
@@ -157,7 +157,7 @@ func test_glide_shows_the_sail_and_hides_the_held_item() -> void:
|
||||
player.drop_state = Drop.GLIDING
|
||||
player.on_ground = false
|
||||
figure.drive(player, 0.0)
|
||||
assert_true(figure.sail().visible)
|
||||
assert_true(figure.kite().visible)
|
||||
assert_false(figure.hand().visible)
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ func _bounds() -> AABB:
|
||||
var first: bool = true
|
||||
for node: Node in figure.find_children("*", "MeshInstance3D", true, false):
|
||||
var part: MeshInstance3D = node
|
||||
if part.mesh == null or not part.is_visible_in_tree() or part.name == "sail":
|
||||
if part.mesh == null or not part.is_visible_in_tree() or part.name == "kite":
|
||||
continue
|
||||
var box: AABB = figure.relative(part) * part.mesh.get_aabb()
|
||||
out = box if first else out.merge(box)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
extends TestCase
|
||||
|
||||
## The client's picture of a match (issue M8): one view over a simulation, with every
|
||||
## player, the barge, items and chests drawn from it.
|
||||
## player, the ship, items and chests drawn from it.
|
||||
|
||||
|
||||
func _match(bots: int = 3) -> ServerLoop:
|
||||
return ServerLoop.new(2, 1, bots)
|
||||
|
||||
|
||||
func test_draws_every_player_and_the_barge() -> void:
|
||||
func test_draws_every_player_and_the_ship() -> void:
|
||||
var loop: ServerLoop = _match()
|
||||
var view: MatchView = MatchView.new()
|
||||
view.setup(loop.sim, 1)
|
||||
assert_eq(view.entities.figure_count(), 4)
|
||||
assert_true(view.entities.barge().visible)
|
||||
assert_true(view.entities.barge().position.distance_to(loop.sim.drop.barge_position(loop.sim.tick)) < 0.001)
|
||||
assert_true(view.entities.ship().visible)
|
||||
assert_true(view.entities.ship().position.distance_to(loop.sim.drop.ship_position(loop.sim.tick)) < 0.001)
|
||||
# Passengers are spread over the deck, not stacked on one spot.
|
||||
assert_true(view.entities.figure_of(1).position.distance_to(view.entities.figure_of(2).position) > 1.0)
|
||||
assert_eq(view.entities.pickup_count(), loop.sim.pickups.size())
|
||||
@@ -33,7 +33,7 @@ func test_follows_the_simulation() -> void:
|
||||
loop.run_tick()
|
||||
loop.sim.set_sea_level(6.5)
|
||||
view.sync()
|
||||
assert_false(view.entities.barge().visible, "the barge is gone once the drop is over")
|
||||
assert_false(view.entities.ship().visible, "the ship is gone once the drop is over")
|
||||
assert_false(view.entities.figure_of(3).visible, "an eliminated player isn't drawn")
|
||||
var bot: SimEntity = loop.sim.entities.find(2)
|
||||
if not bot.eliminated:
|
||||
@@ -43,12 +43,12 @@ func test_follows_the_simulation() -> void:
|
||||
view.free()
|
||||
|
||||
|
||||
func test_gliding_players_show_a_wing_sail() -> void:
|
||||
func test_gliding_players_show_a_gull_kite() -> void:
|
||||
var loop: ServerLoop = _match(1)
|
||||
var view: MatchView = MatchView.new()
|
||||
view.setup(loop.sim, 1)
|
||||
var bot: SimEntity = loop.sim.entities.find(2)
|
||||
assert_false(view.entities.figure_of(2).sail().visible)
|
||||
assert_false(view.entities.figure_of(2).kite().visible)
|
||||
var guard: int = 0
|
||||
while bot.drop_state != Drop.GLIDING and guard < 3000:
|
||||
loop.run_tick()
|
||||
@@ -56,7 +56,43 @@ func test_gliding_players_show_a_wing_sail() -> void:
|
||||
view.sync()
|
||||
view.entities.animate(0.1)
|
||||
assert_eq(bot.drop_state, Drop.GLIDING)
|
||||
assert_true(view.entities.figure_of(2).sail().visible)
|
||||
assert_true(view.entities.figure_of(2).kite().visible)
|
||||
view.free()
|
||||
|
||||
|
||||
func test_a_player_climbing_the_arc_trails_a_lifeline_from_the_mortar() -> void:
|
||||
var loop: ServerLoop = _match(1)
|
||||
var view: MatchView = MatchView.new()
|
||||
view.setup(loop.sim, 1)
|
||||
var bot: SimEntity = loop.sim.entities.find(2)
|
||||
assert_eq(view.entities.lifeline_count(), 0)
|
||||
var guard: int = 0
|
||||
while bot.drop_state == Drop.ABOARD and guard < 3000:
|
||||
loop.run_tick()
|
||||
guard += 1
|
||||
loop.run_tick()
|
||||
view.sync()
|
||||
assert_true(bot.velocity.y > 0.0, "the bot should be climbing")
|
||||
assert_true(view.entities.lifeline_count() >= 1)
|
||||
# The line runs from the mortar's muzzle to the player.
|
||||
var line: MeshInstance3D = view.entities.get_node("Lifeline0")
|
||||
var from: Vector3 = view.entities.ship().transform * VesselModels.muzzle()
|
||||
var to: Vector3 = bot.position + Vector3(0.0, 1.0, 0.0)
|
||||
assert_true((line.transform * Vector3(0.0, 0.0, 0.5)).distance_to(from) < 0.05 or (line.transform * Vector3(0.0, 0.0, -0.5)).distance_to(from) < 0.05, "one end at the muzzle")
|
||||
assert_true((line.transform * Vector3(0.0, 0.0, 0.5)).distance_to(to) < 0.05 or (line.transform * Vector3(0.0, 0.0, -0.5)).distance_to(to) < 0.05, "the other end at the player")
|
||||
# The ship's mortar faces the island.
|
||||
var ship: Node3D = view.entities.ship()
|
||||
var muzzle: Vector3 = ship.transform * VesselModels.muzzle()
|
||||
var centre: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5
|
||||
var out: Vector2 = Vector2(muzzle.x - ship.position.x, muzzle.z - ship.position.z)
|
||||
var to_centre: Vector2 = centre - Vector2(ship.position.x, ship.position.z)
|
||||
var across: Vector2 = Vector2(cos(ship.rotation.y), -sin(ship.rotation.y))
|
||||
assert_true(signf(out.dot(across)) == signf(to_centre.dot(across)), "the mortar should face the island")
|
||||
while bot.velocity.y > 0.0 and guard < 6000:
|
||||
loop.run_tick()
|
||||
guard += 1
|
||||
view.sync()
|
||||
assert_eq(view.entities.lifeline_count(), 0, "the line goes once the arc tops out")
|
||||
view.free()
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
extends TestCase
|
||||
|
||||
## Issue A5: world art. Points of interest, build piece states, the barge and chests,
|
||||
## 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
|
||||
@@ -150,12 +150,19 @@ func test_structure_view_redraws_a_piece_when_its_state_changes() -> void:
|
||||
view.free()
|
||||
|
||||
|
||||
func test_barge_and_chest_models() -> void:
|
||||
var barge: AABB = VesselModels.barge().get_aabb()
|
||||
assert_near(barge.position.y, -VesselModels.HULL_DEPTH, 0.05, "hull bottom")
|
||||
assert_near(barge.end.y, VesselModels.ENVELOPE_HEIGHT + VesselModels.ENVELOPE_AXES.y, 0.05, "envelope top")
|
||||
assert_near(barge.size.x, 2.0 * VesselModels.ENVELOPE_AXES.x, 0.05, "the envelope is the widest part")
|
||||
assert_true(barge.size.z >= 2.0 * VesselModels.HULL_HALF_LENGTH, "hull length")
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user