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>
67 lines
2.7 KiB
GDScript
67 lines
2.7 KiB
GDScript
## A12: plays the tutorial from start to end with its scripted player (TutorialPilot),
|
|
## through a real ClientSession on its offline server, as fast as it will go, on each
|
|
## seed asked for. Each seed must reach the last step within the time limit, with no
|
|
## script or engine error.
|
|
##
|
|
## tools/godot.sh --script res://tools/tutorial_check.gd -- [--seeds=N] [--first=N]
|
|
##
|
|
## Prints one JSON line per seed (the seconds each step took, in game time) and a
|
|
## verdict. Exits 1 on any failure.
|
|
extends SceneTree
|
|
|
|
## Game seconds a seed may take before it counts as stuck.
|
|
const LIMIT_SECONDS: float = 600.0
|
|
|
|
|
|
func _init() -> void:
|
|
var seeds: int = 5
|
|
var first: int = 1
|
|
for arg: String in OS.get_cmdline_user_args():
|
|
if arg.begins_with("--seeds=") and arg.trim_prefix("--seeds=").is_valid_int():
|
|
seeds = maxi(arg.trim_prefix("--seeds=").to_int(), 1)
|
|
elif arg.begins_with("--first=") and arg.trim_prefix("--first=").is_valid_int():
|
|
first = arg.trim_prefix("--first=").to_int()
|
|
else:
|
|
print("tutorial-check FAIL: unknown argument '%s'" % arg)
|
|
quit(2)
|
|
return
|
|
var errors: ErrorCounter = ErrorCounter.new()
|
|
OS.add_logger(errors)
|
|
var problems: Array[String] = []
|
|
for seed_value: int in range(first, first + seeds):
|
|
var result: Dictionary = play(seed_value, LIMIT_SECONDS)
|
|
print(JSON.stringify(result))
|
|
if not bool(result["finished"]):
|
|
problems.append("seed %d stopped at '%s'" % [seed_value, result["step"]])
|
|
OS.remove_logger(errors)
|
|
if errors.count() > 0:
|
|
problems.append("%d script or engine errors, first: %s" % [errors.count(), errors.first()])
|
|
for problem: String in problems:
|
|
print("tutorial-check FAIL: %s" % problem)
|
|
if problems.is_empty():
|
|
print("tutorial-check: ok (%d seeds played from the ship to the end)" % seeds)
|
|
quit(0 if problems.is_empty() else 1)
|
|
|
|
|
|
## Plays one seed's tutorial with the pilot, a tick a frame, for up to `limit` game
|
|
## seconds. Returns {"seed", "finished", "step", "seconds", "steps": {name: seconds}}.
|
|
static func play(seed_value: int, limit: float) -> Dictionary:
|
|
var session: ClientSession = ClientSession.new()
|
|
session.input.autoplay = true
|
|
session.play_tutorial(seed_value)
|
|
var delta: float = 1.0 / Tuning.TICK_RATE_HZ
|
|
var frames: int = 0
|
|
var most: int = roundi(limit * Tuning.TICK_RATE_HZ)
|
|
while frames < most and not session.tutorial.finished():
|
|
session.pump(delta)
|
|
frames += 1
|
|
var steps: Dictionary = {}
|
|
for index: int in Tutorial.DONE:
|
|
steps[Tutorial.STEP_NAMES[index]] = snappedf(session.tutorial.step_seconds[index], 0.1)
|
|
var result: Dictionary = {
|
|
"seed": seed_value, "finished": session.tutorial.finished(), "step": session.tutorial.step_name(),
|
|
"seconds": snappedf(float(frames) * delta, 0.1), "steps": steps,
|
|
}
|
|
session.free()
|
|
return result
|