#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:
@@ -77,8 +77,8 @@ func test_the_scripted_player_finishes_the_tutorial_through_the_client() -> void
|
||||
func test_steps_wait_for_the_player_to_act() -> void:
|
||||
var session: ClientSession = ClientSession.new()
|
||||
session.play_tutorial(3)
|
||||
# Nobody at the keys: the barge flies on, and the tutorial waits on its first step
|
||||
# until the barge throws everyone off at the end of its route.
|
||||
# Nobody at the keys: the ship flies on, and the tutorial waits on its first step
|
||||
# until the ship throws everyone off at the end of its route.
|
||||
for _frame: int in 3 * Tuning.TICK_RATE_HZ:
|
||||
session.pump(DT)
|
||||
assert_true(session.game.playing())
|
||||
|
||||
@@ -88,7 +88,7 @@ static func format(a: Dictionary) -> String:
|
||||
var m: Dictionary = a["minutes"]
|
||||
lines.append("Tidewall balance report: %d bot-only matches, %d players each" % [a["matches"], Tuning.SOLO_PLAYERS])
|
||||
lines.append("")
|
||||
lines.append("Match length (minutes from the barge leaving):")
|
||||
lines.append("Match length (minutes from the ship leaving):")
|
||||
lines.append(" min %.1f p10 %.1f p25 %.1f median %.1f p75 %.1f p90 %.1f max %.1f" % [m["min"], m["p10"], m["p25"], m["median"], m["p75"], m["p90"], m["max"]])
|
||||
lines.append(" target median %.0f to %.0f; %d of %d ended by the tide's clock" % [Tuning.BALANCE_MEDIAN_MINUTES_MIN, Tuning.BALANCE_MEDIAN_MINUTES_MAX, a["timed_out"], a["matches"]])
|
||||
var curve: PackedStringArray = []
|
||||
|
||||
@@ -15,7 +15,7 @@ static func tick_limit() -> int:
|
||||
## "eliminations": {difficulty name: count}, "weapon_kills": {item id: count},
|
||||
## "death_seconds": [seconds into the match of each fall], "shots", "slow_ticks",
|
||||
## "timing", "state_hash", "building": {"build": group, "control": group}}. Seconds
|
||||
## count from the barge leaving. Each group (M6) adds up its bots' BotBrain.stats and
|
||||
## count from the ship leaving. Each group (M6) adds up its bots' BotBrain.stats and
|
||||
## holds their "bots", "places" and "wins".
|
||||
##
|
||||
## With `team_size` 2 the match is duos (M7), and the result also has "downs",
|
||||
|
||||
@@ -12,14 +12,15 @@ func test_a_scripted_seat_sends_commands_like_anyone_else() -> void:
|
||||
assert_eq(loop.bots.size(), 1)
|
||||
for _index: int in Tuning.TICK_RATE_HZ * 24:
|
||||
loop.run_tick()
|
||||
assert_ne(loop.sim.entities.find(1).drop_state, Drop.ABOARD, "the scripted player leapt from the barge")
|
||||
assert_ne(loop.sim.entities.find(1).drop_state, Drop.ABOARD, "the scripted player leapt from the ship")
|
||||
|
||||
|
||||
func test_harvests_driftwood_and_builds_with_it() -> void:
|
||||
# Seed 29 is the match `make match` plays: the player lands, finds a weapon, cuts
|
||||
# driftwood and puts up a breakwater and a wall within a minute. (It was seed 2 until
|
||||
# H3 changed where bots land; there the scripted player now falls in a landing fight.)
|
||||
var loop: ServerLoop = ServerLoop.new(29, 1, 23)
|
||||
# Seed 2 is the match `make match` plays: the player lands, finds a weapon, cuts
|
||||
# driftwood and puts up a breakwater and a wall within a minute. (It was seed 29 from
|
||||
# H3 until the packet ship (#72) changed where everyone lands; on 29 the scripted
|
||||
# player now falls in a landing fight.)
|
||||
var loop: ServerLoop = ServerLoop.new(2, 1, 23)
|
||||
loop.play_humans_by_script()
|
||||
var player: ScriptedPlayer = loop.scripted[0]
|
||||
var placed: int = 0
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## by its autoplay script. The picture is the client's own: its copy of the world, its
|
||||
## predicted player, everyone else as the server's snapshots have them.
|
||||
##
|
||||
## Stages: barge (a few seconds into the drop), glide, landed, and basin: once landed,
|
||||
## Stages: ship (a few seconds into the drop), glide, landed, and basin: once landed,
|
||||
## the server rings a patch of low ground near the shore with breakwaters and play goes
|
||||
## on until the tide has risen past it, so the sea stands outside the ring and the
|
||||
## ground inside, below the sea, stays dry on the client too (issue N11). build and
|
||||
@@ -21,7 +21,7 @@ const DT: float = 1.0 / Tuning.TICK_RATE_HZ
|
||||
const HOST: String = "127.0.0.1"
|
||||
const LIMIT_ROUNDS: int = 200 * Tuning.TICK_RATE_HZ
|
||||
|
||||
@export var stage: String = "barge"
|
||||
@export var stage: String = "ship"
|
||||
@export var match_seed: int = 2
|
||||
@export var bots: int = 23
|
||||
## A13: a colour-vision set (Palette.VISION_*), captions for the sounds of the last
|
||||
@@ -75,7 +75,7 @@ func _ready() -> void:
|
||||
var reached: bool = false
|
||||
if _session.game.playing():
|
||||
match stage:
|
||||
"barge":
|
||||
"ship":
|
||||
reached = me.drop_state == Drop.ABOARD and _session.game.prediction.next_tick > 3 * Tuning.TICK_RATE_HZ
|
||||
"glide":
|
||||
reached = me.drop_state == Drop.GLIDING
|
||||
@@ -85,7 +85,7 @@ func _ready() -> void:
|
||||
since = 0
|
||||
elif since >= 0:
|
||||
since += 1
|
||||
if since >= (2 * Tuning.TICK_RATE_HZ if stage != "barge" else 1):
|
||||
if since >= (2 * Tuning.TICK_RATE_HZ if stage != "ship" else 1):
|
||||
break
|
||||
if since < 0:
|
||||
push_error("client capture: never reached stage '%s'" % stage)
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
[node name="CaptureClient" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "barge"
|
||||
stage = "ship"
|
||||
@@ -3,7 +3,7 @@
|
||||
## animation, seen from in front and to their right:
|
||||
##
|
||||
## - states: idle, walk, run, crouched, creeping, in the air, skydiving, gliding,
|
||||
## swimming, downed (M7). (Aboard the barge is the idle with the feet set wider; the deck
|
||||
## swimming, downed (M7). (Aboard the ship is the idle with the feet set wider; the deck
|
||||
## placement would pull it out of the row.)
|
||||
## - actions: carrying a longgun, a revolver and a tonic, firing each kind, a boathook
|
||||
## swing, a keg thrown, building, reloading, drinking and a flinch.
|
||||
@@ -131,7 +131,7 @@ func _stand(at: Vector3, row: Array) -> SimEntity:
|
||||
|
||||
func _pose(player: SimEntity, row: Array) -> void:
|
||||
var figure: FigureRig = view.entities.figure_of(player.id)
|
||||
# The barge's deck isn't drawn here: put the passenger back where it stands.
|
||||
# The ship's deck isn't drawn here: put the passenger back where it stands.
|
||||
figure.position = player.position
|
||||
figure.drive(player, 0.0)
|
||||
figure.drive(player, 1.0)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/match_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureMatch" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "launch"
|
||||
@@ -3,7 +3,7 @@
|
||||
## prints what it shows as a caption (Godot's default font; this is a test caption,
|
||||
## not the game's HUD).
|
||||
##
|
||||
## Stages: lobby, barge, glide, landed, built, final, tide (the island just before the
|
||||
## Stages: lobby, ship, glide, landed, built, final, tide (the island just before the
|
||||
## end, from where the lobby saw it), results.
|
||||
extends Node3D
|
||||
|
||||
@@ -31,8 +31,11 @@ func _ready() -> void:
|
||||
match stage:
|
||||
"lobby":
|
||||
pass
|
||||
"barge":
|
||||
"ship":
|
||||
_replay.run_until(func() -> bool: return flow.in_match() and flow.sim.tick >= 2 * TICKS)
|
||||
"launch":
|
||||
# A bot half a second up the mortar's arc, its lifeline still trailing.
|
||||
_replay.run_until(func() -> bool: return flow.in_match() and _climber() != null and _climber().velocity.y < Tuning.MORTAR_RISE_SPEED - 8.0)
|
||||
"glide":
|
||||
_replay.run_until(func() -> bool: return _player() != null and _player().drop_state == Drop.GLIDING)
|
||||
_run_ticks(TICKS)
|
||||
@@ -67,11 +70,19 @@ func _ready() -> void:
|
||||
if stage == "lobby" or stage == "tide":
|
||||
_view.overview()
|
||||
who = "the island"
|
||||
elif stage == "barge":
|
||||
elif stage == "ship" or stage == "launch":
|
||||
# From over the water astern and seaward of the ship, looking past it to the island.
|
||||
var along: Vector3 = (sim.drop.finish - sim.drop.start).normalized()
|
||||
var at: Vector3 = sim.drop.barge_position(sim.tick)
|
||||
_view.look_from(at - along * 22.0 + Vector3(0.0, 9.0, 0.0) + along.cross(Vector3.UP) * 9.0, at + along * 40.0 - Vector3(0.0, 22.0, 0.0))
|
||||
who = "the barge"
|
||||
var at: Vector3 = sim.drop.ship_position(sim.tick)
|
||||
var centre: Vector3 = Vector3(Tuning.WORLD_SIZE_METRES * 0.5, 0.0, Tuning.WORLD_SIZE_METRES * 0.5)
|
||||
var inland: Vector3 = Vector3(centre.x - at.x, 0.0, centre.z - at.z).normalized()
|
||||
if stage == "ship":
|
||||
_view.look_from(at - along * 26.0 - inland * 16.0 + Vector3(0.0, 11.0, 0.0), at + inland * 30.0 + Vector3(0.0, 2.0, 0.0))
|
||||
who = "the ship"
|
||||
else:
|
||||
var climber: SimEntity = _climber()
|
||||
_view.look_from(at - along * 30.0 - inland * 24.0 + Vector3(0.0, 8.0, 0.0), climber.position.lerp(at, 0.45))
|
||||
who = "a bot fired from the ship"
|
||||
elif watched != 0:
|
||||
var entity: SimEntity = sim.entities.find(flow.entity_of[watched])
|
||||
var airborne: bool = entity.drop_state != Drop.NONE
|
||||
@@ -89,6 +100,17 @@ func _ready() -> void:
|
||||
_caption(_describe(who) + ("" if quality < 0 else "\nquality: %s, renderer: %s" % [GameSettings.QUALITY_NAMES[quality], RenderingServer.get_current_rendering_method()]))
|
||||
|
||||
|
||||
## The first player climbing the mortar's arc, or null.
|
||||
func _climber() -> SimEntity:
|
||||
var sim: Simulation = _replay.flow.sim
|
||||
if sim == null or sim.drop == null:
|
||||
return null
|
||||
for entity: SimEntity in sim.entities.entities():
|
||||
if entity.archetype == SimEntity.ARCHETYPE_PLAYER and entity.drop_state == Drop.FREEFALL and entity.velocity.y > 0.0:
|
||||
return entity
|
||||
return null
|
||||
|
||||
|
||||
func _player() -> SimEntity:
|
||||
var flow: Match = _replay.flow
|
||||
if not flow.entity_of.has(PLAYER):
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
[node name="CaptureMatch" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "barge"
|
||||
stage = "ship"
|
||||
@@ -1,4 +1,4 @@
|
||||
## Capture scenario for the generated barge and sea chests (A5): the barge from outside,
|
||||
## Capture scenario for the generated packet ship (#72) and sea chests (A5): the ship from outside,
|
||||
## in the air above the sea, with a row of chests on a plank stand, shut and opened.
|
||||
extends Node3D
|
||||
|
||||
@@ -8,11 +8,11 @@ func _ready() -> void:
|
||||
world.environment = Look.environment()
|
||||
add_child(world)
|
||||
add_child(Look.sun(200.0))
|
||||
var barge: MeshInstance3D = MeshInstance3D.new()
|
||||
barge.mesh = VesselModels.barge()
|
||||
barge.position = Vector3(0.0, 0.0, 0.0)
|
||||
barge.rotation.y = 0.5
|
||||
add_child(barge)
|
||||
var ship: MeshInstance3D = MeshInstance3D.new()
|
||||
ship.mesh = VesselModels.ship()
|
||||
ship.position = Vector3(0.0, 0.0, 0.0)
|
||||
ship.rotation.y = 0.5
|
||||
add_child(ship)
|
||||
var multimesh: MultiMesh = MultiMesh.new()
|
||||
multimesh.transform_format = MultiMesh.TRANSFORM_3D
|
||||
multimesh.use_colors = true
|
||||
@@ -24,12 +24,12 @@ func _ready() -> void:
|
||||
multimesh.set_instance_color(index, EntityView.CHEST_OPEN if index == 2 else EntityView.CHEST_SHUT)
|
||||
var chests: MultiMeshInstance3D = MultiMeshInstance3D.new()
|
||||
chests.multimesh = multimesh
|
||||
chests.position = Vector3(9.0, 0.0, 6.0)
|
||||
chests.position = Vector3(13.0, 0.0, 11.0)
|
||||
add_child(chests)
|
||||
var camera: Camera3D = Camera3D.new()
|
||||
camera.fov = 60.0
|
||||
camera.position = Vector3(16.0, 6.0, 20.0)
|
||||
camera.position = Vector3(27.0, 7.0, 25.0)
|
||||
add_child(camera)
|
||||
camera.look_at(Vector3(2.0, 5.0, 0.0))
|
||||
camera.look_at(Vector3(2.0, 3.5, 0.0))
|
||||
camera.make_current()
|
||||
Look.add_print_pass(camera)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -139,7 +139,7 @@ func test_drawing_between_ticks_goes_from_the_last_tick_to_this_one() -> void:
|
||||
assert_eq(prediction.view_position(0.5), before.lerp(after, 0.5))
|
||||
|
||||
|
||||
func test_the_barge_ride_and_the_leap_are_predicted_from_the_same_route() -> void:
|
||||
func test_the_ship_ride_and_the_leap_are_predicted_from_the_same_route() -> void:
|
||||
sim = Simulation.new(21)
|
||||
sim.start_drop()
|
||||
server = sim.entities.find(sim.add_player())
|
||||
|
||||
@@ -2,7 +2,7 @@ extends TestCase
|
||||
|
||||
## Issue N3's numbers: two people play the start of a real match on a real island,
|
||||
## each through a link with 100 ms of latency each way, 20 ms of jitter and 2% loss.
|
||||
## They ride the barge, leap, glide down and then walk, sprint, strafe, jump and crouch
|
||||
## They ride the ship, leap, glide down and then walk, sprint, strafe, jump and crouch
|
||||
## about the middle of the island. Measures how far the server ever had to correct
|
||||
## each one's own predicted movement, and how evenly each is drawn on the other's
|
||||
## screen, against where the server really had them.
|
||||
@@ -96,13 +96,8 @@ func _play(latency_ms: float, jitter_ms: float, loss: float) -> Array[Dictionary
|
||||
var flow: Match = loop.match_flow
|
||||
assert_eq(flow.phase, Match.DROP)
|
||||
var sim: Simulation = loop.sim
|
||||
# Leap once the barge is over land.
|
||||
leap_tick = sim.drop.duration_ticks / 2
|
||||
for tick: int in range(30, sim.drop.duration_ticks):
|
||||
var under: Vector3 = sim.drop.barge_position(tick)
|
||||
if sim.ground.terrain_height(under.x, under.z) > Tuning.ISLAND_BEACH_TOP + 2.0:
|
||||
leap_tick = tick
|
||||
break
|
||||
# Fire the mortar a little way into the voyage.
|
||||
leap_tick = mini(Tuning.TICK_RATE_HZ * 4, sim.drop.duration_ticks / 2)
|
||||
# Both clients generate the island once between them: it's the same island.
|
||||
var mirror: Simulation = Simulation.new(flow.current_seed())
|
||||
clients.clear()
|
||||
@@ -131,7 +126,7 @@ func _play(latency_ms: float, jitter_ms: float, loss: float) -> Array[Dictionary
|
||||
entity.append(int(flow.entity_of[handle]))
|
||||
history[entity[index]] = [sim.entities.find(entity[index]).position]
|
||||
var planned: Drop = Drop.plan(mirror.ground, SimRng.new(flow.current_seed()), 0)
|
||||
assert_eq(planned.start, sim.drop.start, "the client plans the server's barge route")
|
||||
assert_eq(planned.start, sim.drop.start, "the client plans the server's ship route")
|
||||
assert_eq(planned.finish, sim.drop.finish)
|
||||
assert_eq(planned.duration_ticks, sim.drop.duration_ticks)
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ func test_no_data_about_entities_outside_the_interest_area() -> void:
|
||||
|
||||
|
||||
func test_height_does_not_hide_a_player_overhead() -> void:
|
||||
var above: SimEntity = _other(viewer.position + Vector3(10.0, Tuning.BARGE_ALTITUDE, 0.0))
|
||||
var above: SimEntity = _other(viewer.position + Vector3(10.0, 150.0, 0.0))
|
||||
_send()
|
||||
assert_true(receiver.entities.has(above.id))
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ func test_a_client_joins_over_udp_generates_the_island_and_plays() -> void:
|
||||
assert_true(client.prediction.reconciles > 50, "%d snapshots compared" % client.prediction.reconciles)
|
||||
assert_true(client.prediction.max_correction < 2.0, "largest correction %.3f m" % client.prediction.max_correction)
|
||||
assert_true(client.own_position().distance_to(mine.position) < 10.0, "drawn %.1f m from where the server has it" % client.own_position().distance_to(mine.position))
|
||||
# The two bots ride the same barge.
|
||||
# The two bots ride the same ship.
|
||||
assert_eq(flow.entity_of.size(), 3)
|
||||
for handle: int in flow.entity_of:
|
||||
assert_true(client.remote.has(flow.entity_of[handle]), "player %d is drawn" % handle)
|
||||
|
||||
@@ -25,7 +25,7 @@ func before_each() -> void:
|
||||
assert_true(loop.match_flow.in_match())
|
||||
rng = RandomNumberGenerator.new()
|
||||
rng.seed = 1999
|
||||
# Both off the barge and standing on level dry ground, as if they had landed.
|
||||
# Both off the ship and standing on level dry ground, as if they had landed.
|
||||
var spot: Vector3 = _level_spot()
|
||||
_stand(HOSTILE, spot)
|
||||
_stand(VICTIM, spot + Vector3(0.0, 0.0, 6.0))
|
||||
|
||||
@@ -106,7 +106,7 @@ func test_two_people_join_play_and_are_sent_the_match() -> void:
|
||||
phases.append(notice["phase"])
|
||||
assert_eq(notice["seed"], flow.current_seed())
|
||||
assert_eq(phases.slice(phases.size() - 2), [Match.COUNTDOWN, Match.DROP], "client %d's notices: %s" % [index, phases])
|
||||
# Everyone starts aboard the barge together, so each sees all four players.
|
||||
# Everyone starts aboard the ship together, so each sees all four players.
|
||||
assert_true(_pump(func() -> bool: return receivers[0].entities.size() >= 4 and receivers[1].entities.size() >= 4))
|
||||
# Inputs arrive and steer: the server took commands, and each player faces its way.
|
||||
assert_true(_pump(func() -> bool:
|
||||
|
||||
@@ -62,9 +62,10 @@ func test_bots_leap_and_humans_without_commands_stay_aboard() -> void:
|
||||
if leapt_tick >= 0 and loop.sim.tick >= leapt_tick + Tuning.TICK_RATE_HZ * 5:
|
||||
break
|
||||
assert_eq(human.drop_state, Drop.ABOARD)
|
||||
assert_true(human.position.distance_to(loop.sim.drop.barge_position(loop.sim.tick)) < 0.001)
|
||||
assert_true(human.position.distance_to(loop.sim.drop.ship_position(loop.sim.tick)) < 0.001)
|
||||
assert_true(leapt_tick >= 0, "the bot should have leapt before the route ended")
|
||||
assert_true(bot.position.y < Tuning.BARGE_ALTITUDE - 20.0, "the bot should be falling, at %s" % bot.position)
|
||||
var ship: Vector3 = loop.sim.drop.ship_position(loop.sim.tick)
|
||||
assert_true(bot.position.distance_to(ship) > 50.0, "the bot should be well away from the ship, at %s" % bot.position)
|
||||
|
||||
|
||||
func test_same_seed_gives_the_same_match() -> void:
|
||||
|
||||
@@ -81,12 +81,8 @@ func test_a_clients_world_agrees_with_the_servers_through_a_scripted_match() ->
|
||||
assert_eq(loop.scripted.size(), 1)
|
||||
game = NetGame.new(loop, NetServer.new())
|
||||
game.adopt(CLIENT)
|
||||
leap_tick = sim.drop.duration_ticks / 2
|
||||
for tick: int in range(30, sim.drop.duration_ticks):
|
||||
var under: Vector3 = sim.drop.barge_position(tick)
|
||||
if sim.ground.terrain_height(under.x, under.z) > Tuning.ISLAND_BEACH_TOP + 2.0:
|
||||
leap_tick = tick
|
||||
break
|
||||
# Fire the mortar a little way into the voyage.
|
||||
leap_tick = mini(Tuning.TICK_RATE_HZ * 4, sim.drop.duration_ticks / 2)
|
||||
client = ClientGame.new()
|
||||
client.sample_input = _input
|
||||
client.receive(NetProtocol.CHANNEL_CONTROL, game.match_notice())
|
||||
|
||||
+120
-30
@@ -1,6 +1,7 @@
|
||||
extends TestCase
|
||||
|
||||
## The drop from issue W7: the sky barge's route, leaping, freefall, the wing-sail,
|
||||
## The drop from issues W7 and #72: the packet ship's route offshore, the lifeline
|
||||
## mortar's charge and arc, freefall, the gull-kite,
|
||||
## steering, landing and the forced ejection at the end of the route.
|
||||
|
||||
const SECOND: int = Tuning.TICK_RATE_HZ
|
||||
@@ -20,27 +21,92 @@ func _command(sim: Simulation, move: Vector2, yaw: float, buttons: int = 0) -> P
|
||||
return PlayerCommand.from_input(sim.tick, move, yaw, 0.0, buttons)
|
||||
|
||||
|
||||
func test_routes_always_cross_land() -> void:
|
||||
# 60 seeds: every route starts and ends inside the world, flies at barge altitude, and
|
||||
# spends a good stretch over dry land, so every player can reach the island.
|
||||
func test_routes_pass_offshore_and_every_shore_is_in_reach() -> void:
|
||||
# 60 seeds: every route starts and ends inside the world at deck height, sails only
|
||||
# over open sea, passes close to the coast, and no land is further from the route
|
||||
# than the mortar's full charge carries, so every player can reach anywhere.
|
||||
var full: float = Drop.reach(1.0, true)
|
||||
for seed_value: int in range(1, 61):
|
||||
var island: Island = Island.generate(seed_value)
|
||||
var drop: Drop = Drop.plan(island.ground, SimRng.new(seed_value), 0)
|
||||
var size: float = Tuning.WORLD_SIZE_METRES
|
||||
for end: Vector3 in [drop.start, drop.finish]:
|
||||
assert_true(end.x >= 0.0 and end.x <= size and end.z >= 0.0 and end.z <= size, "seed %d route leaves the world" % seed_value)
|
||||
assert_eq(end.y, Tuning.BARGE_ALTITUDE)
|
||||
var land: int = 0
|
||||
var samples: PackedVector2Array = drop.route_samples(4.0)
|
||||
for point: Vector2 in samples:
|
||||
if island.ground.terrain_height(point.x, point.y) > Tuning.ISLAND_BEACH_TOP:
|
||||
land += 1
|
||||
var land_metres: float = land * 4.0
|
||||
assert_true(land_metres >= Tuning.BARGE_MIN_LAND_METRES, "seed %d route crosses only %.0f m of land" % [seed_value, land_metres])
|
||||
assert_eq(end.y, Tuning.SHIP_DECK_HEIGHT)
|
||||
for point: Vector2 in drop.route_samples(4.0):
|
||||
assert_true(island.ground.terrain_height(point.x, point.y) < Tuning.SEA_LEVEL_START, "seed %d: the ship runs aground at %s" % [seed_value, point])
|
||||
var a: Vector2 = Vector2(drop.start.x, drop.start.z)
|
||||
var b: Vector2 = Vector2(drop.finish.x, drop.finish.z)
|
||||
var nearest: float = INF
|
||||
var farthest: float = 0.0
|
||||
var x: float = 8.0
|
||||
while x < size:
|
||||
var z: float = 8.0
|
||||
while z < size:
|
||||
if island.ground.terrain_height(x, z) > Tuning.ISLAND_BEACH_TOP:
|
||||
var at: Vector2 = Vector2(x, z)
|
||||
var gap: float = at.distance_to(Geometry2D.get_closest_point_to_segment(at, a, b))
|
||||
nearest = minf(nearest, gap)
|
||||
farthest = maxf(farthest, gap)
|
||||
z += 16.0
|
||||
x += 16.0
|
||||
assert_true(nearest >= 15.0 and nearest <= 140.0, "seed %d: the ship passes %.0f m from land" % [seed_value, nearest])
|
||||
assert_true(farthest <= full - 50.0, "seed %d: land %.0f m off, the mortar carries %.0f m" % [seed_value, farthest, full])
|
||||
var seconds: float = float(drop.duration_ticks) / SECOND
|
||||
assert_true(seconds >= 20.0 and seconds <= 75.0, "seed %d route takes %.1f s" % [seed_value, seconds])
|
||||
|
||||
|
||||
func test_charge_follows_the_aim_and_reach_grows_with_it() -> void:
|
||||
assert_eq(Drop.charge_for_pitch(deg_to_rad(-30.0)), 0.0)
|
||||
assert_eq(Drop.charge_for_pitch(deg_to_rad(80.0)), 1.0)
|
||||
for charge: float in [0.0, 0.3, 0.7, 1.0]:
|
||||
assert_near(Drop.charge_for_pitch(Drop.pitch_for_charge(charge)), charge, 0.0001)
|
||||
for kite: bool in [false, true]:
|
||||
var last: float = 0.0
|
||||
for step: int in 11:
|
||||
var reach: float = Drop.reach(step / 10.0, kite)
|
||||
assert_true(reach > last, "reach should grow with the charge")
|
||||
last = reach
|
||||
for distance: float in [450.0, 600.0, 750.0]:
|
||||
assert_near(Drop.reach(Drop.charge_for_distance(distance, kite), kite), distance, 2.0)
|
||||
assert_eq(Drop.charge_for_distance(10.0, kite), 0.0)
|
||||
assert_eq(Drop.charge_for_distance(5000.0, kite), 1.0)
|
||||
# The kite opened at the top carries further than a fall, and aim_charge falls when
|
||||
# a fall carries far enough.
|
||||
assert_true(Drop.reach(1.0, true) > Drop.reach(1.0) + 100.0)
|
||||
assert_eq(Drop.aim_charge(600.0), Drop.charge_for_distance(600.0))
|
||||
var far: float = Drop.reach(1.0) + 50.0
|
||||
assert_eq(Drop.aim_charge(far), Drop.charge_for_distance(far, true))
|
||||
|
||||
|
||||
func test_shots_land_where_reach_says() -> void:
|
||||
# On flat ground: fire straight along +z and hold forward, either opening the kite as
|
||||
# soon as the climb ends or letting it open by itself. The landing must match
|
||||
# Drop.reach(), which bots aim by.
|
||||
for case: int in 6:
|
||||
var charge: float = [0.0, 0.5, 1.0][case % 3]
|
||||
var kite: bool = case >= 3
|
||||
var sim: Simulation = _flat_sim()
|
||||
var id: int = sim.add_player()
|
||||
sim.start_drop()
|
||||
var player: SimEntity = sim.entities.find(id)
|
||||
player.position = Vector3(10.0, Tuning.SHIP_DECK_HEIGHT, 10.0)
|
||||
sim.drop.start = player.position
|
||||
sim.drop.finish = player.position
|
||||
sim.submit_command(id, PlayerCommand.from_input(sim.tick, Vector2.ZERO, 0.0, Drop.pitch_for_charge(charge), PlayerCommand.BUTTON_JUMP))
|
||||
sim.step()
|
||||
var from: Vector3 = player.position
|
||||
for _i: int in SECOND * 120:
|
||||
var buttons: int = PlayerCommand.BUTTON_JUMP if kite and player.drop_state == Drop.FREEFALL else 0
|
||||
sim.submit_command(id, PlayerCommand.from_input(sim.tick, Vector2(0.0, 1.0), 0.0, 0.0, buttons))
|
||||
sim.step()
|
||||
if player.drop_state == Drop.NONE:
|
||||
break
|
||||
var travelled: float = player.position.z - from.z
|
||||
assert_near(travelled, Drop.reach(charge, kite), Drop.reach(charge, kite) * 0.03, "charge %.1f, kite at the top %s" % [charge, kite])
|
||||
assert_near(player.position.x, from.x, 0.01)
|
||||
|
||||
|
||||
func test_route_is_seeded() -> void:
|
||||
var island: Island = Island.generate(5)
|
||||
var a: Drop = Drop.plan(island.ground, SimRng.new(5), 0)
|
||||
@@ -51,7 +117,7 @@ func test_route_is_seeded() -> void:
|
||||
assert_ne(a.start, c.start)
|
||||
|
||||
|
||||
func test_players_ride_the_barge_until_they_leap() -> void:
|
||||
func test_players_ride_the_ship_until_the_mortar_fires_them_up_the_arc() -> void:
|
||||
var sim: Simulation = _flat_sim()
|
||||
var id: int = sim.add_player()
|
||||
sim.start_drop()
|
||||
@@ -62,30 +128,50 @@ func test_players_ride_the_barge_until_they_leap() -> void:
|
||||
sim.submit_command(id, _command(sim, Vector2(1.0, 1.0), 0.3, PlayerCommand.BUTTON_SPRINT | PlayerCommand.BUTTON_CROUCH))
|
||||
sim.step()
|
||||
assert_eq(player.drop_state, Drop.ABOARD)
|
||||
assert_true(player.position.distance_to(sim.drop.barge_position(sim.tick)) < 0.001, "rider isn't on the barge")
|
||||
sim.submit_command(id, _command(sim, Vector2.ZERO, 0.0, PlayerCommand.BUTTON_JUMP))
|
||||
assert_true(player.position.distance_to(sim.drop.ship_position(sim.tick)) < 0.001, "rider isn't on the ship")
|
||||
var yaw: float = 0.8
|
||||
sim.submit_command(id, PlayerCommand.from_input(sim.tick, Vector2.ZERO, yaw, deg_to_rad(20.0), PlayerCommand.BUTTON_JUMP))
|
||||
sim.step()
|
||||
assert_eq(player.drop_state, Drop.FREEFALL)
|
||||
var height: float = player.position.y
|
||||
for _i: int in SECOND:
|
||||
var launch: Vector3 = Drop.launch_velocity(yaw, Drop.charge_for_pitch(deg_to_rad(20.0)))
|
||||
assert_true(player.velocity.distance_to(launch) < 0.05, "launched at %s, wanted %s" % [player.velocity, launch])
|
||||
# The climb: steering and jump (the kite) do nothing until the arc tops out.
|
||||
var flat: Vector2 = Vector2(launch.x, launch.z)
|
||||
var top: float = player.position.y
|
||||
for _i: int in SECOND * 3:
|
||||
sim.submit_command(id, _command(sim, Vector2(1.0, -1.0), 2.5, PlayerCommand.BUTTON_JUMP))
|
||||
sim.step()
|
||||
assert_true(player.position.y < height - 10.0, "freefall too slow: %.1f to %.1f" % [height, player.position.y])
|
||||
# Freefall tops out at its terminal speed.
|
||||
for _i: int in SECOND * 2:
|
||||
top = maxf(top, player.position.y)
|
||||
assert_eq(player.drop_state, Drop.FREEFALL, "the kite opened during the climb")
|
||||
assert_true(Vector2(player.velocity.x, player.velocity.z).distance_to(flat) < 0.05, "steered during the climb")
|
||||
while player.velocity.y > 0.0:
|
||||
sim.step()
|
||||
top = maxf(top, player.position.y)
|
||||
var apex: float = Tuning.SHIP_DECK_HEIGHT + Tuning.MORTAR_RISE_SPEED * Tuning.MORTAR_RISE_SPEED / (2.0 * Tuning.GRAVITY)
|
||||
assert_near(top, apex, 3.0, "the top of the arc")
|
||||
# Then freefall, which tops out at its terminal speed.
|
||||
for _i: int in SECOND * 4:
|
||||
sim.step()
|
||||
assert_true(player.velocity.y < -20.0, "should be falling fast, at %s" % player.velocity)
|
||||
assert_true(-player.velocity.y <= Tuning.FREEFALL_MAX_SPEED + 0.001)
|
||||
|
||||
|
||||
func test_wing_sail_slows_the_fall_and_steers() -> void:
|
||||
func _over_the_top(sim: Simulation, player: SimEntity) -> void:
|
||||
while player.velocity.y > 0.0:
|
||||
sim.step()
|
||||
|
||||
|
||||
func test_gull_kite_slows_the_fall_and_steers() -> void:
|
||||
var sim: Simulation = _flat_sim()
|
||||
var id: int = sim.add_player()
|
||||
sim.start_drop()
|
||||
var player: SimEntity = sim.entities.find(id)
|
||||
sim.submit_command(id, _command(sim, Vector2.ZERO, 0.0, PlayerCommand.BUTTON_JUMP))
|
||||
sim.step()
|
||||
_over_the_top(sim, player)
|
||||
for _i: int in SECOND:
|
||||
sim.step()
|
||||
# Open the sail by hand, high up.
|
||||
# Open the kite by hand, high up.
|
||||
sim.submit_command(id, _command(sim, Vector2.ZERO, 0.0, PlayerCommand.BUTTON_JUMP))
|
||||
sim.step()
|
||||
assert_eq(player.drop_state, Drop.GLIDING)
|
||||
@@ -118,14 +204,14 @@ func test_wing_sail_slows_the_fall_and_steers() -> void:
|
||||
sim.step()
|
||||
var p4: Vector2 = Vector2(player.position.x, player.position.z)
|
||||
assert_near((p4 - p3).dot(right), Tuning.GLIDE_SPEED, 0.1, "glide speed to the right")
|
||||
# Letting go stops the sail drifting.
|
||||
# Letting go stops the kite drifting.
|
||||
for _i: int in SECOND:
|
||||
sim.step()
|
||||
assert_near(Vector2(player.velocity.x, player.velocity.z).length(), 0.0, 0.01)
|
||||
assert_eq(player.drop_state, Drop.GLIDING)
|
||||
|
||||
|
||||
func test_sail_opens_by_itself_near_the_ground_and_landing_is_safe() -> void:
|
||||
func test_kite_opens_by_itself_near_the_ground_and_landing_is_safe() -> void:
|
||||
var sim: Simulation = _flat_sim()
|
||||
var id: int = sim.add_player()
|
||||
sim.start_drop()
|
||||
@@ -139,8 +225,8 @@ func test_sail_opens_by_itself_near_the_ground_and_landing_is_safe() -> void:
|
||||
opened_at = player.position.y
|
||||
if player.on_ground:
|
||||
break
|
||||
assert_true(opened_at > 0.0, "the sail never opened")
|
||||
assert_true(opened_at <= Tuning.WING_AUTO_DEPLOY_HEIGHT + 0.001 and opened_at > Tuning.WING_AUTO_DEPLOY_HEIGHT - 2.0, "opened at %.1f m" % opened_at)
|
||||
assert_true(opened_at > 0.0, "the kite never opened")
|
||||
assert_true(opened_at <= Tuning.KITE_AUTO_DEPLOY_HEIGHT + 0.001 and opened_at > Tuning.KITE_AUTO_DEPLOY_HEIGHT - 2.0, "opened at %.1f m" % opened_at)
|
||||
assert_true(player.on_ground, "never landed, at %s" % player.position)
|
||||
assert_eq(player.drop_state, Drop.NONE)
|
||||
assert_eq(player.health, Tuning.PLAYER_MAX_HEALTH)
|
||||
@@ -169,8 +255,8 @@ func test_gliding_into_the_sea_ends_in_the_water_unhurt() -> void:
|
||||
assert_eq(player.health, Tuning.PLAYER_MAX_HEALTH)
|
||||
|
||||
|
||||
func test_riders_are_thrown_off_at_the_end_of_the_route() -> void:
|
||||
var sim: Simulation = _flat_sim()
|
||||
func test_riders_are_fired_inland_at_the_end_of_the_route() -> void:
|
||||
var sim: Simulation = _sim(11)
|
||||
var id: int = sim.add_player()
|
||||
sim.start_drop()
|
||||
var player: SimEntity = sim.entities.find(id)
|
||||
@@ -181,12 +267,16 @@ func test_riders_are_thrown_off_at_the_end_of_the_route() -> void:
|
||||
sim.step()
|
||||
assert_eq(player.drop_state, Drop.FREEFALL, "still aboard after the route ended")
|
||||
assert_true(sim.drop.finished)
|
||||
assert_true(player.position.distance_to(sim.drop.finish) < Tuning.FREEFALL_MAX_SPEED)
|
||||
assert_true(player.velocity.y > 0.0, "fired up the arc")
|
||||
var centre: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5
|
||||
var to_centre: Vector2 = (centre - Vector2(sim.drop.finish.x, sim.drop.finish.z)).normalized()
|
||||
var heading: Vector2 = Vector2(player.velocity.x, player.velocity.z).normalized()
|
||||
assert_true(heading.dot(to_centre) > 0.999, "fired towards the middle of the island")
|
||||
|
||||
|
||||
func test_forced_landing_brings_every_player_down_alive() -> void:
|
||||
# A full drop on a real island: 24 players, a third leaping early, a third steering
|
||||
# and opening their sails high, the rest never pressing anything and thrown off at
|
||||
# and opening their kites high, the rest never pressing anything and fired off at
|
||||
# the end. Everyone must reach the ground or the water, unhurt, before the route
|
||||
# time plus a generous fall.
|
||||
var sim: Simulation = _sim(11)
|
||||
|
||||
@@ -83,7 +83,7 @@ func test_lobby_counts_down_after_waiting_then_starts_a_full_match() -> void:
|
||||
assert_eq(m.participants[0], 10, "the human keeps the first place in the roster")
|
||||
for handle: int in m.participants:
|
||||
var player: SimEntity = m.sim.entities.find(m.entity_of[handle])
|
||||
assert_eq(player.drop_state, Drop.ABOARD, "everyone starts on the barge")
|
||||
assert_eq(player.drop_state, Drop.ABOARD, "everyone starts on the ship")
|
||||
assert_true(m.sim.pickups.size() > 0, "loot was placed")
|
||||
assert_eq(m.sim.tick, 0)
|
||||
|
||||
@@ -114,7 +114,7 @@ func test_leaving_in_the_lobby_and_countdown_returns_to_waiting() -> void:
|
||||
assert_eq(m.matches_started, 0)
|
||||
|
||||
|
||||
func test_the_drop_becomes_play_when_the_barge_finishes() -> void:
|
||||
func test_the_drop_becomes_play_when_the_ship_finishes() -> void:
|
||||
var m: Match = Match.new(SEED, _rules())
|
||||
m.join(1)
|
||||
_until(m, Match.DROP)
|
||||
|
||||
Reference in New Issue
Block a user