W7: The drop: sky barge and wing-sail

Simulation.start_drop() plans a seeded straight route across the island at
BARGE_ALTITUDE, through a point near the middle pulled onto land, and puts
every player aboard. Riders move with the barge; jump leaps off with some of
its speed. Freefall steers and tops out at FREEFALL_MAX_SPEED; jump opens
the wing-sail, which also opens by itself WING_AUTO_DEPLOY_HEIGHT above the
ground or water. Gliding sinks slowly and steers at GLIDE_SPEED, and the
sail folds just above the ground or sea so landing does no damage. Anyone
aboard at the end of the route is thrown off. Drop state is hashed.

Every server match now starts with the drop. Bots leap at a time fixed by
their player ID. The carrier's name and look are open in #72.

Closes #14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 12:34:53 -05:00
co-authored by Claude Opus 5.5
parent be987b6f82
commit 278b715e0c
12 changed files with 527 additions and 7 deletions
+62
View File
@@ -22,6 +22,13 @@ static func step(player: SimEntity, command: PlayerCommand, ground: SimGround, s
wants_jump = command.is_pressed(PlayerCommand.BUTTON_JUMP) and not player.crouching
wish = _wish_velocity(command, player.crouching)
if player.drop_state == Drop.ABOARD:
# Riders move with the barge; Simulation places them.
return
if player.drop_state != Drop.NONE:
_fall_from_barge(player, command, ground, sea_level)
return
if player.swimming:
if wants_jump and player.stamina_ticks > 0 and _at_surface(player, sea_level):
# Kick up out of the water. Airborne from here; back in if it lands in deep water.
@@ -247,3 +254,58 @@ static func _swim(player: SimEntity, command: PlayerCommand, ground: SimGround,
player.on_ground = _walkable_support(ground, player.position)
else:
player.on_ground = false
## One tick of the drop after leaping: freefall, then the wing-sail. Players steer with
## the move keys relative to where they look; jump opens the sail, and it opens by itself
## WING_AUTO_DEPLOY_HEIGHT above the ground or water. Near the bottom the sail folds and
## ordinary falling (or the water) takes over, slow enough to do no damage.
static func _fall_from_barge(player: SimEntity, command: PlayerCommand, ground: SimGround, sea_level: float) -> void:
var below: float = _drop_floor(player, ground, sea_level, player.position.y)
if player.drop_state == Drop.FREEFALL:
var opens: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_JUMP)
if opens or player.position.y - below <= Tuning.WING_AUTO_DEPLOY_HEIGHT:
player.drop_state = Drop.GLIDING
var gliding: bool = player.drop_state == Drop.GLIDING
var wish: Vector3 = Vector3.ZERO
if command != null:
var input: Vector2 = command.move_vector()
if input.length() > 1.0:
input = input.normalized()
var angle: float = command.yaw_radians()
var forward: Vector3 = Vector3(sin(angle), 0.0, cos(angle))
var right: Vector3 = Vector3(-cos(angle), 0.0, sin(angle))
wish = (right * input.x + forward * input.y) * (Tuning.GLIDE_SPEED if gliding else Tuning.FREEFALL_STEER_SPEED)
var velocity: Vector3 = player.velocity
var flat: Vector3 = Vector3(velocity.x, 0.0, velocity.z).move_toward(wish, Tuning.DROP_STEER_ACCEL * DT)
velocity.x = flat.x
velocity.z = flat.z
if gliding:
velocity.y = move_toward(velocity.y, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * DT)
else:
velocity.y = maxf(velocity.y - Tuning.GRAVITY * DT, -Tuning.FREEFALL_MAX_SPEED)
velocity = _move_horizontally(player, velocity, ground)
var new_y: float = player.position.y + velocity.y * DT
var support: float = ground.support_height(player.position.x, player.position.z, maxf(player.position.y, new_y))
below = maxf(support, sea_level if Water.is_deep(sea_level, support) else support)
player.velocity = velocity
if new_y <= support:
# Came down on something in a single tick: set down gently.
player.position.y = support
player.velocity.y = 0.0
player.drop_state = Drop.NONE
player.on_ground = _walkable_support(ground, player.position)
return
player.position.y = new_y
if new_y - below <= Tuning.DROP_LAND_HANDOFF:
player.drop_state = Drop.NONE
player.on_ground = false
player.velocity.y = maxf(velocity.y, -Tuning.GLIDE_FALL_SPEED)
## The ground or deep water under a falling player.
static func _drop_floor(player: SimEntity, ground: SimGround, sea_level: float, from_y: float) -> float:
var support: float = ground.support_height(player.position.x, player.position.z, from_y)
return maxf(support, sea_level) if Water.is_deep(sea_level, support) else support