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
+41 -1
View File
@@ -26,6 +26,8 @@ var props: PropSet = PropSet.new()
var sea_level: float = Tuning.SEA_LEVEL_START
## Damage per second to a player underwater with no breath left. Set by the tide phase.
var drown_dps: int = Tuning.TIDE_PHASES[0]["drown_dps"]
## The sky barge, from start_drop() on. Null in matches and tests that start on foot.
var drop: Drop = null
## Player entity ID -> { command tick -> PlayerCommand }
var _pending: Dictionary = {}
@@ -65,6 +67,8 @@ func add_player() -> int:
player.on_ground = true
player.health = Tuning.PLAYER_MAX_HEALTH
Water.reset(player)
if drop != null and not drop.finished:
Drop.board(player, drop.barge_position(tick))
_players.append(player.id)
_pending[player.id] = {}
return player.id
@@ -89,16 +93,45 @@ func submit_command(player_id: int, command: PlayerCommand) -> bool:
return true
## Starts the match's drop: plans the barge's route and puts every player aboard.
func start_drop() -> void:
drop = Drop.plan(ground, rng, tick)
for player_id: int in _players:
Drop.board(entities.find(player_id), drop.barge_position(tick))
## Advances the simulation by one tick.
func step() -> void:
for player_id: int in _players:
var queued: Dictionary = _pending[player_id]
var command: PlayerCommand = queued.get(tick)
queued.erase(tick)
_apply_command(entities.find(player_id), command)
var player: SimEntity = entities.find(player_id)
if player.drop_state == Drop.ABOARD:
_ride(player, command)
else:
_apply_command(player, command)
if drop != null and not drop.finished and drop.is_over(tick + 1):
# The end of the route: everyone still aboard goes over the side.
for player_id: int in _players:
var player: SimEntity = entities.find(player_id)
if player.drop_state == Drop.ABOARD:
drop.leap(player, tick + 1)
drop.finished = true
tick += 1
## A tick aboard the barge: jump leaps off, anything else rides along.
func _ride(player: SimEntity, command: PlayerCommand) -> void:
if command != null:
player.yaw = command.yaw
player.pitch = command.pitch
if command.is_pressed(PlayerCommand.BUTTON_JUMP):
drop.leap(player, tick)
return
player.position = drop.barge_position(tick + 1)
func _apply_command(player: SimEntity, command: PlayerCommand) -> void:
Movement.step(player, command, ground, sea_level)
var sprinting: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_SPRINT)
@@ -136,11 +169,18 @@ func state_hash() -> String:
buffer.put_32(entity.breath_ticks)
buffer.put_32(entity.stamina_ticks)
buffer.put_32(entity.drown_ticks)
buffer.put_u8(entity.drop_state)
for value: float in [entity.position.x, entity.position.y, entity.position.z]:
buffer.put_64(roundi(value * 1000.0))
for value: float in [entity.velocity.x, entity.velocity.y, entity.velocity.z]:
buffer.put_64(roundi(value * 1000.0))
if drop != null:
buffer.put_64(drop.began_tick)
buffer.put_64(drop.duration_ticks)
buffer.put_u8(1 if drop.finished else 0)
for value: float in [drop.start.x, drop.start.z, drop.finish.x, drop.finish.z]:
buffer.put_64(roundi(value * 1000.0))
buffer.put_64(roundi(sea_level * 1000.0))
buffer.put_32(drown_dps)
buffer.put_64(props.count())