From aa797580a7f1375b1bc9133a5e16e5677729afc6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 12:49:21 -0500 Subject: [PATCH] #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 --- CLAUDE.md | 8 +- Makefile | 6 +- assets/models/figure/figure.json | 20 +- assets/models/figure/{sail.mtl => kite.mtl} | 10 + assets/models/figure/kite.obj | 764 ++++++++++++++++++ assets/models/figure/kite.obj.import | 25 + assets/models/figure/sail.obj | 403 --------- assets/models/figure/sail.obj.import | 25 - docs/ARCHITECTURE.md | 14 +- docs/ASSET_PROVENANCE.md | 6 +- docs/GDD.md | 29 +- docs/PLAY.md | 18 +- docs/STYLE.md | 7 +- docs/VISUAL_QA.md | 4 +- src/app/client_session.gd | 2 +- src/app/tutorial.gd | 8 +- src/app/tutorial_pilot.gd | 6 +- src/bots/bot_brain.gd | 5 +- src/bots/nav_bot.gd | 46 +- src/bots/soak_player.gd | 7 +- src/client/client_input.gd | 11 +- src/client/entities/entity_view.gd | 89 +- src/client/entities/figure_poses.gd | 4 +- src/client/entities/figure_rig.gd | 19 +- src/client/entities/vessel_models.gd | 225 ++++-- src/client/hud/chart_map.gd | 6 +- src/client/match_view.gd | 2 +- src/net/client_game.gd | 4 +- src/net/client_mirror.gd | 18 +- src/net/client_prediction.gd | 2 +- src/server/server_loop.gd | 2 +- src/sim/building.gd | 2 +- src/sim/drop.gd | 226 ++++-- src/sim/match.gd | 4 +- src/sim/match_rules.gd | 2 +- src/sim/movement.gd | 28 +- src/sim/simulation.gd | 12 +- src/sim/tuning.gd | 57 +- test/app/test_tutorial.gd | 4 +- test/bots/balance_report.gd | 2 +- test/bots/bot_batch.gd | 2 +- test/bots/test_scripted_player.gd | 11 +- test/capture/client_scene.gd | 8 +- .../{client_barge.tscn => client_ship.tscn} | 2 +- test/capture/figure_scene.gd | 4 +- test/capture/match_launch.tscn | 7 + test/capture/match_scene.gd | 34 +- .../{match_barge.tscn => match_ship.tscn} | 2 +- test/capture/vessels_scene.gd | 18 +- test/client/test_client_session.gd | 12 +- test/client/test_figure_rig.gd | 4 +- test/client/test_match_view.gd | 52 +- test/client/test_world_art.gd | 21 +- test/net/test_client_prediction.gd | 2 +- test/net/test_prediction_link.gd | 13 +- test/net/test_snapshot_stream.gd | 2 +- test/server/test_client_game.gd | 2 +- test/server/test_hostile_client.gd | 2 +- test/server/test_net_game.gd | 2 +- test/server/test_server_loop.gd | 5 +- test/server/test_world_replication.gd | 8 +- test/sim/test_drop.gd | 150 +++- test/sim/test_match.gd | 4 +- tools/bench.sh | 4 +- tools/match.sh | 4 +- tools/match_captures.sh | 4 +- tools/models/figure.py | 85 +- tools/provenance.gd | 2 +- tools/tutorial_check.gd | 2 +- 69 files changed, 1753 insertions(+), 847 deletions(-) rename assets/models/figure/{sail.mtl => kite.mtl} (81%) create mode 100644 assets/models/figure/kite.obj create mode 100644 assets/models/figure/kite.obj.import delete mode 100644 assets/models/figure/sail.obj delete mode 100644 assets/models/figure/sail.obj.import rename test/capture/{client_barge.tscn => client_ship.tscn} (91%) create mode 100644 test/capture/match_launch.tscn rename test/capture/{match_barge.tscn => match_ship.tscn} (91%) diff --git a/CLAUDE.md b/CLAUDE.md index 37d1cfb..a2ea77b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,11 +35,11 @@ continuity. | `make duo-matches` | M7: plays 10 bot-only duos matches (12 teams of two, under `nice`, about 5 min) and checks each is won by one team, bots go down and revive each other, no hit between teammates did damage, and the worst p99 tick is within budget. `DUO_MATCH_SEEDS`, `DUO_MATCH_FIRST` change the seeds. | | `make bot-builds` | M6: plays 40 bot-only matches (about 12 minutes, under `nice`) in which every other bot gathers and builds, and compares them with the rest. Builders must build in over a third of the fights they begin with the materials for a wall, lose fewer of the fights they build in than of the rest, and place no worse on average; every match's p99 tick must be within budget. `BOT_BUILDS_SEEDS=5 BOT_BUILDS_FIRST=40` changes the seeds; under 20 matches only completion and timing are judged. Lines in `build/bot_builds/matches.jsonl`. See docs/BALANCE.md. | | `make balance` | H3: plays 200 bot-only matches in four processes under `nice` (about 15 min) and writes `build/balance/report.txt`: match length, players standing over time, causes of death, eliminations by weapon and by difficulty. Fails if the median match is outside 12 to 18 minutes or a weapon takes over 35% of eliminations (`BALANCE_*` in tuning). `BALANCE_MATCHES`, `BALANCE_FIRST`, `BALANCE_JOBS` scale it. See docs/BALANCE.md. | -| `make match` | Plays one whole offline match, lobby to results: a scripted player and 23 bots on a local server (about 25 s). Saves the command log to `build/match/match.tclog`, replays it and checks the replay ends on the same state hash. `MATCH_SEED=N` changes the seed; the default, 29, is one where the scripted player also builds. | +| `make match` | Plays one whole offline match, lobby to results: a scripted player and 23 bots on a local server (about 25 s). Saves the command log to `build/match/match.tclog`, replays it and checks the replay ends on the same state hash. `MATCH_SEED=N` changes the seed; the default, 2, is one where the scripted player also builds. | | `make match-captures` | Renders eight stages of that match from its command log (`captures/match_.png`), about 3 minutes. Needs Docker. Look at them. | | `make terrain-capture` | Renders the terrain crack check and a skirtless control in the capture container. The control must crack and the real terrain must not. Needs Docker. | | `tools/godot.sh -- --connect=HOST:PORT --autoplay --client-seconds=N` | Runs the client headless against a server for N seconds, played by its script, and prints one JSON line saying how far it got. `--offline` plays a server in the same process instead. On a real display, with no options, the game opens on its main menu (`AppShell`); see `src/app/client_config.gd`. | -| `make tutorial-check` | A12: the tutorial's scripted player (`TutorialPilot`) plays it from the barge to the end on 12 seeds through a real `ClientSession` and its offline server (about 40 s). `TUTORIAL_SEEDS`, `TUTORIAL_FIRST` change the seeds. `tidewall --tutorial --autoplay` does the same in one process in real time. | +| `make tutorial-check` | A12: the tutorial's scripted player (`TutorialPilot`) plays it from the ship to the end on 12 seeds through a real `ClientSession` and its offline server (about 40 s). `TUTORIAL_SEEDS`, `TUTORIAL_FIRST` change the seeds. `tidewall --tutorial --autoplay` does the same in one process in real time. | | `make tutorial-captures` | Renders the tutorial's card at the move, build and tide steps and the first-launch welcome (`captures/tutorial_*.png`, `menu_welcome.png`, about 2 min). Needs Docker. Look at them. | | `make access-captures` | A13: renders the Gamepad and Access settings tabs, the menus and HUD at 130%, the build ghost allowed and refused in the red-green colour set, captions on the HUD, and the aim zoom with and without reduce motion (`captures/access_*.png`, about 6 min). Needs Docker. Look at them. Gamepad and accessibility tests are in `test/client/test_pad_input.gd`, `test_aim_assist.gd`, `test_captions.gd`, `test/ui/test_menus.gd` and `test/project/test_palette.gd`. | | `make client-check` | Starts a server and a client as two processes, joins them over loopback UDP and checks the client plays (about a minute, real time). | @@ -47,12 +47,12 @@ continuity. | `tools/godot.sh -- --browse [--list=HOST[:PORT]] [--lan-target=IP] [--lan-port=N]` | Looks for servers on the LAN and in list servers and prints them as one JSON line. The join menu (A10) shows the same list. | | `make discovery-check` | Starts a list server and a game server as processes and checks `--browse` finds the game both on the LAN (loopback) and through the list (about 15 s). | | `make fuzz` | Feeds 1,000,000 malformed messages (`FUZZ_MESSAGES=N`, `FUZZ_SEED=N`) to every network parser and fails on any engine error or memory growth (about 40 s). | -| `make client-captures` | Renders what a network client sees on the barge, gliding and landed, the build ghost allowed and refused, and a breakwater basin kept dry by the tide (`captures/client_.png`, about 4 min). Needs Docker. Look at them. | +| `make client-captures` | Renders what a network client sees on the ship, gliding and landed, the build ghost allowed and refused, and a breakwater basin kept dry by the tide (`captures/client_.png`, about 4 min). Needs Docker. Look at them. | | `make hud-captures` | Renders the HUD over a staged moment of play (three bots out, carried items, a wound) at 1280x720, in build mode, and at 3840x2160 (`captures/hud_*.png`, about 5 min). Needs Docker. Look at them. | | `make menu-captures` | Renders every menu screen: main, practice, join (with a made-up server list), settings (controls and mouse tabs), pause and results over a match (`captures/menu_*.png`, about 5 min). Needs Docker. Look at them. | | `make chart-captures` | Renders the chart and minimap of seed 2 with the first tide forecast, and again once it has risen (`captures/chart_*.png`, about 2 min). Needs Docker. Look at them. | | `make poi-captures` | Renders each kind of point of interest (`captures/poi_*.png`, about 3 min). Needs Docker. Look at them. | -| `make build-captures` | Renders the fort and the wall test card: a row per material, a column per state (half built, intact, worn, battered), and a battered ramp (`captures/build_*.png`), and the barge and sea chests (`captures/vessels.png`), about 2 min. Needs Docker. Look at them. | +| `make build-captures` | Renders the fort and the wall test card: a row per material, a column per state (half built, intact, worn, battered), and a battered ramp (`captures/build_*.png`), and the packet ship and sea chests (`captures/vessels.png`), about 2 min. Needs Docker. Look at them. | | `tools/capture.sh canopy captures/canopy.png` | H11: the shoulder camera on a player against a pine, with canopies in the way hidden (`canopy_before` puts them back). | | `make style-captures` | Renders a hamlet and a dock with and without the woodcut print pass (`captures/style_*.png`). Needs Docker. | | `make stability` | H4: one dedicated server plays 50 bot matches back to back, unthrottled, under `nice` (about 13 min), sampling its resident memory. Fails on a crash, hang, engine or script error, a match without a winner, or memory growing more than 256 KiB (static) or 1 MiB (resident) a match after the first five. `STABILITY_MATCHES`, `STABILITY_SEED`, `STABILITY_DIR` scale it. Report in `build/stability/report.txt`. | diff --git a/Makefile b/Makefile index f9f8b48..159033e 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,7 @@ match: import match-captures: import @tools/match_captures.sh -## A12: the tutorial's scripted player finishes it from the barge to the end on 12 +## A12: the tutorial's scripted player finishes it from the ship to the end on 12 ## seeds, through a real ClientSession and its offline server (about 40 s). tutorial-check: import @nice -n 15 $(GODOT) --script res://tools/tutorial_check.gd -- --seeds=$${TUTORIAL_SEEDS:-12} --first=$${TUTORIAL_FIRST:-1} @@ -164,9 +164,9 @@ fuzz: import discovery-check: import @tools/discovery_check.sh -## Renders what a network client sees on the barge, gliding and landed. Needs Docker. +## Renders what a network client sees on the ship, gliding and landed. Needs Docker. client-captures: import - @for stage in barge glide landed basin build build_refused hud hud_build; do tools/capture.sh client_$$stage captures/client_$$stage.png; done + @for stage in ship glide landed basin build build_refused hud hud_build; do tools/capture.sh client_$$stage captures/client_$$stage.png; done ## A9: the HUD at 1280x720 and at 3840x2160 (captures/hud_*.png). Needs Docker. hud-captures: import diff --git a/assets/models/figure/figure.json b/assets/models/figure/figure.json index 1b42b6c..41ed2fa 100644 --- a/assets/models/figure/figure.json +++ b/assets/models/figure/figure.json @@ -37,6 +37,11 @@ 0.92, 0.0 ], + "kite": [ + 0.0, + 1.46, + -0.2 + ], "knee_l": [ 0.11, 0.49, @@ -52,11 +57,6 @@ 1.5, 0.0 ], - "sail": [ - 0.0, - 1.46, - -0.2 - ], "shoulder_l": [ 0.225, 1.42, @@ -86,12 +86,12 @@ "joint": "neck", "parent": "waist" }, - "pelvis": { - "joint": "hips", + "kite": { + "joint": "kite", "parent": null }, - "sail": { - "joint": "sail", + "pelvis": { + "joint": "hips", "parent": null }, "shin_l": { @@ -123,5 +123,5 @@ "parent": "waist" } }, - "triangles_before_bevel": 1484 + "triangles_before_bevel": 1640 } diff --git a/assets/models/figure/sail.mtl b/assets/models/figure/kite.mtl similarity index 81% rename from assets/models/figure/sail.mtl rename to assets/models/figure/kite.mtl index 969431a..33906c2 100644 --- a/assets/models/figure/sail.mtl +++ b/assets/models/figure/kite.mtl @@ -31,6 +31,16 @@ Ni 1.500000 d 1.000000 illum 2 +newmtl SALT +Ns 39.999996 +Ka 1.000000 1.000000 1.000000 +Kd 0.787412 0.787412 0.710566 +Ks 0.500000 0.500000 0.500000 +Ke 0.000000 0.000000 0.000000 +Ni 1.500000 +d 1.000000 +illum 2 + newmtl TAR Ns 39.999996 Ka 1.000000 1.000000 1.000000 diff --git a/assets/models/figure/kite.obj b/assets/models/figure/kite.obj new file mode 100644 index 0000000..5803726 --- /dev/null +++ b/assets/models/figure/kite.obj @@ -0,0 +1,764 @@ +# Blender 4.3.2 +# www.blender.org +mtllib kite.mtl +o Cube.016 +v -0.878096 0.855646 0.485804 +v -0.874085 0.866907 0.486857 +v -0.782790 0.894006 -0.287401 +v -0.778779 0.905267 -0.286348 +v -0.111769 0.575189 0.566348 +v -0.107758 0.586450 0.567401 +v -0.016463 0.613550 -0.206857 +v -0.012452 0.624811 -0.205804 +vn -0.9345 0.3420 -0.0982 +vn 0.1222 0.0492 -0.9913 +vn 0.9345 -0.3420 0.0982 +vn -0.1222 -0.0492 0.9913 +vn -0.3342 -0.9384 -0.0878 +vn 0.3342 0.9384 0.0878 +s 0 +usemtl SALT +f 2//1 3//1 1//1 +f 4//2 7//2 3//2 +f 8//3 5//3 7//3 +f 6//4 1//4 5//4 +f 7//5 1//5 3//5 +f 4//6 6//6 8//6 +f 2//1 4//1 3//1 +f 4//2 8//2 7//2 +f 8//3 6//3 5//3 +f 6//4 2//4 1//4 +f 7//5 5//5 1//5 +f 4//6 2//6 6//6 +o Cube.017 +v -1.637325 0.645613 0.206717 +v -1.640674 0.657133 0.206410 +v -1.490945 0.673786 -0.333079 +v -1.494294 0.685305 -0.333385 +v -0.916587 0.860610 0.413385 +v -0.919935 0.872130 0.413079 +v -0.770207 0.888783 -0.126410 +v -0.773555 0.900302 -0.126717 +vn -0.9240 -0.2756 -0.2650 +vn 0.2614 0.0503 -0.9639 +vn 0.9240 0.2756 0.2650 +vn -0.2614 -0.0503 0.9639 +vn 0.2790 -0.9599 0.0256 +vn -0.2790 0.9599 -0.0256 +s 0 +usemtl SALT +f 10//7 11//7 9//7 +f 12//8 15//8 11//8 +f 16//9 13//9 15//9 +f 14//10 9//10 13//10 +f 15//11 9//11 11//11 +f 12//12 14//12 16//12 +f 10//7 12//7 11//7 +f 12//8 16//8 15//8 +f 16//9 14//9 13//9 +f 14//10 10//10 9//10 +f 15//11 13//11 9//11 +f 12//12 10//12 14//12 +o Cube.018 +v -1.668026 0.640348 0.145771 +v -1.672490 0.655707 0.145362 +v -1.553013 0.662484 -0.278354 +v -1.557478 0.677843 -0.278763 +v -1.483221 0.695475 0.198763 +v -1.487686 0.710835 0.198354 +v -1.368208 0.717611 -0.225362 +v -1.372673 0.732970 -0.225771 +vn -0.9240 -0.2756 -0.2650 +vn 0.2614 0.0503 -0.9639 +vn 0.9240 0.2756 0.2650 +vn -0.2614 -0.0503 0.9639 +vn 0.2790 -0.9599 0.0256 +vn -0.2790 0.9599 -0.0256 +s 0 +usemtl TAR +f 18//13 19//13 17//13 +f 20//14 23//14 19//14 +f 24//15 21//15 23//15 +f 22//16 17//16 21//16 +f 23//17 17//17 19//17 +f 20//18 22//18 24//18 +f 18//13 20//13 19//13 +f 20//14 24//14 23//14 +f 24//15 22//15 21//15 +f 22//16 18//16 17//16 +f 23//17 21//17 17//17 +f 20//18 18//18 22//18 +o Cube.019 +v -0.837555 0.875552 0.508503 +v -0.831539 0.892443 0.510082 +v -0.825336 0.880470 0.409374 +v -0.819320 0.897361 0.410953 +v -0.071228 0.595095 0.589047 +v -0.065212 0.611987 0.590626 +v -0.059009 0.600013 0.489918 +v -0.052993 0.616905 0.491497 +vn -0.9345 0.3420 -0.0982 +vn 0.1222 0.0492 -0.9913 +vn 0.9345 -0.3420 0.0982 +vn -0.1222 -0.0492 0.9913 +vn -0.3342 -0.9384 -0.0878 +vn 0.3342 0.9384 0.0878 +s 0 +usemtl OCHRE_RED +f 26//19 27//19 25//19 +f 28//20 31//20 27//20 +f 32//21 29//21 31//21 +f 30//22 25//22 29//22 +f 31//23 25//23 27//23 +f 28//24 30//24 32//24 +f 26//19 28//19 27//19 +f 28//20 32//20 31//20 +f 32//21 30//21 29//21 +f 30//22 26//22 25//22 +f 31//23 29//23 25//23 +f 28//24 26//24 30//24 +o Cube.020 +v -1.576368 0.660304 0.245092 +v -1.581390 0.677583 0.244632 +v -1.550229 0.665335 0.148700 +v -1.555251 0.682614 0.148240 +v -0.855629 0.875302 0.451760 +v -0.860651 0.892581 0.451300 +v -0.829490 0.880332 0.355368 +v -0.834512 0.897611 0.354908 +vn -0.9240 -0.2756 -0.2650 +vn 0.2614 0.0503 -0.9639 +vn 0.9240 0.2756 0.2650 +vn -0.2614 -0.0503 0.9639 +vn 0.2790 -0.9599 0.0256 +vn -0.2790 0.9599 -0.0256 +s 0 +usemtl OCHRE_RED +f 34//25 35//25 33//25 +f 36//26 39//26 35//26 +f 40//27 37//27 39//27 +f 38//28 33//28 37//28 +f 39//29 33//29 35//29 +f 36//30 38//30 40//30 +f 34//25 36//25 35//25 +f 36//26 40//26 39//26 +f 40//27 38//27 37//27 +f 38//28 34//28 33//28 +f 39//29 37//29 33//29 +f 36//30 34//30 38//30 +o Cylinder.010 +v -0.826347 0.900456 0.419837 +v -0.060020 0.620000 0.500382 +v -0.833284 0.884180 0.429163 +v -0.066957 0.603724 0.509708 +v -0.835374 0.884180 0.449054 +v -0.069047 0.603724 0.529598 +v -0.830528 0.900456 0.459618 +v -0.064201 0.620000 0.540163 +v -0.823591 0.916732 0.450292 +v -0.057264 0.636276 0.530837 +v -0.821501 0.916732 0.430402 +v -0.055174 0.636276 0.510946 +vn -0.0795 -0.4698 -0.8792 +vn -0.3401 -0.9397 -0.0358 +vn -0.2606 -0.4698 0.8434 +vn 0.0795 0.4698 0.8792 +vn 0.9345 -0.3420 0.0982 +vn 0.3401 0.9397 0.0358 +vn 0.2606 0.4698 -0.8434 +vn -0.9345 0.3420 -0.0982 +s 0 +usemtl PLANK +f 42//31 43//31 41//31 +f 44//32 45//32 43//32 +f 45//33 48//33 47//33 +f 48//34 49//34 47//34 +f 42//35 50//35 46//35 +f 49//36 52//36 51//36 +f 52//37 41//37 51//37 +f 43//38 47//38 51//38 +f 42//31 44//31 43//31 +f 44//32 46//32 45//32 +f 45//33 46//33 48//33 +f 48//34 50//34 49//34 +f 46//35 44//35 42//35 +f 42//35 52//35 50//35 +f 50//35 48//35 46//35 +f 49//36 50//36 52//36 +f 52//37 42//37 41//37 +f 51//38 41//38 43//38 +f 43//38 45//38 47//38 +f 47//38 49//38 51//38 +o Cylinder.011 +v -1.560848 0.685459 0.159363 +v -0.840109 0.900457 0.366032 +v -1.559198 0.670475 0.169199 +v -0.838460 0.885472 0.375867 +v -1.564160 0.670475 0.186501 +v -0.843421 0.885472 0.393170 +v -1.570771 0.685459 0.193968 +v -0.850032 0.900457 0.400637 +v -1.572420 0.700444 0.184133 +v -0.851682 0.915441 0.390801 +v -1.567459 0.700444 0.166830 +v -0.846720 0.915441 0.373499 +vn 0.3712 -0.4806 -0.7945 +vn 0.2650 -0.9613 0.0760 +vn -0.1062 -0.4806 0.8705 +vn -0.3712 0.4806 0.7945 +vn 0.9240 0.2756 0.2650 +vn -0.2650 0.9613 -0.0760 +vn 0.1062 0.4806 -0.8705 +vn -0.9240 -0.2756 -0.2650 +s 0 +usemtl PLANK +f 54//39 55//39 53//39 +f 56//40 57//40 55//40 +f 58//41 59//41 57//41 +f 60//42 61//42 59//42 +f 54//43 62//43 58//43 +f 62//44 63//44 61//44 +f 64//45 53//45 63//45 +f 55//46 59//46 63//46 +f 54//39 56//39 55//39 +f 56//40 58//40 57//40 +f 58//41 60//41 59//41 +f 60//42 62//42 61//42 +f 58//43 56//43 54//43 +f 54//43 64//43 62//43 +f 62//43 60//43 58//43 +f 62//44 64//44 63//44 +f 64//45 54//45 53//45 +f 63//46 53//46 55//46 +f 55//46 57//46 59//46 +f 59//46 61//46 63//46 +o Cylinder.012 +v -0.145127 0.060144 0.073000 +v -0.494873 0.619856 0.073000 +v -0.139190 0.063854 0.080000 +v -0.488937 0.623565 0.080000 +v -0.145127 0.060144 0.087000 +v -0.494873 0.619856 0.087000 +v -0.151063 0.056435 0.080000 +v -0.500810 0.616146 0.080000 +vn 0.5997 0.3747 -0.7071 +vn 0.5997 0.3747 0.7071 +vn -0.5299 0.8480 -0.0000 +vn -0.5997 -0.3747 0.7071 +vn -0.5997 -0.3747 -0.7071 +vn 0.5299 -0.8480 -0.0000 +s 0 +usemtl TAR +f 66//47 67//47 65//47 +f 68//48 69//48 67//48 +f 66//49 70//49 68//49 +f 70//50 71//50 69//50 +f 72//51 65//51 71//51 +f 67//52 71//52 65//52 +f 66//47 68//47 67//47 +f 68//48 70//48 69//48 +f 66//49 72//49 70//49 +f 70//50 72//50 71//50 +f 72//51 66//51 65//51 +f 67//52 69//52 71//52 +o Cylinder.013 +v -0.202742 0.112348 0.073000 +v -0.797258 0.647652 0.073000 +v -0.198058 0.117550 0.080000 +v -0.792574 0.652854 0.080000 +v -0.202742 0.112348 0.087000 +v -0.797258 0.647652 0.087000 +v -0.207426 0.107146 0.080000 +v -0.801942 0.642450 0.080000 +vn 0.4731 0.5255 -0.7071 +vn 0.4731 0.5255 0.7071 +vn -0.7431 0.6691 -0.0000 +vn -0.4731 -0.5255 0.7071 +vn -0.4731 -0.5255 -0.7071 +vn 0.7431 -0.6691 -0.0000 +s 0 +usemtl TAR +f 74//53 75//53 73//53 +f 76//54 77//54 75//54 +f 74//55 78//55 76//55 +f 78//56 79//56 77//56 +f 80//57 73//57 79//57 +f 75//58 79//58 73//58 +f 74//53 76//53 75//53 +f 76//54 78//54 77//54 +f 74//55 80//55 78//55 +f 78//56 80//56 79//56 +f 80//57 74//57 73//57 +f 75//58 77//58 79//58 +o Cube.021 +v 0.111769 0.575189 0.566348 +v 0.107758 0.586450 0.567401 +v 0.016463 0.613550 -0.206857 +v 0.012452 0.624811 -0.205804 +v 0.878096 0.855646 0.485804 +v 0.874085 0.866907 0.486857 +v 0.782790 0.894006 -0.287401 +v 0.778779 0.905267 -0.286348 +vn -0.9345 -0.3420 0.0982 +vn -0.1222 0.0492 -0.9913 +vn 0.9345 0.3420 -0.0982 +vn 0.1222 -0.0492 0.9913 +vn 0.3342 -0.9384 -0.0878 +vn -0.3342 0.9384 0.0878 +s 0 +usemtl SALT +f 82//59 83//59 81//59 +f 84//60 87//60 83//60 +f 88//61 85//61 87//61 +f 86//62 81//62 85//62 +f 87//63 81//63 83//63 +f 84//64 86//64 88//64 +f 82//59 84//59 83//59 +f 84//60 88//60 87//60 +f 88//61 86//61 85//61 +f 86//62 82//62 81//62 +f 87//63 85//63 81//63 +f 84//64 82//64 86//64 +o Cube.022 +v 0.916587 0.860610 0.413385 +v 0.919935 0.872130 0.413079 +v 0.770207 0.888783 -0.126410 +v 0.773555 0.900302 -0.126717 +v 1.637325 0.645613 0.206717 +v 1.640674 0.657133 0.206410 +v 1.490945 0.673786 -0.333079 +v 1.494294 0.685305 -0.333385 +vn -0.9240 0.2756 0.2650 +vn -0.2614 0.0503 -0.9639 +vn 0.9240 -0.2756 -0.2650 +vn 0.2614 -0.0503 0.9639 +vn -0.2790 -0.9599 0.0256 +vn 0.2790 0.9599 -0.0256 +s 0 +usemtl SALT +f 90//65 91//65 89//65 +f 92//66 95//66 91//66 +f 96//67 93//67 95//67 +f 94//68 89//68 93//68 +f 95//69 89//69 91//69 +f 92//70 94//70 96//70 +f 90//65 92//65 91//65 +f 92//66 96//66 95//66 +f 96//67 94//67 93//67 +f 94//68 90//68 89//68 +f 95//69 93//69 89//69 +f 92//70 90//70 94//70 +o Cube.023 +v 1.483221 0.695475 0.198763 +v 1.487686 0.710835 0.198354 +v 1.368208 0.717611 -0.225362 +v 1.372673 0.732970 -0.225771 +v 1.668026 0.640348 0.145771 +v 1.672490 0.655707 0.145362 +v 1.553013 0.662484 -0.278354 +v 1.557478 0.677843 -0.278763 +vn -0.9240 0.2756 0.2650 +vn -0.2614 0.0503 -0.9639 +vn 0.9240 -0.2756 -0.2650 +vn 0.2614 -0.0503 0.9639 +vn -0.2790 -0.9599 0.0256 +vn 0.2790 0.9599 -0.0256 +s 0 +usemtl TAR +f 98//71 99//71 97//71 +f 100//72 103//72 99//72 +f 104//73 101//73 103//73 +f 102//74 97//74 101//74 +f 103//75 97//75 99//75 +f 100//76 102//76 104//76 +f 98//71 100//71 99//71 +f 100//72 104//72 103//72 +f 104//73 102//73 101//73 +f 102//74 98//74 97//74 +f 103//75 101//75 97//75 +f 100//76 98//76 102//76 +o Cube.024 +v 0.071228 0.595095 0.589047 +v 0.065212 0.611987 0.590626 +v 0.059009 0.600013 0.489918 +v 0.052993 0.616905 0.491497 +v 0.837555 0.875552 0.508503 +v 0.831539 0.892443 0.510082 +v 0.825336 0.880470 0.409374 +v 0.819320 0.897361 0.410953 +vn -0.9345 -0.3420 0.0982 +vn -0.1222 0.0492 -0.9913 +vn 0.9345 0.3420 -0.0982 +vn 0.1222 -0.0492 0.9913 +vn 0.3342 -0.9384 -0.0878 +vn -0.3342 0.9384 0.0878 +s 0 +usemtl OCHRE_RED +f 106//77 107//77 105//77 +f 108//78 111//78 107//78 +f 112//79 109//79 111//79 +f 110//80 105//80 109//80 +f 111//81 105//81 107//81 +f 108//82 110//82 112//82 +f 106//77 108//77 107//77 +f 108//78 112//78 111//78 +f 112//79 110//79 109//79 +f 110//80 106//80 105//80 +f 111//81 109//81 105//81 +f 108//82 106//82 110//82 +o Cube.025 +v 0.855629 0.875302 0.451760 +v 0.860651 0.892581 0.451300 +v 0.829490 0.880332 0.355368 +v 0.834512 0.897611 0.354908 +v 1.576368 0.660304 0.245092 +v 1.581390 0.677583 0.244632 +v 1.550229 0.665335 0.148700 +v 1.555251 0.682614 0.148240 +vn -0.9240 0.2756 0.2650 +vn -0.2614 0.0503 -0.9639 +vn 0.9240 -0.2756 -0.2650 +vn 0.2614 -0.0503 0.9639 +vn -0.2790 -0.9599 0.0256 +vn 0.2790 0.9599 -0.0256 +s 0 +usemtl OCHRE_RED +f 114//83 115//83 113//83 +f 116//84 119//84 115//84 +f 120//85 117//85 119//85 +f 118//86 113//86 117//86 +f 119//87 113//87 115//87 +f 116//88 118//88 120//88 +f 114//83 116//83 115//83 +f 116//84 120//84 119//84 +f 120//85 118//85 117//85 +f 118//86 114//86 113//86 +f 119//87 117//87 113//87 +f 116//88 114//88 118//88 +o Cylinder.014 +v 0.060020 0.620000 0.500382 +v 0.826347 0.900456 0.419837 +v 0.066957 0.603724 0.509708 +v 0.833284 0.884181 0.429163 +v 0.069047 0.603724 0.529598 +v 0.835374 0.884181 0.449054 +v 0.064201 0.620000 0.540163 +v 0.830528 0.900456 0.459618 +v 0.057264 0.636276 0.530837 +v 0.823591 0.916732 0.450292 +v 0.055174 0.636276 0.510946 +v 0.821501 0.916732 0.430402 +vn 0.0795 -0.4698 -0.8792 +vn 0.3401 -0.9397 -0.0358 +vn 0.2606 -0.4698 0.8434 +vn -0.0795 0.4698 0.8792 +vn 0.9345 0.3420 -0.0982 +vn -0.3401 0.9397 0.0358 +vn -0.2606 0.4698 -0.8434 +vn -0.9345 -0.3420 0.0982 +s 0 +usemtl PLANK +f 122//89 123//89 121//89 +f 124//90 125//90 123//90 +f 126//91 127//91 125//91 +f 128//92 129//92 127//92 +f 122//93 130//93 126//93 +f 130//94 131//94 129//94 +f 132//95 121//95 131//95 +f 123//96 127//96 131//96 +f 122//89 124//89 123//89 +f 124//90 126//90 125//90 +f 126//91 128//91 127//91 +f 128//92 130//92 129//92 +f 126//93 124//93 122//93 +f 122//93 132//93 130//93 +f 130//93 128//93 126//93 +f 130//94 132//94 131//94 +f 132//95 122//95 121//95 +f 131//96 121//96 123//96 +f 123//96 125//96 127//96 +f 127//96 129//96 131//96 +o Cylinder.015 +v 0.840109 0.900457 0.366032 +v 1.560848 0.685459 0.159363 +v 0.838460 0.885472 0.375867 +v 1.559198 0.670475 0.169199 +v 0.843421 0.885472 0.393170 +v 1.564160 0.670475 0.186501 +v 0.850032 0.900457 0.400637 +v 1.570771 0.685459 0.193968 +v 0.851682 0.915441 0.390801 +v 1.572420 0.700444 0.184133 +v 0.846720 0.915441 0.373499 +v 1.567459 0.700444 0.166830 +vn -0.3712 -0.4806 -0.7945 +vn -0.2650 -0.9613 0.0760 +vn 0.1062 -0.4806 0.8705 +vn 0.3712 0.4806 0.7945 +vn 0.9240 -0.2756 -0.2650 +vn 0.2650 0.9613 -0.0760 +vn -0.1062 0.4806 -0.8705 +vn -0.9240 0.2756 0.2650 +s 0 +usemtl PLANK +f 134//97 135//97 133//97 +f 136//98 137//98 135//98 +f 138//99 139//99 137//99 +f 140//100 141//100 139//100 +f 134//101 142//101 138//101 +f 142//102 143//102 141//102 +f 144//103 133//103 143//103 +f 135//104 139//104 143//104 +f 134//97 136//97 135//97 +f 136//98 138//98 137//98 +f 138//99 140//99 139//99 +f 140//100 142//100 141//100 +f 138//101 136//101 134//101 +f 134//101 144//101 142//101 +f 142//101 140//101 138//101 +f 142//102 144//102 143//102 +f 144//103 134//103 133//103 +f 143//104 133//104 135//104 +f 135//104 137//104 139//104 +f 139//104 141//104 143//104 +o Cylinder.016 +v 0.145127 0.060144 0.073000 +v 0.494873 0.619856 0.073000 +v 0.151063 0.056435 0.080000 +v 0.500810 0.616146 0.080000 +v 0.145127 0.060144 0.087000 +v 0.494873 0.619856 0.087000 +v 0.139190 0.063854 0.080000 +v 0.488937 0.623565 0.080000 +vn 0.5997 -0.3747 -0.7071 +vn 0.5997 -0.3747 0.7071 +vn 0.5299 0.8480 -0.0000 +vn -0.5997 0.3747 0.7071 +vn -0.5997 0.3747 -0.7071 +vn -0.5299 -0.8480 -0.0000 +s 0 +usemtl TAR +f 146//105 147//105 145//105 +f 148//106 149//106 147//106 +f 146//107 150//107 148//107 +f 150//108 151//108 149//108 +f 152//109 145//109 151//109 +f 147//110 151//110 145//110 +f 146//105 148//105 147//105 +f 148//106 150//106 149//106 +f 146//107 152//107 150//107 +f 150//108 152//108 151//108 +f 152//109 146//109 145//109 +f 147//110 149//110 151//110 +o Cylinder.017 +v 0.202742 0.112348 0.073000 +v 0.797258 0.647652 0.073000 +v 0.207426 0.107146 0.080000 +v 0.801942 0.642450 0.080000 +v 0.202742 0.112348 0.087000 +v 0.797258 0.647652 0.087000 +v 0.198058 0.117550 0.080000 +v 0.792574 0.652854 0.080000 +vn 0.4731 -0.5255 -0.7071 +vn 0.4731 -0.5255 0.7071 +vn 0.7431 0.6691 -0.0000 +vn -0.4731 0.5255 0.7071 +vn -0.4731 0.5255 -0.7071 +vn -0.7431 -0.6691 -0.0000 +s 0 +usemtl TAR +f 154//111 155//111 153//111 +f 156//112 157//112 155//112 +f 154//113 158//113 156//113 +f 158//114 159//114 157//114 +f 160//115 153//115 159//115 +f 155//116 159//116 153//116 +f 154//111 156//111 155//111 +f 156//112 158//112 157//112 +f 154//113 160//113 158//113 +f 158//114 160//114 159//114 +f 160//115 154//115 153//115 +f 155//116 157//116 159//116 +o Cone.012 +v 0.000000 0.690000 -0.330000 +v 0.000000 0.650000 0.570000 +v 0.049497 0.669497 -0.330000 +v 0.021213 0.641213 0.570000 +v 0.070000 0.620000 -0.330000 +v 0.030000 0.620000 0.570000 +v 0.049497 0.570503 -0.330000 +v 0.021213 0.598787 0.570000 +v 0.000000 0.550000 -0.330000 +v 0.000000 0.590000 0.570000 +v -0.049497 0.570503 -0.330000 +v -0.021213 0.598787 0.570000 +v -0.070000 0.620000 -0.330000 +v -0.030000 0.620000 0.570000 +v -0.049497 0.669497 -0.330000 +v -0.021213 0.641213 0.570000 +vn 0.3824 0.9231 0.0410 +vn 0.9231 0.3824 0.0410 +vn 0.9231 -0.3824 0.0410 +vn 0.3824 -0.9231 0.0410 +vn -0.3824 -0.9231 0.0410 +vn -0.9231 -0.3824 0.0410 +vn -0.0000 -0.0000 1.0000 +vn -0.9231 0.3824 0.0410 +vn -0.3824 0.9231 0.0410 +vn -0.0000 -0.0000 -1.0000 +s 0 +usemtl CANVAS +f 162//117 163//117 161//117 +f 164//118 165//118 163//118 +f 166//119 167//119 165//119 +f 168//120 169//120 167//120 +f 170//121 171//121 169//121 +f 172//122 173//122 171//122 +f 174//123 170//123 166//123 +f 174//124 175//124 173//124 +f 176//125 161//125 175//125 +f 167//126 171//126 175//126 +f 162//117 164//117 163//117 +f 164//118 166//118 165//118 +f 166//119 168//119 167//119 +f 168//120 170//120 169//120 +f 170//121 172//121 171//121 +f 172//122 174//122 173//122 +f 166//123 164//123 162//123 +f 162//123 176//123 174//123 +f 174//123 172//123 170//123 +f 170//123 168//123 166//123 +f 166//123 162//123 174//123 +f 174//124 176//124 175//124 +f 176//125 162//125 161//125 +f 175//126 161//126 163//126 +f 163//126 165//126 167//126 +f 167//126 169//126 171//126 +f 171//126 173//126 175//126 +f 175//126 163//126 167//126 +o Cube.026 +v -0.210000 0.594000 -0.330000 +v -0.210000 0.606000 -0.330000 +v -0.210000 0.594000 -0.630000 +v -0.210000 0.606000 -0.630000 +v 0.210000 0.594000 -0.330000 +v 0.210000 0.606000 -0.330000 +v 0.210000 0.594000 -0.630000 +v 0.210000 0.606000 -0.630000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +s 0 +usemtl SALT +f 178//127 179//127 177//127 +f 180//128 183//128 179//128 +f 184//129 181//129 183//129 +f 182//130 177//130 181//130 +f 183//131 177//131 179//131 +f 180//132 182//132 184//132 +f 178//127 180//127 179//127 +f 180//128 184//128 183//128 +f 184//129 182//129 181//129 +f 182//130 178//130 177//130 +f 183//131 181//131 177//131 +f 180//132 178//132 182//132 +o Cube.027 +v -0.172000 0.015000 0.017000 +v -0.172000 0.023000 0.025000 +v -0.180000 0.023000 0.017000 +v -0.172000 0.057000 0.025000 +v -0.172000 0.065000 0.017000 +v -0.180000 0.057000 0.017000 +v -0.172000 0.015000 -0.017000 +v -0.180000 0.023000 -0.017000 +v -0.172000 0.023000 -0.025000 +v -0.172000 0.065000 -0.017000 +v -0.172000 0.057000 -0.025000 +v -0.180000 0.057000 -0.017000 +v 0.172000 0.015000 0.017000 +v 0.180000 0.023000 0.017000 +v 0.172000 0.023000 0.025000 +v 0.172000 0.065000 0.017000 +v 0.172000 0.057000 0.025000 +v 0.180000 0.057000 0.017000 +v 0.172000 0.015000 -0.017000 +v 0.172000 0.023000 -0.025000 +v 0.180000 0.023000 -0.017000 +v 0.172000 0.065000 -0.017000 +v 0.180000 0.057000 -0.017000 +v 0.172000 0.057000 -0.025000 +vn -0.0000 -0.0000 1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn -0.5773 -0.5774 0.5774 +vn -0.5773 0.5774 0.5774 +vn -0.5773 -0.5774 -0.5774 +vn -0.5773 0.5774 -0.5774 +vn 0.5773 -0.5774 0.5774 +vn 0.5773 0.5774 0.5774 +vn 0.5773 -0.5774 -0.5774 +vn 0.5773 0.5774 -0.5774 +vn -0.7071 -0.7071 -0.0000 +vn -0.7071 -0.0000 0.7071 +vn -0.7071 0.7071 -0.0000 +vn -0.7071 -0.0000 -0.7071 +vn -0.0000 -0.7071 -0.7071 +vn -0.0000 0.7071 -0.7071 +vn 0.7071 -0.0000 -0.7071 +vn 0.7071 -0.7071 -0.0000 +vn 0.7071 0.7071 -0.0000 +vn 0.7071 -0.0000 0.7071 +vn -0.0000 -0.7071 0.7071 +vn -0.0000 0.7071 0.7071 +vn -0.0000 -1.0000 -0.0000 +s 0 +usemtl PLANK +f 201//133 186//133 199//133 +f 207//134 198//134 205//134 +f 194//135 200//135 206//135 +f 190//136 192//136 187//136 +f 195//137 204//137 193//137 +f 185//138 186//138 187//138 +f 188//139 189//139 190//139 +f 191//140 192//140 193//140 +f 194//141 195//141 196//141 +f 197//142 198//142 199//142 +f 200//143 201//143 202//143 +f 203//144 204//144 205//144 +f 206//145 207//145 208//145 +f 185//146 192//146 191//146 +f 188//147 187//147 186//147 +f 194//148 190//148 189//148 +f 193//149 196//149 195//149 +f 191//150 204//150 203//150 +f 206//151 195//151 194//151 +f 205//152 208//152 207//152 +f 203//153 198//153 197//153 +f 200//154 207//154 206//154 +f 199//155 202//155 201//155 +f 197//156 186//156 185//156 +f 189//157 201//157 200//157 +f 203//158 185//158 191//158 +f 201//133 188//133 186//133 +f 207//134 202//134 198//134 +f 194//135 189//135 200//135 +f 190//136 196//136 192//136 +f 195//137 208//137 204//137 +f 185//146 187//146 192//146 +f 188//147 190//147 187//147 +f 194//148 196//148 190//148 +f 193//149 192//149 196//149 +f 191//150 193//150 204//150 +f 206//151 208//151 195//151 +f 205//152 204//152 208//152 +f 203//153 205//153 198//153 +f 200//154 202//154 207//154 +f 199//155 198//155 202//155 +f 197//156 199//156 186//156 +f 189//157 188//157 201//157 +f 203//158 197//158 185//158 diff --git a/assets/models/figure/kite.obj.import b/assets/models/figure/kite.obj.import new file mode 100644 index 0000000..d7f77d6 --- /dev/null +++ b/assets/models/figure/kite.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://ddrrhp6xjlkvb" +path="res://.godot/imported/kite.obj-9b80ade09727451812fbac327c5e21e3.mesh" + +[deps] + +files=["res://.godot/imported/kite.obj-9b80ade09727451812fbac327c5e21e3.mesh"] + +source_file="res://assets/models/figure/kite.obj" +dest_files=["res://.godot/imported/kite.obj-9b80ade09727451812fbac327c5e21e3.mesh", "res://.godot/imported/kite.obj-9b80ade09727451812fbac327c5e21e3.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/assets/models/figure/sail.obj b/assets/models/figure/sail.obj deleted file mode 100644 index cc4f830..0000000 --- a/assets/models/figure/sail.obj +++ /dev/null @@ -1,403 +0,0 @@ -# Blender 4.3.2 -# www.blender.org -mtllib sail.mtl -o Cube.016 -v -1.381481 0.666489 0.399653 -v -1.379823 0.678313 0.400861 -v -1.196113 0.725052 -0.427819 -v -1.194456 0.736876 -0.426611 -v -0.125544 0.463124 0.666611 -v -0.123887 0.474948 0.667819 -v 0.059823 0.521687 -0.160861 -v 0.061481 0.533511 -0.159653 -vn -0.9661 0.1564 -0.2054 -vn 0.2181 0.0689 -0.9735 -vn 0.9661 -0.1564 0.2054 -vn -0.2181 -0.0689 0.9735 -vn -0.1381 -0.9853 -0.1007 -vn 0.1381 0.9853 0.1007 -s 0 -usemtl CANVAS -f 2//1 3//1 1//1 -f 4//2 7//2 3//2 -f 8//3 5//3 7//3 -f 6//4 1//4 5//4 -f 7//5 1//5 3//5 -f 4//6 6//6 8//6 -f 2//1 4//1 3//1 -f 4//2 8//2 7//2 -f 8//3 6//3 5//3 -f 6//4 2//4 1//4 -f 7//5 5//5 1//5 -f 4//6 2//6 6//6 -o Cube.017 -v -1.213853 0.686845 0.034393 -v -1.211643 0.702609 0.036004 -v -1.187683 0.695112 -0.082426 -v -1.185473 0.710877 -0.080816 -v -0.054527 0.499123 0.280816 -v -0.052317 0.514888 0.282426 -v -0.028357 0.507391 0.163996 -v -0.026147 0.523156 0.165607 -vn -0.9661 0.1564 -0.2054 -vn 0.2181 0.0689 -0.9735 -vn 0.9661 -0.1564 0.2054 -vn -0.2181 -0.0689 0.9735 -vn -0.1381 -0.9853 -0.1007 -vn 0.1381 0.9853 0.1007 -s 0 -usemtl OCHRE_RED -f 10//7 11//7 9//7 -f 12//8 15//8 11//8 -f 16//9 13//9 15//9 -f 14//10 9//10 13//10 -f 15//11 9//11 11//11 -f 12//12 14//12 16//12 -f 10//7 12//7 11//7 -f 12//8 16//8 15//8 -f 16//9 14//9 13//9 -f 14//10 10//10 9//10 -f 15//11 13//11 9//11 -f 12//12 10//12 14//12 -o Cylinder.010 -v -1.312793 0.746375 0.370798 -v 0.001110 0.533625 0.650076 -v -1.317523 0.729268 0.380016 -v -0.003620 0.516517 0.659295 -v -1.321681 0.729268 0.399579 -v -0.007778 0.516517 0.678858 -v -1.321110 0.746375 0.409924 -v -0.007207 0.533625 0.689202 -v -1.316380 0.763483 0.400706 -v -0.002477 0.550732 0.679984 -v -1.312222 0.763483 0.381143 -v 0.001681 0.550732 0.660421 -vn 0.1035 -0.4938 -0.8634 -vn -0.1530 -0.9877 -0.0325 -vn -0.2566 -0.4938 0.8308 -vn -0.1035 0.4938 0.8634 -vn 0.9661 -0.1564 0.2054 -vn 0.1530 0.9877 0.0325 -vn 0.2566 0.4938 -0.8308 -vn -0.9661 0.1564 -0.2054 -s 0 -usemtl PLANK -f 18//13 19//13 17//13 -f 20//14 21//14 19//14 -f 22//15 23//15 21//15 -f 24//16 25//16 23//16 -f 18//17 26//17 22//17 -f 26//18 27//18 25//18 -f 28//19 17//19 27//19 -f 19//20 23//20 27//20 -f 18//13 20//13 19//13 -f 20//14 22//14 21//14 -f 22//15 24//15 23//15 -f 24//16 26//16 25//16 -f 22//17 20//17 18//17 -f 18//17 28//17 26//17 -f 26//17 24//17 22//17 -f 26//18 28//18 27//18 -f 28//19 18//19 17//19 -f 27//20 17//20 19//20 -f 19//20 21//20 23//20 -f 23//20 25//20 27//20 -o Cylinder.011 -v -0.145000 0.051532 0.073000 -v -0.455000 0.588468 0.073000 -v -0.138938 0.055032 0.080000 -v -0.448938 0.591968 0.080000 -v -0.145000 0.051532 0.087000 -v -0.455000 0.588468 0.087000 -v -0.151062 0.048032 0.080000 -v -0.461062 0.584968 0.080000 -vn 0.6124 0.3536 -0.7071 -vn 0.6124 0.3536 0.7071 -vn -0.5000 0.8660 -0.0000 -vn -0.6124 -0.3536 0.7071 -vn -0.6124 -0.3536 -0.7071 -vn 0.5000 -0.8660 -0.0000 -s 0 -usemtl TAR -f 30//21 31//21 29//21 -f 32//22 33//22 31//22 -f 30//23 34//23 32//23 -f 34//24 35//24 33//24 -f 36//25 29//25 35//25 -f 31//26 35//26 29//26 -f 30//21 32//21 31//21 -f 32//22 34//22 33//22 -f 30//23 36//23 34//23 -f 34//24 36//24 35//24 -f 36//25 30//25 29//25 -f 31//26 33//26 35//26 -o Cube.018 -v 0.125544 0.463124 0.666611 -v 0.123887 0.474948 0.667819 -v -0.059823 0.521687 -0.160861 -v -0.061481 0.533511 -0.159653 -v 1.381481 0.666489 0.399653 -v 1.379823 0.678313 0.400861 -v 1.196113 0.725052 -0.427819 -v 1.194456 0.736876 -0.426611 -vn -0.9661 -0.1564 0.2054 -vn -0.2181 0.0689 -0.9735 -vn 0.9661 0.1564 -0.2054 -vn 0.2181 -0.0689 0.9735 -vn 0.1381 -0.9853 -0.1007 -vn -0.1381 0.9853 0.1007 -s 0 -usemtl CANVAS -f 38//27 39//27 37//27 -f 40//28 43//28 39//28 -f 44//29 41//29 43//29 -f 42//30 37//30 41//30 -f 43//31 37//31 39//31 -f 40//32 42//32 44//32 -f 38//27 40//27 39//27 -f 40//28 44//28 43//28 -f 44//29 42//29 41//29 -f 42//30 38//30 37//30 -f 43//31 41//31 37//31 -f 40//32 38//32 42//32 -o Cube.019 -v 0.054527 0.499123 0.280816 -v 0.052317 0.514888 0.282426 -v 0.028357 0.507391 0.163996 -v 0.026147 0.523156 0.165607 -v 1.213853 0.686845 0.034393 -v 1.211643 0.702609 0.036004 -v 1.187683 0.695112 -0.082426 -v 1.185473 0.710877 -0.080816 -vn -0.9661 -0.1564 0.2054 -vn -0.2181 0.0689 -0.9735 -vn 0.9661 0.1564 -0.2054 -vn 0.2181 -0.0689 0.9735 -vn 0.1381 -0.9853 -0.1007 -vn -0.1381 0.9853 0.1007 -s 0 -usemtl OCHRE_RED -f 46//33 47//33 45//33 -f 48//34 51//34 47//34 -f 52//35 49//35 51//35 -f 50//36 45//36 49//36 -f 51//37 45//37 47//37 -f 48//38 50//38 52//38 -f 46//33 48//33 47//33 -f 48//34 52//34 51//34 -f 52//35 50//35 49//35 -f 50//36 46//36 45//36 -f 51//37 49//37 45//37 -f 48//38 46//38 50//38 -o Cylinder.012 -v -0.001110 0.533624 0.650076 -v 1.312793 0.746375 0.370798 -v 0.003620 0.516517 0.659295 -v 1.317523 0.729268 0.380016 -v 0.007778 0.516517 0.678858 -v 1.321681 0.729268 0.399579 -v 0.007207 0.533624 0.689202 -v 1.321110 0.746375 0.409924 -v 0.002477 0.550732 0.679984 -v 1.316380 0.763483 0.400706 -v -0.001681 0.550732 0.660421 -v 1.312222 0.763483 0.381143 -vn -0.1035 -0.4938 -0.8634 -vn 0.1530 -0.9877 -0.0325 -vn 0.2566 -0.4938 0.8308 -vn 0.1035 0.4938 0.8634 -vn 0.9661 0.1564 -0.2054 -vn -0.1530 0.9877 0.0325 -vn -0.2566 0.4938 -0.8308 -vn -0.9661 -0.1564 0.2054 -s 0 -usemtl PLANK -f 54//39 55//39 53//39 -f 56//40 57//40 55//40 -f 58//41 59//41 57//41 -f 60//42 61//42 59//42 -f 54//43 62//43 58//43 -f 62//44 63//44 61//44 -f 64//45 53//45 63//45 -f 55//46 59//46 63//46 -f 54//39 56//39 55//39 -f 56//40 58//40 57//40 -f 58//41 60//41 59//41 -f 60//42 62//42 61//42 -f 58//43 56//43 54//43 -f 54//43 64//43 62//43 -f 62//43 60//43 58//43 -f 62//44 64//44 63//44 -f 64//45 54//45 53//45 -f 63//46 53//46 55//46 -f 55//46 57//46 59//46 -f 59//46 61//46 63//46 -o Cylinder.013 -v 0.145000 0.051532 0.073000 -v 0.455000 0.588468 0.073000 -v 0.151062 0.048032 0.080000 -v 0.461062 0.584968 0.080000 -v 0.145000 0.051532 0.087000 -v 0.455000 0.588468 0.087000 -v 0.138938 0.055032 0.080000 -v 0.448938 0.591968 0.080000 -vn 0.6124 -0.3536 -0.7071 -vn 0.6124 -0.3536 0.7071 -vn 0.5000 0.8660 -0.0000 -vn -0.6124 0.3536 0.7071 -vn -0.6124 0.3536 -0.7071 -vn -0.5000 -0.8660 -0.0000 -s 0 -usemtl TAR -f 66//47 67//47 65//47 -f 68//48 69//48 67//48 -f 66//49 70//49 68//49 -f 70//50 71//50 69//50 -f 72//51 65//51 71//51 -f 67//52 71//52 65//52 -f 66//47 68//47 67//47 -f 68//48 70//48 69//48 -f 66//49 72//49 70//49 -f 70//50 72//50 71//50 -f 72//51 66//51 65//51 -f 67//52 69//52 71//52 -o Cylinder.014 -v 0.000000 0.644000 -0.375000 -v 0.000000 0.644000 0.575000 -v 0.020785 0.632000 -0.375000 -v 0.020785 0.632000 0.575000 -v 0.020785 0.608000 -0.375000 -v 0.020785 0.608000 0.575000 -v 0.000000 0.596000 -0.375000 -v 0.000000 0.596000 0.575000 -v -0.020785 0.608000 -0.375000 -v -0.020785 0.608000 0.575000 -v -0.020785 0.632000 -0.375000 -v -0.020785 0.632000 0.575000 -vn 0.5000 0.8660 -0.0000 -vn 1.0000 -0.0000 -0.0000 -vn 0.5000 -0.8660 -0.0000 -vn -0.5000 -0.8660 -0.0000 -vn -0.0000 -0.0000 1.0000 -vn -1.0000 -0.0000 -0.0000 -vn -0.5000 0.8660 -0.0000 -vn -0.0000 -0.0000 -1.0000 -s 0 -usemtl PLANK -f 74//53 75//53 73//53 -f 76//54 77//54 75//54 -f 78//55 79//55 77//55 -f 80//56 81//56 79//56 -f 74//57 82//57 78//57 -f 82//58 83//58 81//58 -f 84//59 73//59 83//59 -f 75//60 79//60 83//60 -f 74//53 76//53 75//53 -f 76//54 78//54 77//54 -f 78//55 80//55 79//55 -f 80//56 82//56 81//56 -f 78//57 76//57 74//57 -f 74//57 84//57 82//57 -f 82//57 80//57 78//57 -f 82//58 84//58 83//58 -f 84//59 74//59 73//59 -f 83//60 73//60 75//60 -f 75//60 77//60 79//60 -f 79//60 81//60 83//60 -o Cube.020 -v -0.172000 0.015000 0.017000 -v -0.172000 0.023000 0.025000 -v -0.180000 0.023000 0.017000 -v -0.172000 0.057000 0.025000 -v -0.172000 0.065000 0.017000 -v -0.180000 0.057000 0.017000 -v -0.172000 0.015000 -0.017000 -v -0.180000 0.023000 -0.017000 -v -0.172000 0.023000 -0.025000 -v -0.172000 0.065000 -0.017000 -v -0.172000 0.057000 -0.025000 -v -0.180000 0.057000 -0.017000 -v 0.172000 0.015000 0.017000 -v 0.180000 0.023000 0.017000 -v 0.172000 0.023000 0.025000 -v 0.172000 0.065000 0.017000 -v 0.172000 0.057000 0.025000 -v 0.180000 0.057000 0.017000 -v 0.172000 0.015000 -0.017000 -v 0.172000 0.023000 -0.025000 -v 0.180000 0.023000 -0.017000 -v 0.172000 0.065000 -0.017000 -v 0.180000 0.057000 -0.017000 -v 0.172000 0.057000 -0.025000 -vn -0.0000 -0.0000 1.0000 -vn 1.0000 -0.0000 -0.0000 -vn -0.0000 1.0000 -0.0000 -vn -1.0000 -0.0000 -0.0000 -vn -0.0000 -0.0000 -1.0000 -vn -0.5773 -0.5774 0.5774 -vn -0.5773 0.5774 0.5774 -vn -0.5773 -0.5774 -0.5774 -vn -0.5773 0.5774 -0.5774 -vn 0.5773 -0.5774 0.5774 -vn 0.5773 0.5774 0.5774 -vn 0.5773 -0.5774 -0.5774 -vn 0.5773 0.5774 -0.5774 -vn -0.7071 -0.7071 -0.0000 -vn -0.7071 -0.0000 0.7071 -vn -0.7071 0.7071 -0.0000 -vn -0.7071 -0.0000 -0.7071 -vn -0.0000 -0.7071 -0.7071 -vn -0.0000 0.7071 -0.7071 -vn 0.7071 -0.0000 -0.7071 -vn 0.7071 -0.7071 -0.0000 -vn 0.7071 0.7071 -0.0000 -vn 0.7071 -0.0000 0.7071 -vn -0.0000 -0.7071 0.7071 -vn -0.0000 0.7071 0.7071 -vn -0.0000 -1.0000 -0.0000 -s 0 -usemtl PLANK -f 101//61 86//61 99//61 -f 107//62 98//62 105//62 -f 94//63 100//63 106//63 -f 90//64 92//64 87//64 -f 95//65 104//65 93//65 -f 85//66 86//66 87//66 -f 88//67 89//67 90//67 -f 91//68 92//68 93//68 -f 94//69 95//69 96//69 -f 97//70 98//70 99//70 -f 100//71 101//71 102//71 -f 103//72 104//72 105//72 -f 106//73 107//73 108//73 -f 85//74 92//74 91//74 -f 88//75 87//75 86//75 -f 94//76 90//76 89//76 -f 93//77 96//77 95//77 -f 91//78 104//78 103//78 -f 106//79 95//79 94//79 -f 105//80 108//80 107//80 -f 103//81 98//81 97//81 -f 100//82 107//82 106//82 -f 99//83 102//83 101//83 -f 97//84 86//84 85//84 -f 89//85 101//85 100//85 -f 103//86 85//86 91//86 -f 101//61 88//61 86//61 -f 107//62 102//62 98//62 -f 94//63 89//63 100//63 -f 90//64 96//64 92//64 -f 95//65 108//65 104//65 -f 85//74 87//74 92//74 -f 88//75 90//75 87//75 -f 94//76 96//76 90//76 -f 93//77 92//77 96//77 -f 91//78 93//78 104//78 -f 106//79 108//79 95//79 -f 105//80 104//80 108//80 -f 103//81 105//81 98//81 -f 100//82 102//82 107//82 -f 99//83 98//83 102//83 -f 97//84 99//84 86//84 -f 89//85 88//85 101//85 -f 103//86 97//86 85//86 diff --git a/assets/models/figure/sail.obj.import b/assets/models/figure/sail.obj.import deleted file mode 100644 index e53efe4..0000000 --- a/assets/models/figure/sail.obj.import +++ /dev/null @@ -1,25 +0,0 @@ -[remap] - -importer="wavefront_obj" -importer_version=1 -type="Mesh" -uid="uid://cmwcbx8b5c2wy" -path="res://.godot/imported/sail.obj-9ec564119fbf133a360d00ce1c1821f4.mesh" - -[deps] - -files=["res://.godot/imported/sail.obj-9ec564119fbf133a360d00ce1c1821f4.mesh"] - -source_file="res://assets/models/figure/sail.obj" -dest_files=["res://.godot/imported/sail.obj-9ec564119fbf133a360d00ce1c1821f4.mesh", "res://.godot/imported/sail.obj-9ec564119fbf133a360d00ce1c1821f4.mesh"] - -[params] - -generate_tangents=true -generate_lods=true -generate_shadow_mesh=true -generate_lightmap_uv2=false -generate_lightmap_uv2_texel_size=0.2 -scale_mesh=Vector3(1, 1, 1) -offset_mesh=Vector3(0, 0, 0) -force_disable_mesh_compression=false diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 83c18c9..63921af 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -172,7 +172,7 @@ sources tracked per second). A source is an IPv4 address, or an IPv6 address's w **Lobby, backfill and late arrivals.** People who connect during the lobby or the countdown take places (`Match.join()`); bots are only added when the match starts, into whatever places are still empty, so people joining and leaving in the lobby -never displace or strand a bot. Someone who connects after the barge leaves, or +never displace or strand a bot. Someone who connects after the ship sails, or during results, becomes a watcher (`Match.watch()`): they spectate a living player (the winner during results) through the same snapshots an eliminated player gets, and take a place ahead of any bots when the next lobby opens. The server still turns @@ -360,7 +360,7 @@ trips, 41 of 41 shots hit; with the lag ignored, 0 of 41. At 500 ms, past the ca `ClientGame` (`src/net/`) is a client's side of a match. It works on packets, so it runs the same over a `NetClient` or a test's simulated link. From the seed in the MATCH notice it generates the island itself (a `Simulation` it never steps) and plans -the same barge route, so it can run the server's movement code on the server's ground. +the same ship route, so it can run the server's movement code on the server's ground. **The command clock.** A command must reach the server before the tick it names, so the client's tick runs ahead of the server's by the trip there plus a margin. Nobody @@ -482,7 +482,7 @@ weights from the island's elevation bands, with rock on steep ground. `MatchView` (`src/client/`) is the client's picture of one match: sky, sun, terrain, sea, points of interest, props, built pieces and `EntityView`, which draws players, the -barge, items and chests. All of it reads one `Simulation` and never writes to it, and a +ship, items and chests. All of it reads one `Simulation` and never writes to it, and a new match gets a new view. The camera sits on a player's shoulder through `CameraRig`. `EffectsView` (`src/client/effects/`, A7) draws the match's visual effects from the server's FX records and from changes it sees in the world (pieces gone, players in the @@ -490,7 +490,7 @@ water, surges). Its particles are simulated on the CPU in packed arrays and draw two MultiMeshes (blended and added) of camera-facing quads, sized per instance by a small shader, with tracers as a third; everything is allocated once at the preset's budget, so a big fight costs a fixed three draw calls and never adds nodes or grows buffers. -The figure (`FigureRig`), items (`ItemModels`) and barge and chests (`VesselModels`) are +The figure (`FigureRig`), items (`ItemModels`) and ship and chests (`VesselModels`) are the generated art described in assets/PROVENANCE.md; `test_world_art` fails on any primitive stand-in mesh. @@ -499,7 +499,7 @@ In play, the simulation it reads is the client's own copy of the world: the `ClientWorld` keeps its pieces, props, chests and tide in line with the server, and `ClientMirror` (`src/net/`) writes the rest of the picture into it every frame: each entity the server has told this client about, where it is being drawn now (everyone -else from the recent past, the client's own player where it was predicted), the barge, +else from the recent past, the client's own player where it was predicted), the ship, the clock and the sea level. So the same views draw a networked match, a local server's simulation in a test, or a replay in a capture, and there is one set of drawing code. Captures and tests still point a `MatchView` straight at a server's @@ -559,7 +559,7 @@ budget: The max includes one long tick per match: unthrottled, the 15 s results screen passes in a fraction of a second, so the main thread waits for the worker still building the next island. At the real 30 Hz the worker finishes long before the lobby opens. -- **Client:** the match `make match` saved, rendered at the whole island, the barge (24 +- **Client:** the match `make match` saved, rendered at the whole island, the ship (24 figures together, the worst case for draw calls), landed, a build and the final players, and a crowded pine forest. Each capture reports its frame's draw calls, primitives, objects, nodes and memory (`tools/capture.gd`'s `render` field). @@ -631,7 +631,7 @@ model and tier. The hotbar shows the icons. ## Player figure (A2) `tools/models/figure.py` builds the islander in headless Blender as twelve rigid -parts (pelvis, torso, head, upper arms, forearms, thighs, shins and the wing-sail), +parts (pelvis, torso, head, upper arms, forearms, thighs, shins and the gull-kite), each an OBJ whose origin is the joint it turns about, plus `figure.json` with the joints and hand points (`make art` rebuilds these and the items). OBJ has no skeleton, so the figure is jointed rather than skinned. diff --git a/docs/ASSET_PROVENANCE.md b/docs/ASSET_PROVENANCE.md index ea7a2d4..bac88bc 100644 --- a/docs/ASSET_PROVENANCE.md +++ b/docs/ASSET_PROVENANCE.md @@ -6,7 +6,7 @@ is sampled, recorded, downloaded or taken from a third party. How each kind of a made is described in [assets/PROVENANCE.md](../assets/PROVENANCE.md); the licence is CC BY-SA 4.0 ([LICENSE-ASSETS](../LICENSE-ASSETS)). -Code-built art (terrain, sea, points of interest, props, build pieces, the barge, sea +Code-built art (terrain, sea, points of interest, props, build pieces, the ship, sea chests and effects) isn't a file here: it's drawn by the scripts under `src/client/`. This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and @@ -104,10 +104,10 @@ This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and | `assets/models/figure/forearm_r.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/head.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/head.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | +| `assets/models/figure/kite.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | +| `assets/models/figure/kite.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/pelvis.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/pelvis.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | -| `assets/models/figure/sail.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | -| `assets/models/figure/sail.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/shin_l.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/shin_l.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | | `assets/models/figure/shin_r.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. | diff --git a/docs/GDD.md b/docs/GDD.md index b794035..b391219 100644 --- a/docs/GDD.md +++ b/docs/GDD.md @@ -47,7 +47,7 @@ The server runs matches back to back, in [`src/sim/match.gd`](../src/sim/match.g 1. **Lobby.** Players join. Once `MATCH_MIN_PLAYERS` are in, it waits `MATCH_LOBBY_SECONDS` for more, or counts down at once when full. 2. **Countdown.** `MATCH_COUNTDOWN_SECONDS`. If too many leave, it goes back to the lobby. -3. **Drop.** Bots fill the empty places, everyone boards the barge and loot is placed. +3. **Drop.** Bots fill the empty places, everyone boards the packet ship and loot is placed. 4. **Play.** Ends when at most one team has anyone standing. 5. **Results.** Finishing places and the winners stay up for `MATCH_RESULTS_SECONDS`, then bots leave and the server goes back to the lobby with a new island. @@ -144,14 +144,21 @@ seed, so only damage is match state. ### The drop Every match starts with the drop, simulated in [`src/sim/drop.gd`](../src/sim/drop.gd). -A carrier crosses the island at `BARGE_ALTITUDE` on a straight route drawn from the seed. -The route passes within `BARGE_CENTRE_JITTER` of the middle and always crosses at least -`BARGE_MIN_LAND_METRES` of dry land. Players ride it until they press jump, then fall, -steering at `FREEFALL_STEER_SPEED`, up to `FREEFALL_MAX_SPEED`. Jump opens the sail, and -it opens by itself `WING_AUTO_DEPLOY_HEIGHT` above the ground or water. Under the sail -they sink at `GLIDE_FALL_SPEED` and steer at `GLIDE_SPEED`, and touch down without damage. -Anyone still aboard at the end of the route is thrown off. The carrier's name and look, -sky barge or the packet ship and mortar of the core loop above, are open in #72. +A packet ship sails past the island on a straight route drawn from the seed, its deck +`SHIP_DECK_HEIGHT` above the sea. The route runs as close in as it can while keeping +`SHIP_COAST_CLEARANCE` of open water between itself and any land, so it never crosses +the island. Players ride it until they press jump, which fires them inland by lifeline +mortar along the way they face. How high they aim sets the charge: from +`MORTAR_PITCH_LOW_DEGREES` (or lower) to `MORTAR_PITCH_HIGH_DEGREES` (or higher) the shot's +speed over the ground runs from `MORTAR_MIN_SPEED` to `MORTAR_MAX_SPEED`, and every shot +climbs at `MORTAR_RISE_SPEED`. Nothing steers the climb. Over the top of the arc they +fall, steering at `FREEFALL_STEER_SPEED`, up to `FREEFALL_MAX_SPEED`. Jump opens the +gull-kite, and it opens by itself `KITE_AUTO_DEPLOY_HEIGHT` above the ground or water. +Under the kite they sink at `GLIDE_FALL_SPEED` and steer at `GLIDE_SPEED`, and touch down +without damage. A full charge with the kite opened at the top carries about a kilometre, +further than any land lies from any route (`test_drop` checks 60 seeds). Anyone still +aboard at the end of the route is fired towards the middle of the island. Eric chose +this launch in #72 over the sky barge first built for W7. ## Tide phases @@ -331,7 +338,7 @@ each weapon's headshot multiplier. The balance targets are checked by `make balance` over at least `BALANCE_MIN_MATCHES` bot-only matches of `SOLO_PLAYERS` players (H3): -- the median match, from the barge leaving to the last player standing, lasts between +- the median match, from the ship sailing to the last player standing, lasts between `BALANCE_MEDIAN_MINUTES_MIN` and `BALANCE_MEDIAN_MINUTES_MAX` minutes; - no one weapon takes more than `BALANCE_MAX_WEAPON_SHARE` of the eliminations made with weapons, the boathook included. @@ -348,7 +355,7 @@ Keys are matched by position. Defaults for keyboard and mouse: | Action | Default | |---|---| | Move | W A S D | -| Jump; leap from the barge; open the wing-sail | Space | +| Jump; fire the mortar from the ship; open the gull-kite | Space | | Crouch; dive when swimming | Left Ctrl | | Sprint | Left Shift | | Use, fire, harvest or place | Left mouse | diff --git a/docs/PLAY.md b/docs/PLAY.md index fb97811..c23b91f 100644 --- a/docs/PLAY.md +++ b/docs/PLAY.md @@ -1,7 +1,7 @@ # Playing Tidewall on Linux Tidewall is a free and open-source build-and-survive battle royale. Up to 24 players -and bots leap from a sky barge onto a generated island, scavenge, fight and build, +and bots fire themselves from a packet ship onto a generated island, scavenge, fight and build, while the sea rises in phases and swallows the low ground. The last one standing wins. To run a server, see [SERVER.md](SERVER.md). @@ -37,7 +37,7 @@ Replace `1.0.0` with the version you downloaded. The first time, the game offers the tutorial; after that it opens on its main menu. -- **Tutorial** is a few minutes on an island of your own: leave the barge and glide +- **Tutorial** is a few minutes on an island of your own: fire yourself off the ship and glide down, walk and jump, cut materials with the boathook, build a wall, fire the dock carbine you start with, and get above the line the tide will reach. A card under the minimap says what to do with your own keys and moves on when you've done it. Nobody @@ -86,7 +86,7 @@ position, so they sit in the same place on any keyboard layout. | Action | Default | |---|---| | Move | W A S D | -| Jump; on the barge, leap; in the air, open the wing-sail | Space | +| Jump; on the ship, fire the mortar; in the air, open the gull-kite | Space | | Crouch; in water, dive | Left Ctrl | | Sprint | Left Shift | | Use, fire, harvest or place | Left mouse | @@ -112,7 +112,7 @@ South is A on most pads. | Move | Left stick | | Look | Right stick | | Sprint (until you stop) | Click the left stick | -| Jump, leap, open the wing-sail | South (A) | +| Jump, fire the mortar, open the gull-kite | South (A) | | Crouch, dive | East (B) | | Reload | West (X) | | Pick up or open a chest | North (Y) | @@ -158,10 +158,12 @@ Settings → Access: ## How a match goes -1. **The drop.** Everyone rides a sky barge across the island. Press jump to leap, - steer with the move keys while you fall, and press jump again to open the wing-sail. - It opens by itself near the ground. Anyone still aboard at the end of the route is - thrown off. +1. **The drop.** Everyone rides a packet ship that sails past the island, offshore. + Face where you want to land and press jump to fire yourself inland by lifeline + mortar: aim level for the shore, and look higher to carry further, up to the far + side of the island. The climb can't be steered. Over the top of the arc, steer with + the move keys and press jump again to open the gull-kite; it opens by itself near the + ground. Anyone still aboard at the end of the route is fired towards the middle. 2. **Scavenge.** Fishing hamlets, docks, salt works, quarries, lighthouses and hilltop shrines hold weapons, ammunition and supplies, on the floor and in sea chests (E opens one). Washed-up crates on the beaches spill loot when broken. diff --git a/docs/STYLE.md b/docs/STYLE.md index 84d67f1..ce1d0a2 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -179,9 +179,10 @@ collision box, give or take a few centimetres of lap or trim. gone), a third of the strips are split short and darkened. Battered (two thirds gone), a third are knocked out so the dark backing shows, and the rest are split and charred. `make build-captures` renders the test card (`captures/build_states.png`). -- **The barge and sea chests** (`VesselModels`): a lofted tarred hull with an ochre - rubbing strake under a gored canvas envelope, striped tanned and banded ochre; sea - chests painted sea-green with tarred bands, a salt-white border and a gilt hasp. +- **The packet ship and sea chests** (`VesselModels`): a two-masted packet with a lofted + tarred hull, an ochre rubbing strake, a salt-white boot-top at the waterline, tanned + square sails with an ochre band, a bowsprit, and a squat tarred lifeline mortar with + gilt bands on a timber bed; sea chests painted sea-green with tarred bands, a salt-white border and a gilt hasp. - **Terrain** (`terrain.gdshader`): sand with shingle, marsh, grass in tussocks and wind-dried patches, rock with lichen blotches, pale summits. Fine detail fades out past about 150 m so it doesn't shimmer. diff --git a/docs/VISUAL_QA.md b/docs/VISUAL_QA.md index e44099c..e1f9161 100644 --- a/docs/VISUAL_QA.md +++ b/docs/VISUAL_QA.md @@ -31,7 +31,7 @@ found and fixed: |---|---|---|---| | Menus | `menu_main`, `menu_practice`, `menu_join`, `menu_settings`, `menu_settings_mouse`, `menu_pause`, `menu_results` | Paper panels over the sea and tide post; every label readable; the version line; focus outline on the first button; nothing clipped. | Pass | | Lobby | `match_lobby` | The whole island from the air, sea round it with no square edge. | Pass after H16 | -| The drop | `match_barge`, `client_barge`, `match_glide`, `client_glide`, `vessels` | The sky barge and its 24 passengers; the wing-sail held overhead; the island below. | Pass | +| The drop | `match_ship`, `client_ship`, `match_glide`, `client_glide`, `vessels` | The packet ship and its 24 passengers offshore; the gull-kite held overhead; the island below. | Pass | | Landing | `match_landed`, `client_landed`, `quality_low`, `quality_medium`, `quality_high` | The player on the shoulder camera, a sea chest, a building's inside. The three presets differ in shadow and detail, not in what's there. | Pass | | Biomes | `props_beach`, `props_forest`, `props_highland`, `props_overview`, `props_crate`, `props_felled`, `terrain`, `terrain_lod`, `sea_shore_calm` | Sand with wet patches and beached boats, pine forest, highland stone and boulders, the marsh flats at low tide. | Pass | | Points of interest | `poi_hamlet`, `poi_dock`, `poi_lighthouse`, `poi_quarry`, `poi_salt_works`, `poi_shrine`, `style_*` | Each reads as its place; the woodcut print pass (outlines, hatching) on, and off in the `_plain` captures. | Pass | @@ -39,7 +39,7 @@ found and fixed: | Players and items | `figure_states`, `figure_actions`, `figure_close`, `items_held`, `items_shoulder`, `items_ground`, `items_tiers`, `items_kegs` | Coats in every colour, every pose, items in hand and on the ground, tier marks. | Pass | | Combat | `effects_fight`, `effects_blast`, `effects_work`, `effects_stress` | Muzzle flash at the muzzle, the hit marker round the reticle, the keg blast and collapse dust, tracers in the stress scene. | Pass | | HUD | `client_hud`, `hud_2160` (`CAPTURE_SIZE=3840x2160`) | Tide plaque, health and armour, the six slots, materials, the feed and count, crisp at 4K. | Pass | -| Chart | `chart_first`, `chart_later` | Place names, the barge's line, the next tide's land hatched, the minimap. | Pass | +| Chart | `chart_first`, `chart_later` | Place names, the ship's line, the next tide's land hatched, the minimap. | Pass | | Each tide phase | `sea_tide_0` … `sea_tide_7`, `water_flood`, `water_shore` | The sea rising phase by phase to nothing left; the storm building to a gale with rain; flooding following the terrain. | Pass | | The gale and under water | `sea_shore_gale`, `sea_underwater`, `match_final` | Rain, dark sea and whitecaps; the murk and the bright ceiling only when the camera is under the sea. | Pass after H15 | | Results | `match_tide`, `match_results` | The drowned island from the lobby's viewpoint; the last players on the highest ground. | Pass after H15 | diff --git a/src/app/client_session.gd b/src/app/client_session.gd index 81c8e71..cf18799 100644 --- a/src/app/client_session.gd +++ b/src/app/client_session.gd @@ -296,7 +296,7 @@ func _show(delta: float) -> void: if view == null: return view.entities.local_id = mirror.own_id if mirror.own_id != 0 else view.entities.local_id - view.entities.barge_at = mirror.barge_at + view.entities.ship_at = mirror.ship_at view.rig.update_aim(input.aiming() and mirror.own_id != 0, delta) view.sync() var fresh: int = mini(game.fx_received - _fx_seen, game.fx.size()) diff --git a/src/app/tutorial.gd b/src/app/tutorial.gd index f654a54..3294921 100644 --- a/src/app/tutorial.gd +++ b/src/app/tutorial.gd @@ -3,7 +3,7 @@ ## the FX the server sends) and moves on when each step is done, so it judges what the ## player actually did, through the same door as any match. ## -## The steps: leave the barge, glide down, walk and jump, cut materials with the +## The steps: fire yourself off the ship, glide down, walk and jump, cut materials with the ## boathook, place a wall, aim and fire the carbine you start with, and get above the ## line the tide will reach. Every instruction names the player's own key bindings. ## @@ -22,7 +22,7 @@ const TIDE: int = 6 const DONE: int = 7 const STEP_NAMES: Array[String] = ["leap", "glide", "move", "harvest", "build", "fire", "tide", "done"] const TITLES: Array[String] = [ - "Leave the barge", "Glide down", "Find your feet", "Gather materials", + "Leave the ship", "Glide down", "Find your feet", "Gather materials", "Build a wall", "Aim and fire", "Beat the tide", "Ready to set out", ] @@ -132,9 +132,9 @@ static func tide_line(tide: Tide, tick: int) -> float: func instruction() -> String: match step: LEAP: - return "You're aboard the barge, high over the island. When it's over land, press %s to leap." % _key("jump") + return "You're aboard the packet ship, off the coast. Face the island and look up to charge the lifeline mortar: the higher you aim, the farther it throws you. Press %s to fire." % _key("jump") GLIDE: - return "Steer with %s as you fall. Press %s to open your sail, or it opens by itself near the ground. Aim for open ground." % [ + return "Steer with %s as you fall. Once you're over the top of the arc, press %s to open your gull-kite, or it opens by itself near the ground. Aim for open ground." % [ _moves(), _key("jump")] MOVE: return "Walk with %s and look with the %s. %s to sprint, press %s to jump." % [ diff --git a/src/app/tutorial_pilot.gd b/src/app/tutorial_pilot.gd index 40b0525..32b6d58 100644 --- a/src/app/tutorial_pilot.gd +++ b/src/app/tutorial_pilot.gd @@ -53,7 +53,11 @@ func command(tick: int, game: ClientGame) -> PlayerCommand: match tutorial.step: Tutorial.LEAP: _face_centre(me) - if tick > 3 * TICKS and world.ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 4.0: + if tick > 3 * TICKS: + # Fire the mortar most of the way to the middle of the island. + var centre: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5 + var gap: float = centre.distance_to(Vector2(me.position.x, me.position.z)) + input.pitch = Drop.pitch_for_charge(Drop.aim_charge(gap * 0.7)) input.buttons = PlayerCommand.BUTTON_JUMP Tutorial.GLIDE: _face_centre(me) diff --git a/src/bots/bot_brain.gd b/src/bots/bot_brain.gd index fed3765..77b8337 100644 --- a/src/bots/bot_brain.gd +++ b/src/bots/bot_brain.gd @@ -463,7 +463,8 @@ func _stop() -> void: # The drop -## Rides the barge to within reach of a loot marker near its route, then glides to it. +## Rides the ship until it is abeam of a loot marker within the mortar's reach, fires +## itself at it and glides there. func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand: state = "drop" var rider: SimEntity = sim.entities.find(player_id) @@ -481,7 +482,7 @@ func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand: for index: int in world.markers.size(): var at: Vector2 = Vector2(world.markers[index].x, world.markers[index].z) var closest: Vector2 = Geometry2D.get_closest_point_to_segment(at, a, b) - if at.distance_to(closest) <= 120.0 and world.markers[index].y > sim.sea_level + 1.0: + if at.distance_to(closest) <= Tuning.BOT_LANDING_REACH_METRES and world.markers[index].y > sim.sea_level + 1.0: near.append(index) if near.is_empty(): _landing = rng.randi_range(0, world.markers.size() - 1) diff --git a/src/bots/nav_bot.gd b/src/bots/nav_bot.gd index a9c7d00..21eec3b 100644 --- a/src/bots/nav_bot.gd +++ b/src/bots/nav_bot.gd @@ -36,7 +36,7 @@ var _stuck_ticks: int = 0 var _stuck_tries: int = 0 var _jump_next: bool = false var _leap_tick: int = -1 -## How far the goal was from the barge last tick, while riding. +## How far the goal was from the ship last tick, while riding. var _ride_gap: float = INF var _rng: RandomNumberGenerator = null var _rng_seed: int = 0 @@ -87,8 +87,8 @@ func think(sim: Simulation, grid: NavGrid) -> PlayerCommand: if player.drop_state == Drop.ABOARD: return _ride(sim, player) if player.drop_state != Drop.NONE: - # Gliding down: head for the goal. - return _steer(sim, player, goal, 0) + # Coming down: head for the goal. + return _descend(sim, player) if status != MOVING: return PlayerCommand.from_input(sim.tick, Vector2.ZERO, deg_to_rad(player.yaw * 360.0 / PlayerCommand.YAW_STEPS), 0.0) if not _needs_plan and (sim.tick + player_id) % Tuning.BOT_PATH_CHECK_TICKS == 0: @@ -175,21 +175,45 @@ func _steer(sim: Simulation, player: SimEntity, target: Vector3, buttons: int) - return PlayerCommand.from_input(sim.tick, Vector2(0.0, 1.0), atan2(to.x, to.y), 0.0, buttons) -## Aboard the barge: leap once the goal is within gliding reach, or once the barge -## starts drawing away from it; with no goal, at a time set by the player ID. The end of the route puts everyone off anyway. +## Aboard the ship: with a goal, fire the mortar at it with the charge that reaches it, +## once the ship has come abeam of it and starts drawing away, or sooner if it is in +## easy reach at a time set by the player ID; with no goal, at that time, towards the +## middle of the island. The end of the route +## fires everyone still aboard anyway. func _ride(sim: Simulation, player: SimEntity) -> PlayerCommand: if _leap_tick < 0 and sim.drop != null: _leap_tick = sim.drop.began_tick + Tuning.TICK_RATE_HZ * 2 + (player_id * 53) % (Tuning.TICK_RATE_HZ * 20) var leap: bool = sim.tick >= _leap_tick + var target: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5 + var reach: float = 0.7 if status == MOVING: - # With somewhere to land, wait until it's in gliding reach, or until the barge - # has passed it and is drawing away (H3: bots used to leap on the timer and land - # hundreds of metres short). - var gap: float = Vector2(goal.x - player.position.x, goal.z - player.position.z).length() - leap = gap < 0.6 * (player.position.y - goal.y) or gap > _ride_gap + 0.01 + target = Vector2(goal.x, goal.z) + reach = 1.0 + var gap: float = target.distance_to(Vector2(player.position.x, player.position.z)) + # Abeam of the goal; or in easy reach of it once this bot's own moment has come, + # so riders don't all fire together; or about to be fired off at the end of the + # route anyway, which aims at the middle of the island instead of the goal. + leap = gap > _ride_gap + 0.01 or (sim.drop != null and sim.drop.is_over(sim.tick + 2)) \ + or (leap and gap <= Tuning.BOT_LANDING_REACH_METRES) _ride_gap = gap + var to: Vector2 = target - Vector2(player.position.x, player.position.z) var buttons: int = PlayerCommand.BUTTON_JUMP if leap else 0 - return PlayerCommand.from_input(sim.tick, Vector2.ZERO, 0.0, 0.0, buttons) + var pitch: float = Drop.pitch_for_charge(Drop.aim_charge(to.length() * reach)) if leap else 0.0 + return PlayerCommand.from_input(sim.tick, Vector2.ZERO, atan2(to.x, to.y), pitch, buttons) + + +## Coming down: steer for the goal, and once over the top of the mortar's arc, open the +## kite if the goal is further off than the rest of a fall would carry (a fall covers +## well under the kite's glide of about two metres across for each one down). +func _descend(sim: Simulation, player: SimEntity) -> PlayerCommand: + var buttons: int = 0 + if player.drop_state == Drop.FREEFALL and player.velocity.y <= 0.0: + var gap: float = Vector2(goal.x - player.position.x, goal.z - player.position.z).length() + var carry: float = Vector2(player.velocity.x, player.velocity.z).length() + var coast: float = maxf(carry * carry - Tuning.GLIDE_SPEED * Tuning.GLIDE_SPEED, 0.0) / (2.0 * Tuning.DROP_STEER_ACCEL) + if gap - coast > (player.position.y - goal.y) * 1.6: + buttons = PlayerCommand.BUTTON_JUMP + return _steer(sim, player, goal, buttons) ## A random open dry point within ROAM_RANGE that a path reaches, from the bot's own diff --git a/src/bots/soak_player.gd b/src/bots/soak_player.gd index e0eae35..d22e4d3 100644 --- a/src/bots/soak_player.gd +++ b/src/bots/soak_player.gd @@ -1,5 +1,5 @@ ## The script a soak-test client plays by. It only sees what a network client sees: its -## own predicted player and its copy of the island. It leaps from the barge over land, +## own predicted player and its copy of the island. It fires itself off the ship at the summit, ## glides, heads for the island's highest ground (where the tide leaves people last), ## swings the boathook at whatever is in front of it, which harvests trees and crates, ## and every few seconds tries to put up a wall. So a soak match has movement, world @@ -40,9 +40,10 @@ func command(tick: int, me: SimEntity, world: Simulation) -> PlayerCommand: var to_top: Vector2 = _top - Vector2(me.position.x, me.position.z) var yaw: float = atan2(to_top.x, to_top.y) if me.drop_state == Drop.ABOARD: + # Fire the mortar at the summit after a wait of a few seconds. var wait: int = (3 + number % 8) * TICKS - var over_land: bool = world.ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 2.0 - return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, 0.0, PlayerCommand.BUTTON_JUMP if tick > wait and over_land else 0) + var pitch: float = Drop.pitch_for_charge(Drop.aim_charge(to_top.length())) + return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, pitch, PlayerCommand.BUTTON_JUMP if tick > wait else 0) if me.drop_state != Drop.NONE: return PlayerCommand.from_input(tick, Vector2(0.0, 1.0), yaw, 0.0) var phase: int = (tick + number * 11) % (6 * TICKS) diff --git a/src/client/client_input.gd b/src/client/client_input.gd index b9891d4..adb88cd 100644 --- a/src/client/client_input.gd +++ b/src/client/client_input.gd @@ -9,8 +9,8 @@ ## A gamepad works alongside them, in PadInput's fixed layout (A13), with AimAssist ## on its right stick when the setting is on. ## -## With `autoplay` on, a simple script plays instead: it leaps from the barge over -## land, glides, and walks about. That is for tests and for checking a connection with +## With `autoplay` on, a simple script plays instead: it fires itself off the ship +## towards the middle of the island, glides, and walks about. That is for tests and for checking a connection with ## nobody at the keyboard. class_name ClientInput extends RefCounted @@ -172,8 +172,11 @@ func autoplay_command(tick: int, me: SimEntity, ground: SimGround) -> PlayerComm move = Vector2.ZERO buttons = 0 if me.drop_state == Drop.ABOARD: - # Over dry land, with a moment to look about first. - if tick > 3 * Tuning.TICK_RATE_HZ and ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 2.0: + # With a moment to look about first, fire the mortar most of the way to the + # middle of the island. + if tick > 3 * Tuning.TICK_RATE_HZ: + var gap: float = Vector2(centre - me.position.x, centre - me.position.z).length() + pitch = Drop.pitch_for_charge(Drop.aim_charge(gap * 0.7)) buttons = PlayerCommand.BUTTON_JUMP elif me.drop_state != Drop.NONE: move = Vector2(0.0, 1.0) diff --git a/src/client/entities/entity_view.gd b/src/client/entities/entity_view.gd index 27979e1..2eed646 100644 --- a/src/client/entities/entity_view.gd +++ b/src/client/entities/entity_view.gd @@ -1,4 +1,4 @@ -## Draws what moves in a match: players with what they hold, the sky barge while it +## Draws what moves in a match: players with what they hold, the packet ship while it ## crosses, items lying in the world, thrown kegs and sea chests. `sync()` matches everything to the ## simulation as it is now, and `animate()` steps the players' figures. ## @@ -6,8 +6,9 @@ ## simulation replicates about them, with shots, swings and building played from FX ## records through hear(). Held and lying items are the models of A4 (ItemModels): a ## held one sits with its grip in the figure's right hand and points where its player -## looks. The barge and the sea chests are VesselModels, generated in code. Nothing -## here is ever used for collision. +## looks. The ship and the sea chests are VesselModels, generated in code. The ship's +## lifeline mortar faces the island, and a player it has just fired trails a line from +## its muzzle until the arc tops out. Nothing here is ever used for collision. class_name EntityView extends Node3D @@ -21,7 +22,7 @@ const SKIN: Color = Palette.SKIN ## shows darker, its paint dulled. const CHEST_SHUT: Color = Color.WHITE const CHEST_OPEN: Color = Palette.OPENED_DULL -## How far apart passengers stand on the barge's deck, in metres. The simulation +## How far apart passengers stand on the ship's deck, in metres. The simulation ## carries them all at one point; this only spreads them out to be seen. const DECK_SPACING: float = 1.3 const DECK_ROWS: int = 4 @@ -30,16 +31,19 @@ const PICKUP_SCALE: float = 1.4 ## The entity drawn in the brightest oilskin, or 0. var local_id: int = 0 -## Where to draw the barge, when its owner knows better than the simulation's tick: a +## Where to draw the ship, when its owner knows better than the simulation's tick: a ## network client, which draws between ticks. Vector3.INF leaves it to the tick. -var barge_at: Vector3 = Vector3.INF +var ship_at: Vector3 = Vector3.INF var _sim: Simulation ## Entity ID -> its FigureRig. var _figures: Dictionary = {} ## Whether _process steps the figures. Captures that pose figures exactly turn it off. var animate_live: bool = true -var _barge: Node3D +var _ship: Node3D +## One line from the mortar to each player still climbing the arc, reused. +var _lifelines: Array[MeshInstance3D] = [] +var _lifeline_mesh: ArrayMesh ## Items lying in the world: one MultiMeshInstance3D per item model and tier. var _pickups: Node3D var _pickup_fields: Dictionary = {} @@ -48,9 +52,9 @@ var _chests: MultiMeshInstance3D func setup(sim: Simulation) -> void: _sim = sim - _barge = _build_barge() - _barge.visible = false - add_child(_barge) + _ship = _build_ship() + _ship.visible = false + add_child(_ship) _pickups = Node3D.new() _pickups.name = "Pickups" add_child(_pickups) @@ -68,8 +72,8 @@ func figure_of(entity_id: int) -> FigureRig: return _figures.get(entity_id) -func barge() -> Node3D: - return _barge +func ship() -> Node3D: + return _ship ## Items drawn lying in the world. @@ -106,10 +110,15 @@ func sync() -> void: if drop != null: var along: Vector3 = drop.finish - drop.start heading = atan2(along.x, along.z) - _barge.visible = crossing + _ship.visible = crossing if crossing: - _barge.position = barge_at if barge_at != Vector3.INF else drop.barge_position(_sim.tick) - _barge.rotation.y = heading + _ship.position = ship_at if ship_at != Vector3.INF else drop.ship_position(_sim.tick) + _ship.rotation.y = heading + # The model's mortar faces its +x: mirror it if the island lies the other way. + var starboard: Vector2 = Vector2(cos(heading), -sin(heading)) + var centre: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5 + _ship.scale.x = 1.0 if (centre - Vector2(drop.start.x, drop.start.z)).dot(starboard) >= 0.0 else -1.0 + var lines: int = 0 var seen: Dictionary = {} var aboard: int = 0 @@ -133,7 +142,12 @@ func sync() -> void: figure.position += offset.rotated(Vector3.UP, heading) figure.rotation.y = heading aboard += 1 + elif crossing and entity.drop_state == Drop.FREEFALL and entity.velocity.y > 0.0 and not entity.eliminated: + _draw_lifeline(lines, _ship.transform * VesselModels.muzzle(), entity.position + Vector3(0.0, 1.0, 0.0)) + lines += 1 _hold(figure, entity) + for index: int in range(lines, _lifelines.size()): + _lifelines[index].visible = false for entity_id: int in _figures.keys(): if not seen.has(entity_id): _figures[entity_id].queue_free() @@ -176,7 +190,7 @@ func hear(records: Array[Dictionary]) -> void: ## Puts the held item's model in the figure's hand; the figure points it where the -## player looks. Nothing is held aboard the barge, falling, gliding, swimming or down. +## player looks. Nothing is held aboard the ship, falling, gliding, swimming or down. func _hold(figure: FigureRig, entity: SimEntity) -> void: var busy: bool = entity.drop_state != Drop.NONE or entity.swimming or entity.eliminated or entity.downed figure.hand().visible = not busy @@ -248,6 +262,35 @@ func _item_field(key: String) -> MultiMeshInstance3D: return field +## Shows lifeline `index` from `from` to `to`, making it if there aren't enough yet. +func _draw_lifeline(index: int, from: Vector3, to: Vector3) -> void: + if _lifeline_mesh == null: + _lifeline_mesh = VesselModels.lifeline() + while _lifelines.size() <= index: + var line: MeshInstance3D = MeshInstance3D.new() + line.name = "Lifeline%d" % _lifelines.size() + line.mesh = _lifeline_mesh + line.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF + add_child(line) + _lifelines.append(line) + var line: MeshInstance3D = _lifelines[index] + var length: float = from.distance_to(to) + line.visible = length > 0.5 + if not line.visible: + return + var up: Vector3 = Vector3.UP if absf((to - from).normalized().y) < 0.99 else Vector3.RIGHT + line.transform = Transform3D(Basis.looking_at(to - from, up) * Basis.from_scale(Vector3(1.0, 1.0, length)), (from + to) * 0.5) + + +## Lifelines drawn now, for tests. +func lifeline_count() -> int: + var count: int = 0 + for line: MeshInstance3D in _lifelines: + if line.visible: + count += 1 + return count + + func _build_figure(entity_id: int) -> FigureRig: var coat: Color = OILSKINS[0] if entity_id == local_id else OILSKINS[1 + entity_id % (OILSKINS.size() - 1)] var figure: FigureRig = FigureRig.new(coat) @@ -255,13 +298,13 @@ func _build_figure(entity_id: int) -> FigureRig: return figure -## The barge (VesselModels): a hull hung under a canvas envelope. Its deck is at the -## origin, where the simulation carries the passengers. -func _build_barge() -> Node3D: - var barge: MeshInstance3D = MeshInstance3D.new() - barge.name = "Barge" - barge.mesh = VesselModels.barge() - return barge +## The packet ship (VesselModels). Its deck is at the origin, where the simulation +## carries the passengers. +func _build_ship() -> Node3D: + var ship: MeshInstance3D = MeshInstance3D.new() + ship.name = "Ship" + ship.mesh = VesselModels.ship() + return ship func _chest_field() -> MultiMeshInstance3D: diff --git a/src/client/entities/figure_poses.gd b/src/client/entities/figure_poses.gd index 8d9423e..d1627c1 100644 --- a/src/client/entities/figure_poses.gd +++ b/src/client/entities/figure_poses.gd @@ -188,7 +188,7 @@ static func _clips() -> Dictionary: [0.4, over(air, {"shoulder_r": Vector3(-20, 0, -46), "shoulder_l": Vector3(-20, 0, 46)})], ]] - # Falling from the barge, belly down, spread out. + # Climbing the mortar's arc and falling from it, belly down, spread out. var skydive: Dictionary = { "hips": Vector3(72, 0, 0), "waist": Vector3(6, 0, 0), "neck": Vector3(-55, 0, 0), "shoulder_r": Vector3(-70, 0, -70), "shoulder_l": Vector3(-70, 0, 70), @@ -201,7 +201,7 @@ static func _clips() -> Dictionary: [0.5, over(skydive, {"shoulder_r": Vector3(-74, 0, -64), "shoulder_l": Vector3(-74, 0, 64), "knee_r": Vector3(48, 0, 0), "knee_l": Vector3(34, 0, 0)})], ]] - # Hanging under the wing-sail, both hands up on its lines. + # Hanging under the gull-kite, both hands up on its lines. var glide: Dictionary = { "hips": Vector3(12, 0, 0), "waist": Vector3(-4, 0, 0), "neck": Vector3(10, 0, 0), "shoulder_r": Vector3(-158, 0, -16), "shoulder_l": Vector3(-158, 0, 16), diff --git a/src/client/entities/figure_rig.gd b/src/client/entities/figure_rig.gd index 794d48e..8493897 100644 --- a/src/client/entities/figure_rig.gd +++ b/src/client/entities/figure_rig.gd @@ -36,7 +36,7 @@ const ANIMATED: Array[String] = [ const PARENT: Dictionary = { "hips": "", "waist": "hips", "spine": "waist", "neck": "spine", "shoulder_r": "spine", "elbow_r": "shoulder_r", "shoulder_l": "spine", "elbow_l": "shoulder_l", - "hip_r": "hips", "knee_r": "hip_r", "hip_l": "hips", "knee_l": "hip_l", "sail": "", + "hip_r": "hips", "knee_r": "hip_r", "hip_l": "hips", "knee_l": "hip_l", "kite": "", } ## Part model -> the joint pivot it hangs on. const PART_JOINT: Dictionary = { @@ -44,7 +44,7 @@ const PART_JOINT: Dictionary = { "upper_arm_r": "shoulder_r", "forearm_r": "elbow_r", "upper_arm_l": "shoulder_l", "forearm_l": "elbow_l", "thigh_r": "hip_r", "shin_r": "knee_r", "thigh_l": "hip_l", "shin_l": "knee_l", - "sail": "sail", + "kite": "kite", } ## Material names in the part models -> Palette colours. COAT and COAT_DARK are the ## player's own oilskin. @@ -52,6 +52,7 @@ const COLOURS: Dictionary = { "TAR": Palette.TAR, "TAR_WEATHERED": Palette.TAR_WEATHERED, "SKIN": Palette.SKIN, "INK": Palette.INK, "BARK": Palette.BARK, "CANVAS": Palette.CANVAS, "GILT": Palette.GILT, "PLANK": Palette.PLANK, "OCHRE_RED": Palette.OCHRE_RED, "TANNED_SAIL": Palette.TANNED_SAIL, + "SALT": Palette.SALT, } const COAT_SHADE: float = 0.28 ## The states of `move`, in input order. @@ -88,7 +89,7 @@ var speed: float = 0.0 var _hand: Node3D var _held: MeshInstance3D -var _sail: Node3D +var _kite: Node3D var _pitch: float = 0.0 var _holding: bool = true var _airborne: float = 0.0 @@ -124,8 +125,8 @@ func _init(coat_colour: Color = Palette.OILSKIN) -> void: instance.name = part instance.mesh = mesh (joints[PART_JOINT[part]] as Node3D).add_child(instance) - _sail = joints["sail"] - _sail.visible = false + _kite = joints["kite"] + _kite.visible = false _hand = Node3D.new() _hand.name = "hand_r" _hand.position = _vector(layout.get("hand_r", [-0.24, 0.86, 0.03])) - _vector(at.get("elbow_r", [0, 0, 0])) @@ -163,7 +164,7 @@ static func part_mesh(part: String, coat_colour: Color) -> ArrayMesh: ## H1: one surface per finish instead of one per colour, with each Palette colour ## carried as a vertex colour. The model's surfaces are separate draw calls in every -## pass, and 24 figures crowded on the barge passed the draw-call budget; merged, a +## pass, and 24 figures crowded on the ship passed the draw-call budget; merged, a ## figure costs a third of the draws and looks the same. Each surface is named after ## its finish: FINISH_COAT, FINISH_GILT or FINISH_PLAIN. static func _merged(source: Mesh, coat_colour: Color) -> ArrayMesh: @@ -256,8 +257,8 @@ func held() -> MeshInstance3D: return _held -func sail() -> Node3D: - return _sail +func kite() -> Node3D: + return _kite ## Sets the tree from an entity's replicated state. `delta` is the time since the last @@ -283,7 +284,7 @@ func drive(entity: SimEntity, delta: float) -> void: flinch() _last_health = entity.health _pitch = float(entity.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5) - _sail.visible = state == "glide" + _kite.visible = state == "glide" _hand.visible = _holding tree.set("parameters/move/transition_request", state) tree.set("parameters/ground/blend_position", speed) diff --git a/src/client/entities/vessel_models.gd b/src/client/entities/vessel_models.gd index 024d09e..b16b93c 100644 --- a/src/client/entities/vessel_models.gd +++ b/src/client/entities/vessel_models.gd @@ -1,31 +1,42 @@ -## Generated meshes for the drop barge and the sea chests, built in code from Palette +## Generated meshes for the packet ship and the sea chests, built in code from Palette ## colours (no imported art): ## -## - the barge: a tarred, lofted hull with a sheer and pointed ends, a planked deck, -## rails, mooring lines, and a gored canvas envelope with tanned stripes and an ochre -## band, in the folk-art manner of docs/STYLE.md. Its deck top is at the origin, where -## the simulation carries the passengers; it points along +z; +## - the packet ship (#72): a tarred, lofted hull with a sheer, an ochre rubbing strake +## and a salt-white boot-top at the waterline, a planked deck, rails, two masts with +## tanned square sails on yards, a bowsprit, shrouds, and the lifeline mortar on its +## timber bed, in the folk-art manner of docs/STYLE.md. Its deck top is at the origin, +## where the simulation carries the passengers, and the waterline SHIP_DECK_HEIGHT +## below it; it points along +z, and the mortar faces +x; ## - a sea chest: a painted box with a lid, tarred iron bands, a salt-white border and a ## gilt hasp, its base at the origin. class_name VesselModels extends RefCounted -## Hull half-length, half-breadth at the deck, and depth amidships, in metres. -const HULL_HALF_LENGTH: float = 5.5 -const HULL_HALF_BREADTH: float = 3.4 -const HULL_DEPTH: float = 1.6 -## Envelope centre height above the deck and its semi-axes (x, y, z), in metres. -const ENVELOPE_HEIGHT: float = 10.5 -const ENVELOPE_AXES: Vector3 = Vector3(5.2, 3.8, 9.0) -const ENVELOPE_RINGS: int = 14 -const ENVELOPE_SIDES: int = 20 +## Hull half-length, half-breadth at the deck, and depth amidships, in metres. The keel +## sits HULL_DEPTH under the deck, below the waterline. +const HULL_HALF_LENGTH: float = 12.0 +const HULL_HALF_BREADTH: float = 3.8 +const HULL_DEPTH: float = Tuning.SHIP_DECK_HEIGHT + 1.8 +## Masts: where along the deck (z), and how tall above it. +const MASTS: Array[Vector2] = [Vector2(6.6, 17.0), Vector2(-5.8, 14.5)] +## Where the mortar stands on the deck: forward of the passengers, aft of the foremast, +## pointing out to +x. +const MORTAR_AT: Vector3 = Vector3(1.4, 0.0, 4.7) + +## The mortar's barrel: its breech above MORTAR_AT, the way it points, and its length. +const MORTAR_BREECH: Vector3 = Vector3(-0.15, 0.55, 0.0) +const MORTAR_AIM: Vector3 = Vector3(0.62, 0.78, 0.0) +const MORTAR_LENGTH: float = 1.25 + +## The lifeline cord's thickness, in metres. +const LIFELINE_WIDTH: float = 0.07 ## Chest size (x, y, z), in metres; its lid is the top LID share of its height. const CHEST_SIZE: Vector3 = Vector3(0.9, 0.55, 0.6) const LID: float = 0.3 -static func barge() -> ArrayMesh: +static func ship() -> ArrayMesh: var tool: SurfaceTool = SurfaceTool.new() tool.begin(Mesh.PRIMITIVE_TRIANGLES) tool.set_smooth_group(-1) @@ -43,30 +54,117 @@ static func barge() -> ArrayMesh: x += 0.32 index += 1 # Rails follow the sheer on stanchions at every station. - var rail: Vector3 = Vector3(0.0, 0.65, 0.0) - for side: int in [0, 4]: + var rail: Vector3 = Vector3(0.0, 0.8, 0.0) + for side: int in [0, 6]: var inward: Vector3 = Vector3(0.12 if side == 0 else -0.12, 0.0, 0.0) for station: int in rings.size(): var at: Vector3 = rings[station][side] + inward _line(tool, at, at + rail, 0.1, Palette.TAR) if station + 1 < rings.size(): _line(tool, at + rail, rings[station + 1][side] + inward + rail, 0.1, Palette.TAR) - for side: float in [-1.0, 1.0]: - # Mooring lines from the rail to the envelope's belly. - for end: float in [-1.0, 1.0]: - var foot: Vector3 = Vector3(side * (HULL_HALF_BREADTH - 0.35), 0.6, end * 3.6) - var hx: float = 0.55 - var hz: float = 0.5 - var under: float = ENVELOPE_AXES.y * sqrt(1.0 - hx * hx - hz * hz) - var head: Vector3 = Vector3(side * ENVELOPE_AXES.x * hx, ENVELOPE_HEIGHT - under + 0.15, end * ENVELOPE_AXES.z * hz) - _line(tool, foot, head, 0.05, Palette.PLANK.darkened(0.3)) - _envelope(tool) + # Bowsprit, raking up from the bow. + var bow: Vector3 = Vector3(0.0, _sheer(1.0) + 0.3, HULL_HALF_LENGTH - 0.4) + var sprit_end: Vector3 = bow + Vector3(0.0, 2.4, 6.0) + _line(tool, bow, sprit_end, 0.28, Palette.PLANK.darkened(0.15)) + for mast: Vector2 in MASTS: + _mast(tool, mast.x, mast.y, sprit_end if mast == MASTS[0] else Vector3.INF) + _mortar(tool) tool.generate_normals() var mesh: ArrayMesh = tool.commit() mesh.surface_set_material(0, _material(0.85)) return mesh +## Height of the sheer at `t`, from -1 (stern) to 1 (bow). +static func _sheer(t: float) -> float: + return 0.9 * t * t + + +## A mast at `z` rising `height` above the deck: a tarred pole, two yards with tanned +## square sails between them, an ochre band on the lower sail, and shrouds to the rails. +## A forestay runs to `stay_to` unless it is Vector3.INF. +static func _mast(tool: SurfaceTool, z: float, height: float, stay_to: Vector3) -> void: + var foot: Vector3 = Vector3(0.0, 0.0, z) + var top: Vector3 = Vector3(0.0, height, z) + _line(tool, foot, top, 0.36, Palette.PLANK.darkened(0.25)) + var yards: Array[float] = [height * 0.36, height * 0.66, height * 0.92] + var spans: Array[float] = [4.6, 3.8, 2.8] + for level: int in yards.size(): + var y: float = yards[level] + var half: float = spans[level] + _line(tool, Vector3(-half, y, z + 0.3), Vector3(half, y, z + 0.3), 0.2, Palette.TAR) + for level: int in 2: + var y_top: float = yards[level + 1] + var y_foot: float = yards[level] + 0.25 + var half_top: float = spans[level + 1] + var half_foot: float = spans[level] + # The sail bellies forward in the middle: three panels across, the middle one + # further out. + var columns: int = 4 + for column: int in columns: + var u0: float = float(column) / columns * 2.0 - 1.0 + var u1: float = float(column + 1) / columns * 2.0 - 1.0 + var belly0: float = 0.55 + 0.9 * (1.0 - u0 * u0) + var belly1: float = 0.55 + 0.9 * (1.0 - u1 * u1) + var colour: Color = Palette.TANNED_SAIL if column % 2 == 0 else Palette.TANNED_SAIL.lightened(0.08) + _quad(tool, + Vector3(u0 * half_top, y_top, z + 0.45), Vector3(u1 * half_top, y_top, z + 0.45), + Vector3(u1 * half_foot, y_foot, z + belly1), Vector3(u0 * half_foot, y_foot, z + belly0), colour) + if level == 0: + # An ochre band across the lower sail, a little above its foot. + var yb: float = lerpf(y_foot, y_top, 0.2) + var yb2: float = lerpf(y_foot, y_top, 0.3) + var hb: float = lerpf(half_foot, half_top, 0.2) + var hb2: float = lerpf(half_foot, half_top, 0.3) + _quad(tool, Vector3(-hb2, yb2, z + 1.42), Vector3(hb2, yb2, z + 1.42), Vector3(hb, yb, z + 1.47), Vector3(-hb, yb, z + 1.47), Palette.OCHRE_RED) + # Shrouds from the top of the lower sail to each rail. + for side: float in [-1.0, 1.0]: + for step: float in [-0.8, 0.0, 0.8]: + _line(tool, Vector3(side * (HULL_HALF_BREADTH - 0.3), 0.7, z + step - 0.6), Vector3(0.0, yards[1], z), 0.05, Palette.TAR) + if stay_to != Vector3.INF: + _line(tool, top, stay_to, 0.06, Palette.TAR) + + +## The lifeline mortar: a squat tarred barrel with gilt bands on a timber bed, cocked up +## towards +x, and a coil of line beside it. +static func _mortar(tool: SurfaceTool) -> void: + var at: Vector3 = MORTAR_AT + PieceMesher.add_box(tool, AABB(at + Vector3(-0.8, 0.0, -0.7), Vector3(1.6, 0.45, 1.4)), Palette.PLANK.darkened(0.2)) + var breech: Vector3 = at + MORTAR_BREECH + var aim: Vector3 = MORTAR_AIM.normalized() + _line(tool, breech, breech + aim * MORTAR_LENGTH, 0.72, Palette.TAR) + for band: float in [0.25, 0.95]: + _line(tool, breech + aim * band, breech + aim * (band + 0.12), 0.8, Palette.GILT) + # A coil of line on the deck behind it, as a ring of short segments. + var coil: Vector3 = at + Vector3(-1.6, 0.18, 0.9) + for turn: int in 3: + var radius: float = 0.55 - turn * 0.1 + var segments: int = 10 + for segment: int in segments: + var a0: float = TAU * segment / segments + var a1: float = TAU * (segment + 1) / segments + var p0: Vector3 = coil + Vector3(cos(a0) * radius, turn * 0.07, sin(a0) * radius) + var p1: Vector3 = coil + Vector3(cos(a1) * radius, turn * 0.07, sin(a1) * radius) + _line(tool, p0, p1, 0.09, Palette.CANVAS.darkened(0.15)) + + +## The middle of the mortar's muzzle, in the ship model's own space. +static func muzzle() -> Vector3: + return MORTAR_AT + MORTAR_BREECH + MORTAR_AIM.normalized() * MORTAR_LENGTH + + +## A length of lifeline: a square cord LIFELINE_WIDTH thick and one metre long along +## -z, centred on the origin, for EntityView to stretch between the mortar and a player. +static func lifeline() -> ArrayMesh: + var tool: SurfaceTool = SurfaceTool.new() + tool.begin(Mesh.PRIMITIVE_TRIANGLES) + _line(tool, Vector3(0.0, 0.0, 0.5), Vector3(0.0, 0.0, -0.5), LIFELINE_WIDTH, Palette.CANVAS.darkened(0.15)) + tool.generate_normals() + var mesh: ArrayMesh = tool.commit() + mesh.surface_set_material(0, _material(0.9)) + return mesh + + static func chest() -> ArrayMesh: var tool: SurfaceTool = SurfaceTool.new() tool.begin(Mesh.PRIMITIVE_TRIANGLES) @@ -89,65 +187,56 @@ static func chest() -> ArrayMesh: return mesh -## The hull as rings of five points (rail, bilge, keel, bilge, rail) along z. Returns -## the rings, for the rails. +## The hull as rings of seven points along z: rail, boot-top, waterline, keel and back +## up the other side (indices 0 to 6), with the deck at y = 0 and the sea at +## -SHIP_DECK_HEIGHT. Returns the rings, for the rails. static func _hull(tool: SurfaceTool) -> Array[PackedVector3Array]: - var stations: int = 12 + var stations: int = 16 + var water: float = -Tuning.SHIP_DECK_HEIGHT var rings: Array[PackedVector3Array] = [] for station: int in stations + 1: var t: float = float(station) / stations * 2.0 - 1.0 var z: float = t * HULL_HALF_LENGTH - var breadth: float = HULL_HALF_BREADTH * sqrt(maxf(1.0 - pow(absf(t), 4.0), 0.015)) - var keel: float = -HULL_DEPTH * (1.0 - 0.55 * pow(absf(t), 3.0)) - var sheer: float = 0.25 * t * t + var breadth: float = HULL_HALF_BREADTH * sqrt(maxf(1.0 - pow(absf(t), 3.0), 0.01)) + var keel: float = -HULL_DEPTH * (1.0 - 0.3 * pow(absf(t), 3.0)) + var sheer: float = _sheer(t) var ring: PackedVector3Array = PackedVector3Array([ - Vector3(-breadth, sheer, z), Vector3(-breadth * 0.8, keel * 0.6, z), Vector3(0.0, keel, z), - Vector3(breadth * 0.8, keel * 0.6, z), Vector3(breadth, sheer, z), + Vector3(-breadth, sheer, z), + Vector3(-breadth * 0.97, water + 0.6, z), + Vector3(-breadth * 0.93, water, z), + Vector3(0.0, keel, z), + Vector3(breadth * 0.93, water, z), + Vector3(breadth * 0.97, water + 0.6, z), + Vector3(breadth, sheer, z), ]) rings.append(ring) for station: int in stations: - for side: int in 4: - var colour: Color = Palette.TAR if side == 1 or side == 2 else Palette.TAR_WEATHERED - # A painted strake under the rail, every other station a shade lighter. - if side == 0 or side == 3: + for side: int in 6: + var colour: Color = Palette.TAR_WEATHERED + if side == 1 or side == 4: + colour = Palette.SALT + elif side == 2 or side == 3: + colour = Palette.TAR + else: + # The topsides, a painted strake every other station a shade lighter. colour = PieceMesher.tint(colour, station * 7 + side) _quad(tool, rings[station][side], rings[station][side + 1], rings[station + 1][side + 1], rings[station + 1][side], colour) + # Transom and stem: close the ends. + for end: int in [0, stations]: + var ring: PackedVector3Array = rings[end] + for side: int in 3: + _quad(tool, ring[side], ring[side + 1], ring[5 - side], ring[6 - side], Palette.TAR) # Rubbing strake: an ochre band along the top of the hull. for station: int in stations: - for side: int in [0, 4]: + for side: int in [0, 6]: var a: Vector3 = rings[station][side] var b: Vector3 = rings[station + 1][side] - var out: float = 0.04 * signf(a.x) if absf(a.x) > 0.01 else 0.0 - var drop: Vector3 = Vector3(0.0, -0.22, 0.0) - _quad(tool, a + Vector3(out, 0.0, 0.0), b + Vector3(out, 0.0, 0.0), b + drop + Vector3(out, 0.0, 0.0), a + drop + Vector3(out, 0.0, 0.0), Palette.OCHRE_RED) + var out: Vector3 = Vector3(0.04 * signf(a.x), 0.0, 0.0) + var drop: Vector3 = Vector3(0.0, -0.3, 0.0) + _quad(tool, a + out, b + out, b + drop + out, a + drop + out, Palette.OCHRE_RED) return rings -## The envelope: an ellipsoid of gores along z, alternately canvas and tanned, with an -## ochre band round its middle. -static func _envelope(tool: SurfaceTool) -> void: - var centre: Vector3 = Vector3(0.0, ENVELOPE_HEIGHT, 0.0) - var rings: Array[PackedVector3Array] = [] - for ring: int in ENVELOPE_RINGS + 1: - var phi: float = PI * float(ring) / ENVELOPE_RINGS - var z: float = -cos(phi) * ENVELOPE_AXES.z - var r: float = sin(phi) - var points: PackedVector3Array = PackedVector3Array() - for side: int in ENVELOPE_SIDES + 1: - var theta: float = TAU * float(side) / ENVELOPE_SIDES - points.append(centre + Vector3(cos(theta) * r * ENVELOPE_AXES.x, sin(theta) * r * ENVELOPE_AXES.y, z)) - rings.append(points) - var middle: int = ENVELOPE_RINGS / 2 - tool.set_smooth_group(1) - for ring: int in ENVELOPE_RINGS: - for side: int in ENVELOPE_SIDES: - var colour: Color = Palette.CANVAS if (side / 2) % 2 == 0 else Palette.TANNED_SAIL.lightened(0.15) - if ring == middle or ring == middle - 1: - colour = Palette.OCHRE_RED - _quad(tool, rings[ring][side], rings[ring][side + 1], rings[ring + 1][side + 1], rings[ring + 1][side], colour) - tool.set_smooth_group(-1) - - ## A square line `width` thick from `a` to `b`. static func _line(tool: SurfaceTool, a: Vector3, b: Vector3, width: float, colour: Color) -> void: var along: Vector3 = (b - a).normalized() diff --git a/src/client/hud/chart_map.gd b/src/client/hud/chart_map.gd index 9f73294..9a76fcf 100644 --- a/src/client/hud/chart_map.gd +++ b/src/client/hud/chart_map.gd @@ -1,6 +1,6 @@ ## The island as a hand-drawn nautical chart (A11): paper land with ink contours every ## CONTOUR_METRES, a heavier coastline, the sea in the sea's ink, place names, the -## barge's route, the player's own mark, and the tide forecast: land the coming tide +## ship's route, the player's own mark, and the tide forecast: land the coming tide ## will flood is hatched, and land the sea has already taken is washed with the sea. ## ## The forecast comes from the client's own Flood (Flood.forecast), the same spreading @@ -28,7 +28,7 @@ var mode: Mode = Mode.FULL var world: Simulation = null ## Place names and where they are, in world metres (x, z). var places: Array[Dictionary] = [] -## The barge's route ends, in world metres (x, z), or empty when there's no drop. +## The ship's route ends, in world metres (x, z), or empty when there's no drop. var route: PackedVector2Array = PackedVector2Array() ## The player: position (x, z) in metres, facing (radians, the simulation's yaw), and ## whether to draw them. @@ -54,7 +54,7 @@ func _init(chart_mode: Mode = Mode.FULL) -> void: ## Draws the chart of `simulation`'s island and names its places from `match_seed`. -## `drop` is the match's barge route, or null. `share` is another ChartMap already set +## `drop` is the match's ship route, or null. `share` is another ChartMap already set ## up for the same world, whose paper and contours are used rather than drawn again. func setup(simulation: Simulation, match_seed: int, drop: Drop = null, share: ChartMap = null) -> void: world = simulation diff --git a/src/client/match_view.gd b/src/client/match_view.gd index 75c3485..df78e41 100644 --- a/src/client/match_view.gd +++ b/src/client/match_view.gd @@ -122,7 +122,7 @@ func follow(entity_id: int, pitch: float = NAN, look_yaw: float = NAN) -> bool: return false var yaw: float = look_yaw if not is_nan(look_yaw) else float(player.yaw) / PlayerCommand.YAW_STEPS * TAU var look_pitch: float = pitch if not is_nan(pitch) else float(player.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5) - # Where the figure is drawn: on the barge's deck that is its own place, not the + # Where the figure is drawn: on the ship's deck that is its own place, not the # one point the simulation carries every passenger at. var feet: Vector3 = player.position var figure: Node3D = entities.figure_of(entity_id) diff --git a/src/net/client_game.gd b/src/net/client_game.gd index 00fec87..0516636 100644 --- a/src/net/client_game.gd +++ b/src/net/client_game.gd @@ -7,7 +7,7 @@ ## packets to receive() and sends whatever advance() leaves in `outbox`. ## ## The client generates the match's island itself from the seed in the MATCH notice -## (`world`, a Simulation that is never stepped) and plans the same barge route, so it +## (`world`, a Simulation that is never stepped) and plans the same ship route, so it ## can run the same movement code as the server on the same ground. WORLD messages keep ## that world's built pieces, props, chests and tide in line with the server's, and OWN ## messages say what the player carries (`replica`, a ClientWorld). Pieces the player @@ -322,7 +322,7 @@ func _take_snapshot() -> void: _recent.clear() return if not prediction.active: - # The barge's route is drawn from the seed alone, at the match's first tick. + # The ship's route is drawn from the seed alone, at the match's first tick. prediction.begin(world.ground, Drop.plan(world.ground, SimRng.new(world_seed), 0)) clock.start(receiver.sim_tick) clock.observe(receiver.sim_tick, receiver.command_tick) diff --git a/src/net/client_mirror.gd b/src/net/client_mirror.gd index bd6ed5f..fa1c9f6 100644 --- a/src/net/client_mirror.gd +++ b/src/net/client_mirror.gd @@ -5,7 +5,7 @@ ## pieces, props, chests and tide in line with the server. This adds the rest of the ## picture, afresh every frame: every entity the server has told this client about, ## where it is being drawn now (everyone else from the recent past, the client's own -## player where it was predicted), the barge, the clock and the sea level. Nothing +## player where it was predicted), the ship, the clock and the sea level. Nothing ## here is authoritative, and nothing reads it back but views and the client's own ## check before placing a piece. class_name ClientMirror @@ -16,8 +16,8 @@ extends RefCounted var watched_id: int = 0 ## The client's own player while it is in the match, or 0. var own_id: int = 0 -## Where the barge is being drawn, or Vector3.INF when it isn't crossing. -var barge_at: Vector3 = Vector3.INF +## Where the ship is being drawn, or Vector3.INF when it isn't crossing. +var ship_at: Vector3 = Vector3.INF ## The moment being drawn, in simulation ticks. var time: float = 0.0 @@ -35,7 +35,7 @@ func sync(game: ClientGame) -> void: var world: Simulation = game.world watched_id = 0 own_id = 0 - barge_at = Vector3.INF + ship_at = Vector3.INF if world == null: return var receiver: SnapshotReceiver = game.receiver @@ -60,7 +60,7 @@ func sync(game: ClientGame) -> void: _drop.finished = _drop.is_over(world.tick) world.drop = _drop if not _drop.finished: - barge_at = _drop.barge_position(world.tick).lerp(_drop.barge_position(world.tick + 1), time - floorf(time)) + ship_at = _drop.ship_position(world.tick).lerp(_drop.ship_position(world.tick + 1), time - floorf(time)) else: world.drop = null @@ -154,8 +154,8 @@ func _show_player(entity: SimEntity, record: PackedInt32Array, shown: Dictionary entity.use_ticks = 1 if flags & NetSnapshot.FLAG_USING != 0 else 0 # What is in the player's hands, for whoever draws it: the item's code, or -1. entity.item = record[NetSnapshot.R_HELD] - 1 - if entity.drop_state == Drop.ABOARD and barge_at != Vector3.INF: - entity.position = barge_at + if entity.drop_state == Drop.ABOARD and ship_at != Vector3.INF: + entity.position = ship_at ## The client's own player: where and how it was predicted, not where the server last @@ -172,5 +172,5 @@ func _show_own(entity: SimEntity, game: ClientGame) -> void: entity.velocity = me.velocity entity.reload_ticks = me.reload_ticks entity.use_ticks = me.use_ticks - if me.drop_state == Drop.ABOARD and barge_at != Vector3.INF: - entity.position = barge_at + if me.drop_state == Drop.ABOARD and ship_at != Vector3.INF: + entity.position = ship_at diff --git a/src/net/client_prediction.gd b/src/net/client_prediction.gd index fd24fda..b4bbf4c 100644 --- a/src/net/client_prediction.gd +++ b/src/net/client_prediction.gd @@ -157,7 +157,7 @@ func _run(tick: int) -> void: return _drop.ride(player, command, tick) if player.drop_state == Drop.ABOARD and _drop.is_over(tick + 1): - _drop.leap(player, tick + 1) + _drop.fire_at_end(player, tick + 1) return var water: float = _water_at(player.position) Movement.step(player, command, _ground, water) diff --git a/src/server/server_loop.gd b/src/server/server_loop.gd index cfab29f..d01175a 100644 --- a/src/server/server_loop.gd +++ b/src/server/server_loop.gd @@ -47,7 +47,7 @@ func _init(match_seed: int, human_players: int, bot_count: int, rules: MatchRule for handle: int in range(1, human_players + 1): match_flow.join(handle) if rules.lobby_ticks == 0 and rules.countdown_ticks == 0: - # Every match starts on the sky barge, on the first tick. + # Every match starts on the packet ship, on the first tick. _advance() diff --git a/src/sim/building.gd b/src/sim/building.gd index a66ae30..04d7dc1 100644 --- a/src/sim/building.gd +++ b/src/sim/building.gd @@ -14,7 +14,7 @@ extends RefCounted enum Result { OK, - ## Dead, swimming, aboard the barge or falling. + ## Dead, swimming, aboard the ship or falling. NOT_ALLOWED, ## Unknown piece kind or material. BAD_REQUEST, diff --git a/src/sim/drop.gd b/src/sim/drop.gd index 1f1a22d..2bbd861 100644 --- a/src/sim/drop.gd +++ b/src/sim/drop.gd @@ -1,78 +1,128 @@ -## The start of a match: a sky barge drifts across the island on a seeded straight route, -## carrying every player. Each one leaps when they choose, falls, opens a wing-sail -## (by hand, or automatically near the ground) and steers down. Anyone still aboard -## when the barge reaches the end of its route is thrown off. +## The start of a match (#72): a packet ship sails a seeded straight line past the +## island, offshore, carrying every player. Each one fires themselves inland by lifeline +## mortar when they choose: the look direction sets the heading, and how high they aim +## sets the charge, so a level aim lands near the shore and an aim up high carries to +## the far side. They ride the mortar's arc up, then fall, open a gull-kite (by hand, +## or by itself near the ground) and steer down. Anyone still aboard when the ship +## reaches the end of its route is fired towards the middle of the island. ## -## The route is drawn from the "drop" stream: a heading, and a point near the island's -## middle that the route passes through, so it always crosses land. Movement handles -## falling and gliding; this owns the barge, boarding and leaping. +## The route is drawn from the "drop" stream: a heading, and the side of the island the +## ship passes on. It passes as close in as it can while keeping SHIP_COAST_CLEARANCE +## of open water between itself and any land. Movement handles the arc, falling and gliding; +## this owns the ship, boarding and firing. class_name Drop extends RefCounted -## Player drop states, in SimEntity.drop_state. +## Player drop states, in SimEntity.drop_state. FREEFALL covers the mortar's climb +## (rising, with no steering) as well as the fall. const NONE: int = 0 const ABOARD: int = 1 const FREEFALL: int = 2 const GLIDING: int = 3 -## Where the route starts and ends, at barge altitude. +## Where the route starts and ends, at deck height. var start: Vector3 = Vector3.ZERO var finish: Vector3 = Vector3.ZERO -## Ticks the barge takes from start to finish. +## Ticks the ship takes from start to finish. var duration_ticks: int = 0 ## Simulation tick the drop began on. var began_tick: int = 0 -## True once the barge has reached the end and thrown everyone off. +## True once the ship has reached the end and fired everyone still aboard. var finished: bool = false -## Plans the route for `island` from the simulation's "drop" stream. +## Plans the route past `island_ground` from the simulation's "drop" stream. static func plan(island_ground: SimGround, rng: SimRng, tick: int) -> Drop: var drop: Drop = Drop.new() var stream: RandomNumberGenerator = rng.stream("drop") var size: float = Tuning.WORLD_SIZE_METRES var centre: Vector2 = Vector2(size, size) * 0.5 - var heading: float = stream.randf() * TAU - var jitter_angle: float = stream.randf() * TAU - var jitter: float = sqrt(stream.randf()) * Tuning.BARGE_CENTRE_JITTER - var through: Vector2 = centre + Vector2(cos(jitter_angle), sin(jitter_angle)) * jitter - # Pull the crossing point onto land if the jitter put it over water. - var tries: int = 0 - while island_ground.terrain_height(through.x, through.y) <= Tuning.ISLAND_BEACH_TOP and tries < 16: - through = through.lerp(centre, 0.5) - tries += 1 - var direction: Vector2 = Vector2(cos(heading), sin(heading)) - var margin: float = Tuning.BARGE_ROUTE_MARGIN - var back: float = _distance_to_edge(through, -direction, margin, size) - var ahead: float = _distance_to_edge(through, direction, margin, size) - var a: Vector2 = through - direction * back - var b: Vector2 = through + direction * ahead - drop.start = Vector3(a.x, Tuning.BARGE_ALTITUDE, a.y) - drop.finish = Vector3(b.x, Tuning.BARGE_ALTITUDE, b.y) - drop.duration_ticks = maxi(ceili(a.distance_to(b) / Tuning.BARGE_SPEED * Tuning.TICK_RATE_HZ), 1) + var margin: float = Tuning.SHIP_ROUTE_MARGIN + var best_a: Vector2 = Vector2.ZERO + var best_b: Vector2 = Vector2.ZERO + var found: bool = false + for _try: int in Tuning.SHIP_ROUTE_TRIES: + var heading: float = stream.randf() * TAU + var side: float = 1.0 if stream.randf() < 0.5 else -1.0 + var direction: Vector2 = Vector2(cos(heading), sin(heading)) + # Away from the island, on the chosen side. + var outward: Vector2 = Vector2(-direction.y, direction.x) * side + var offset: float = Tuning.SHIP_OFFSET_MIN + while offset <= Tuning.SHIP_OFFSET_MAX: + var through: Vector2 = centre + outward * offset + var a: Vector2 = through - direction * _distance_to_edge(through, -direction, margin, size) + var b: Vector2 = through + direction * _distance_to_edge(through, direction, margin, size) + if a.distance_to(b) < Tuning.SHIP_MIN_ROUTE_METRES: + break + if not found: + # The fallback, should no route anywhere stay clear: the farthest one out. + best_a = a + best_b = b + if _clear_of_land(island_ground, a, b): + best_a = a + best_b = b + found = true + break + offset += Tuning.SHIP_OFFSET_STEP + if found: + break + if not found: + # Nothing on the drawn headings stayed clear: try the four routes along the + # world's sides, as far out as routes go, which are the longest. + var sides: Array[Vector2] = [Vector2.DOWN, Vector2.UP, Vector2.LEFT, Vector2.RIGHT] + for outward: Vector2 in sides: + var direction: Vector2 = Vector2(outward.y, -outward.x) + var through: Vector2 = centre + outward * Tuning.SHIP_OFFSET_MAX + var a: Vector2 = through - direction * _distance_to_edge(through, -direction, margin, size) + var b: Vector2 = through + direction * _distance_to_edge(through, direction, margin, size) + if _clear_of_land(island_ground, a, b): + best_a = a + best_b = b + break + drop.start = Vector3(best_a.x, Tuning.SHIP_DECK_HEIGHT, best_a.y) + drop.finish = Vector3(best_b.x, Tuning.SHIP_DECK_HEIGHT, best_b.y) + drop.duration_ticks = maxi(ceili(best_a.distance_to(best_b) / Tuning.SHIP_SPEED * Tuning.TICK_RATE_HZ), 1) drop.began_tick = tick return drop -## How far along the route the barge is at `tick`, from 0 to 1. +## True if the route from `a` to `b` is open sea with no land within +## SHIP_COAST_CLEARANCE of it, probed in eight directions at half and full clearance. +static func _clear_of_land(island_ground: SimGround, a: Vector2, b: Vector2) -> bool: + var count: int = maxi(ceili(a.distance_to(b) / Tuning.SHIP_CLEARANCE_STEP), 1) + var limit: float = Tuning.SEA_LEVEL_START - Tuning.SHIP_DRAUGHT + for index: int in count + 1: + var point: Vector2 = a.lerp(b, float(index) / count) + if island_ground.terrain_height(point.x, point.y) > limit: + return false + for direction: int in 8: + var angle: float = TAU * direction / 8.0 + for radius: float in [Tuning.SHIP_COAST_CLEARANCE * 0.5, Tuning.SHIP_COAST_CLEARANCE]: + var probe: Vector2 = point + Vector2(cos(angle), sin(angle)) * radius + if island_ground.terrain_height(probe.x, probe.y) > limit: + return false + return true + + +## How far along the route the ship is at `tick`, from 0 to 1. func progress(tick: int) -> float: return clampf(float(tick - began_tick) / duration_ticks, 0.0, 1.0) -func barge_position(tick: int) -> Vector3: +func ship_position(tick: int) -> Vector3: return start.lerp(finish, progress(tick)) -func barge_velocity() -> Vector3: +func ship_velocity() -> Vector3: return (finish - start) / (float(duration_ticks) / Tuning.TICK_RATE_HZ) -## True once the barge is at the end of its route. +## True once the ship is at the end of its route. func is_over(tick: int) -> bool: return tick - began_tick >= duration_ticks -## Points along the route every `step` metres, at ground level, for tests and maps. +## Points along the route every `step` metres, at sea level, for tests and maps. func route_samples(step: float) -> PackedVector2Array: var points: PackedVector2Array = PackedVector2Array() var a: Vector2 = Vector2(start.x, start.z) @@ -83,7 +133,7 @@ func route_samples(step: float) -> PackedVector2Array: return points -## Puts a player aboard: carried with the barge, not moving on their own. +## Puts a player aboard: carried with the ship, not moving on their own. static func board(player: SimEntity, at: Vector3) -> void: player.drop_state = ABOARD player.position = at @@ -92,25 +142,111 @@ static func board(player: SimEntity, at: Vector3) -> void: player.swimming = false -## Throws a player off the barge into freefall, keeping some of the barge's speed. -func leap(player: SimEntity, tick: int) -> void: +# The lifeline mortar + +## The mortar's charge, 0 to 1, for a look pitch in radians: level or lower is the +## least, MORTAR_PITCH_HIGH_DEGREES or higher the most. +static func charge_for_pitch(pitch_radians: float) -> float: + var low: float = deg_to_rad(Tuning.MORTAR_PITCH_LOW_DEGREES) + var high: float = deg_to_rad(Tuning.MORTAR_PITCH_HIGH_DEGREES) + return clampf((pitch_radians - low) / (high - low), 0.0, 1.0) + + +## The look pitch, in radians, that gives `charge`. +static func pitch_for_charge(charge: float) -> float: + var low: float = deg_to_rad(Tuning.MORTAR_PITCH_LOW_DEGREES) + var high: float = deg_to_rad(Tuning.MORTAR_PITCH_HIGH_DEGREES) + return lerpf(low, high, clampf(charge, 0.0, 1.0)) + + +## The launch velocity for a heading (yaw, radians, as PlayerCommand measures it) and +## a charge. +static func launch_velocity(yaw_radians: float, charge: float) -> Vector3: + var speed: float = lerpf(Tuning.MORTAR_MIN_SPEED, Tuning.MORTAR_MAX_SPEED, clampf(charge, 0.0, 1.0)) + return Vector3(sin(yaw_radians) * speed, Tuning.MORTAR_RISE_SPEED, cos(yaw_radians) * speed) + + +## Fires a player off the ship by mortar, along `yaw_radians` with `charge`. +func fire(player: SimEntity, tick: int, yaw_radians: float, charge: float) -> void: player.drop_state = FREEFALL - player.position = barge_position(tick) - var carried: Vector3 = barge_velocity() * Tuning.LEAP_CARRY - player.velocity = Vector3(carried.x, 0.0, carried.z) + player.position = ship_position(tick) + player.velocity = launch_velocity(yaw_radians, charge) player.on_ground = false -## A tick aboard the barge: jump leaps off, anything else rides along. The server and a -## client predicting its own player both come through here. +## How far over level ground a shot with `charge` carries while the player keeps +## steering straight on: with `kite_at_top`, opening the kite as soon as the climb ends +## (the furthest a shot can carry, and the slowest way down); without, falling until +## the kite opens by itself. Mirrors Movement._fall_from_ship(); bots and the forced +## shot pick their charge with it. +static func reach(charge: float, kite_at_top: bool = false) -> float: + var dt: float = 1.0 / Tuning.TICK_RATE_HZ + var launch: Vector3 = launch_velocity(0.0, charge) + var flat: float = launch.z + var rise: float = launch.y + var height: float = Tuning.SHIP_DECK_HEIGHT + var travelled: float = 0.0 + var gliding: bool = false + for _tick: int in Tuning.TICK_RATE_HZ * 120: + if rise > 0.0: + rise -= Tuning.GRAVITY * dt + else: + gliding = gliding or kite_at_top or height <= Tuning.KITE_AUTO_DEPLOY_HEIGHT + if gliding: + flat = move_toward(flat, Tuning.GLIDE_SPEED, Tuning.DROP_STEER_ACCEL * dt) + rise = move_toward(rise, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * dt) + else: + flat = move_toward(flat, Tuning.FREEFALL_STEER_SPEED, Tuning.DROP_STEER_ACCEL * dt) + rise = maxf(rise - Tuning.GRAVITY * dt, -Tuning.FREEFALL_MAX_SPEED) + travelled += flat * dt + height += rise * dt + if height <= 0.0: + break + return travelled + + +## The least charge whose reach() is at least `distance`, or 1 if none is. +static func charge_for_distance(distance: float, kite_at_top: bool = false) -> float: + if reach(0.0, kite_at_top) >= distance: + return 0.0 + if reach(1.0, kite_at_top) <= distance: + return 1.0 + var low: float = 0.0 + var high: float = 1.0 + for _step: int in 12: + var middle: float = (low + high) * 0.5 + if reach(middle, kite_at_top) < distance: + low = middle + else: + high = middle + return high + + +## The charge that carries `distance` with the quickest way down: a fall if one carries +## that far, otherwise a full charge with the kite opened at the top. +static func aim_charge(distance: float) -> float: + return charge_for_distance(distance) if reach(1.0) >= distance else charge_for_distance(distance, true) + + +## A tick aboard the ship: jump fires the mortar, anything else rides along. The +## server and a client predicting its own player both come through here. func ride(player: SimEntity, command: PlayerCommand, tick: int) -> void: if command != null: player.yaw = command.yaw player.pitch = command.pitch if command.is_pressed(PlayerCommand.BUTTON_JUMP): - leap(player, tick) + fire(player, tick, command.yaw_radians(), charge_for_pitch(command.pitch_radians())) return - player.position = barge_position(tick + 1) + player.position = ship_position(tick + 1) + + +## The end of the route: fires a player still aboard towards the middle of the island, +## with the charge that carries there. +func fire_at_end(player: SimEntity, tick: int) -> void: + var at: Vector3 = ship_position(tick) + var centre: Vector2 = Vector2(Tuning.WORLD_SIZE_METRES, Tuning.WORLD_SIZE_METRES) * 0.5 + var to: Vector2 = centre - Vector2(at.x, at.z) + fire(player, tick, atan2(to.x, to.y), aim_charge(to.length() * Tuning.MORTAR_FORCED_REACH)) ## Distance from `from` along unit `direction` to the square [margin, size - margin]. diff --git a/src/sim/match.gd b/src/sim/match.gd index 2beec06..07bd036 100644 --- a/src/sim/match.gd +++ b/src/sim/match.gd @@ -125,7 +125,7 @@ func in_match() -> bool: ## Adds a participant. Returns false if the handle is already here or the lobby is ## full. During a match they wait for the next one. func join(handle: int, bot: bool = false) -> bool: - # Once the barge has left, newcomers watch (see watch()) until the next lobby. + # Once the ship has left, newcomers watch (see watch()) until the next lobby. if in_match() or phase == RESULTS: return false if participants.has(handle) or watchers.has(handle) or participants.size() >= rules.max_players: @@ -239,7 +239,7 @@ func _enter(next: int) -> void: phase_ticks = 0 -## Fills empty places with bots, puts every participant on the barge and places loot. +## Fills empty places with bots, puts every participant on the ship and places loot. func _start() -> void: if rules.fill_with_bots: while participants.size() < rules.max_players: diff --git a/src/sim/match_rules.gd b/src/sim/match_rules.gd index a97e43f..3983ab8 100644 --- a/src/sim/match_rules.gd +++ b/src/sim/match_rules.gd @@ -31,7 +31,7 @@ static func immediate() -> MatchRules: return rules -## Rules for the tutorial (A12): one player alone, straight onto the barge, with a +## Rules for the tutorial (A12): one player alone, straight onto the ship, with a ## weapon to learn on, and no ending until the tide's own. static func tutorial() -> MatchRules: var rules: MatchRules = MatchRules.immediate() diff --git a/src/sim/movement.gd b/src/sim/movement.gd index 9f82130..700f26d 100644 --- a/src/sim/movement.gd +++ b/src/sim/movement.gd @@ -28,10 +28,10 @@ static func step(player: SimEntity, command: PlayerCommand, ground: SimGround, s wish = wish.limit_length(Tuning.DOWNED_CRAWL_SPEED) if player.drop_state == Drop.ABOARD: - # Riders move with the barge; Simulation places them. + # Riders move with the ship; Simulation places them. return if player.drop_state != Drop.NONE: - _fall_from_barge(player, command, ground, sea_level) + _fall_from_ship(player, command, ground, sea_level) return if player.swimming: @@ -268,15 +268,18 @@ static func _swim(player: SimEntity, command: PlayerCommand, ground: SimGround, 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: +## One tick of the drop after the mortar fires: the climb, freefall, then the gull-kite. +## While the shot is still climbing nothing steers it and the kite can't open. Then +## players steer with the move keys relative to where they look; jump opens the kite, +## and it opens by itself KITE_AUTO_DEPLOY_HEIGHT above the ground or water. Near the +## bottom the kite folds and ordinary falling (or the water) takes over, slow enough to +## do no damage. +static func _fall_from_ship(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 climbing: bool = player.drop_state == Drop.FREEFALL and player.velocity.y > 0.0 + if player.drop_state == Drop.FREEFALL and not climbing: var opens: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_JUMP) - if opens or player.position.y - below <= Tuning.WING_AUTO_DEPLOY_HEIGHT: + if opens or player.position.y - below <= Tuning.KITE_AUTO_DEPLOY_HEIGHT: player.drop_state = Drop.GLIDING var gliding: bool = player.drop_state == Drop.GLIDING @@ -290,9 +293,10 @@ static func _fall_from_barge(player: SimEntity, command: PlayerCommand, ground: 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 not climbing: + 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: diff --git a/src/sim/simulation.gd b/src/sim/simulation.gd index 7bcaf0c..b3a17d1 100644 --- a/src/sim/simulation.gd +++ b/src/sim/simulation.gd @@ -35,7 +35,7 @@ var tide: Tide = null var flood: Flood = null ## Every built piece. Their boxes are part of `ground`. var structures: StructureSet = StructureSet.new() -## The sky barge, from start_drop() on. Null in matches and tests that start on foot. +## The packet ship, from start_drop() on. Null in matches and tests that start on foot. var drop: Drop = null ## Floor loot, sea chests and crate contents. Empty until place_loot(). @@ -103,7 +103,7 @@ func add_player() -> int: Water.reset(player) Inventory.reset(player) if drop != null and not drop.finished: - Drop.board(player, drop.barge_position(tick)) + Drop.board(player, drop.ship_position(tick)) _players.append(player.id) _pending[player.id] = {} return player.id @@ -174,11 +174,11 @@ 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. +## Starts the match's drop: plans the ship'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)) + Drop.board(entities.find(player_id), drop.ship_position(tick)) ## Rolls the match's loot from the "loot" stream and puts the floor loot in the world. @@ -256,11 +256,11 @@ func step() -> void: _spill_broken_crates() _check_eliminations() 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. + # The end of the route: the mortar fires everyone still aboard inland. 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.fire_at_end(player, tick + 1) drop.finished = true tick += 1 diff --git a/src/sim/tuning.gd b/src/sim/tuning.gd index 44fa03c..cf7594f 100644 --- a/src/sim/tuning.gd +++ b/src/sim/tuning.gd @@ -145,29 +145,49 @@ const SWIM_SPRINT_STAMINA_COST: int = 3 const STAMINA_RECOVERY_RATE: int = 3 const BREATH_RECOVERY_RATE: int = 4 -# The drop, in metres and seconds. The sky barge crosses the island on a straight -# seeded route through a point within BARGE_CENTRE_JITTER of the middle. -const BARGE_ALTITUDE: float = 150.0 -const BARGE_SPEED: float = 24.0 +# The drop (#72), in metres and seconds. The packet ship sails a straight seeded line +# past the island, offshore, and players fire themselves inland by lifeline mortar. +## The deck the players ride on, above the starting sea level. +const SHIP_DECK_HEIGHT: float = 4.0 +const SHIP_SPEED: float = 16.0 ## The route starts and ends this far inside the world's edge. -const BARGE_ROUTE_MARGIN: float = 40.0 -const BARGE_CENTRE_JITTER: float = 140.0 -## Every route crosses at least this much dry land. -const BARGE_MIN_LAND_METRES: float = 250.0 -## Fraction of the barge's speed a leaping player keeps. -const LEAP_CARRY: float = 0.4 +const SHIP_ROUTE_MARGIN: float = 40.0 +## The route keeps this much open water between itself and the coast. The planner tries +## routes from SHIP_OFFSET_MIN to SHIP_OFFSET_MAX from the middle of the world, in +## SHIP_OFFSET_STEP steps, and takes the first that is clear, for up to SHIP_ROUTE_TRIES +## headings. Sea counts as open where the bottom is SHIP_DRAUGHT under the water. +const SHIP_COAST_CLEARANCE: float = 45.0 +const SHIP_DRAUGHT: float = 1.0 +const SHIP_OFFSET_MIN: float = 300.0 +const SHIP_OFFSET_MAX: float = 465.0 +const SHIP_OFFSET_STEP: float = 6.0 +const SHIP_CLEARANCE_STEP: float = 6.0 +const SHIP_ROUTE_TRIES: int = 32 +## A route shorter than this (one cutting a corner of the world) isn't used. +const SHIP_MIN_ROUTE_METRES: float = 420.0 +## The lifeline mortar: every shot climbs at MORTAR_RISE_SPEED; its speed over the +## ground runs from MORTAR_MIN_SPEED to MORTAR_MAX_SPEED with the charge, which comes +## from how high the player aims, from MORTAR_PITCH_LOW_DEGREES to ..._HIGH_DEGREES. +const MORTAR_RISE_SPEED: float = 75.0 +const MORTAR_MIN_SPEED: float = 16.0 +const MORTAR_MAX_SPEED: float = 110.0 +const MORTAR_PITCH_LOW_DEGREES: float = -10.0 +const MORTAR_PITCH_HIGH_DEGREES: float = 45.0 +## Riders fired at the end of the route are sent this fraction of the way to the middle +## of the island, so they land inland without all landing on one spot. +const MORTAR_FORCED_REACH: float = 0.8 const FREEFALL_MAX_SPEED: float = 32.0 -## Horizontal speed a falling player can steer to, before and after the sail opens. +## Horizontal speed a falling player can steer to, before and after the kite opens. const FREEFALL_STEER_SPEED: float = 9.0 const GLIDE_SPEED: float = 13.0 ## How fast horizontal speed changes while steering a fall, in metres per second squared. const DROP_STEER_ACCEL: float = 20.0 -## Sink rate under an open wing-sail, and how hard opening it brakes the fall. +## Sink rate under an open gull-kite, and how hard opening it brakes the fall. const GLIDE_FALL_SPEED: float = 5.5 const GLIDE_BRAKE: float = 60.0 -## The sail opens by itself this high above the ground or water. -const WING_AUTO_DEPLOY_HEIGHT: float = 40.0 -## Within this height of the ground or water, the sail folds and the player drops the rest. +## The kite opens by itself this high above the ground or water. +const KITE_AUTO_DEPLOY_HEIGHT: float = 40.0 +## Within this height of the ground or water, the kite folds and the player drops the rest. const DROP_LAND_HANDOFF: float = 1.0 # The island. Worldgen fills the whole world square; the island is about a kilometre @@ -319,7 +339,10 @@ const BOT_ENGAGE_METRES: float = 30.0 ## away from its opponent, and won't break off again until as long again has passed. const BOT_RETREAT_SECONDS: float = 6.0 const BOT_RETREAT_METRES: float = 30.0 -## A bot weighs this many landing spots near the barge's line and takes the one with +## A bot lands at a loot marker no further than this from the ship's line (#72: within +## the lifeline mortar's reach). +const BOT_LANDING_REACH_METRES: float = 600.0 +## A bot weighs this many landing spots near the ship's line and takes the one with ## the fewest other bots' landings within BOT_LANDING_SPREAD_METRES. const BOT_LANDING_CHOICES: int = 8 const BOT_LANDING_SPREAD_METRES: float = 60.0 @@ -608,7 +631,7 @@ const LOOT_SCATTER_METRES: float = 0.7 # Balance targets (H3), judged by `make balance` over bot-only matches; see docs/BALANCE.md. ## The pass needs at least this many matches. const BALANCE_MIN_MATCHES: int = 200 -## The median match, from the barge leaving to the last player standing, lasts this +## The median match, from the ship leaving to the last player standing, lasts this ## many minutes. const BALANCE_MEDIAN_MINUTES_MIN: float = 12.0 const BALANCE_MEDIAN_MINUTES_MAX: float = 18.0 diff --git a/test/app/test_tutorial.gd b/test/app/test_tutorial.gd index 1c5ad1b..31b3a52 100644 --- a/test/app/test_tutorial.gd +++ b/test/app/test_tutorial.gd @@ -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()) diff --git a/test/bots/balance_report.gd b/test/bots/balance_report.gd index 184638f..a281871 100644 --- a/test/bots/balance_report.gd +++ b/test/bots/balance_report.gd @@ -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 = [] diff --git a/test/bots/bot_batch.gd b/test/bots/bot_batch.gd index 1f4b469..8eccd25 100644 --- a/test/bots/bot_batch.gd +++ b/test/bots/bot_batch.gd @@ -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", diff --git a/test/bots/test_scripted_player.gd b/test/bots/test_scripted_player.gd index 5d4416b..fff3bc1 100644 --- a/test/bots/test_scripted_player.gd +++ b/test/bots/test_scripted_player.gd @@ -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 diff --git a/test/capture/client_scene.gd b/test/capture/client_scene.gd index b981472..32a58c0 100644 --- a/test/capture/client_scene.gd +++ b/test/capture/client_scene.gd @@ -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) diff --git a/test/capture/client_barge.tscn b/test/capture/client_ship.tscn similarity index 91% rename from test/capture/client_barge.tscn rename to test/capture/client_ship.tscn index 3ed9dc7..9e34b98 100644 --- a/test/capture/client_barge.tscn +++ b/test/capture/client_ship.tscn @@ -4,4 +4,4 @@ [node name="CaptureClient" type="Node3D"] script = ExtResource("1") -stage = "barge" +stage = "ship" diff --git a/test/capture/figure_scene.gd b/test/capture/figure_scene.gd index 8f3acb8..51aed24 100644 --- a/test/capture/figure_scene.gd +++ b/test/capture/figure_scene.gd @@ -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) diff --git a/test/capture/match_launch.tscn b/test/capture/match_launch.tscn new file mode 100644 index 0000000..47f401e --- /dev/null +++ b/test/capture/match_launch.tscn @@ -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" diff --git a/test/capture/match_scene.gd b/test/capture/match_scene.gd index fc88a05..39c29e8 100644 --- a/test/capture/match_scene.gd +++ b/test/capture/match_scene.gd @@ -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): diff --git a/test/capture/match_barge.tscn b/test/capture/match_ship.tscn similarity index 91% rename from test/capture/match_barge.tscn rename to test/capture/match_ship.tscn index afd1a59..0109e77 100644 --- a/test/capture/match_barge.tscn +++ b/test/capture/match_ship.tscn @@ -4,4 +4,4 @@ [node name="CaptureMatch" type="Node3D"] script = ExtResource("1") -stage = "barge" +stage = "ship" diff --git a/test/capture/vessels_scene.gd b/test/capture/vessels_scene.gd index 90a2c6e..61b8b15 100644 --- a/test/capture/vessels_scene.gd +++ b/test/capture/vessels_scene.gd @@ -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) diff --git a/test/client/test_client_session.gd b/test/client/test_client_session.gd index 86d687c..176a425 100644 --- a/test/client/test_client_session.gd +++ b/test/client/test_client_session.gd @@ -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") diff --git a/test/client/test_figure_rig.gd b/test/client/test_figure_rig.gd index e24b7b0..45d1be2 100644 --- a/test/client/test_figure_rig.gd +++ b/test/client/test_figure_rig.gd @@ -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) diff --git a/test/client/test_match_view.gd b/test/client/test_match_view.gd index cbeda9c..c3010ac 100644 --- a/test/client/test_match_view.gd +++ b/test/client/test_match_view.gd @@ -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() diff --git a/test/client/test_world_art.gd b/test/client/test_world_art.gd index 9d7139e..41ea158 100644 --- a/test/client/test_world_art.gd +++ b/test/client/test_world_art.gd @@ -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) diff --git a/test/net/test_client_prediction.gd b/test/net/test_client_prediction.gd index 2ca422c..5af03cb 100644 --- a/test/net/test_client_prediction.gd +++ b/test/net/test_client_prediction.gd @@ -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()) diff --git a/test/net/test_prediction_link.gd b/test/net/test_prediction_link.gd index 63c9335..aa7ebef 100644 --- a/test/net/test_prediction_link.gd +++ b/test/net/test_prediction_link.gd @@ -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) diff --git a/test/net/test_snapshot_stream.gd b/test/net/test_snapshot_stream.gd index 4ec2b7d..569a661 100644 --- a/test/net/test_snapshot_stream.gd +++ b/test/net/test_snapshot_stream.gd @@ -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)) diff --git a/test/server/test_client_game.gd b/test/server/test_client_game.gd index 83d307b..8ae1cac 100644 --- a/test/server/test_client_game.gd +++ b/test/server/test_client_game.gd @@ -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) diff --git a/test/server/test_hostile_client.gd b/test/server/test_hostile_client.gd index 68a1881..c913a75 100644 --- a/test/server/test_hostile_client.gd +++ b/test/server/test_hostile_client.gd @@ -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)) diff --git a/test/server/test_net_game.gd b/test/server/test_net_game.gd index 4497ede..23916c6 100644 --- a/test/server/test_net_game.gd +++ b/test/server/test_net_game.gd @@ -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: diff --git a/test/server/test_server_loop.gd b/test/server/test_server_loop.gd index 0b57da0..26a4e12 100644 --- a/test/server/test_server_loop.gd +++ b/test/server/test_server_loop.gd @@ -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: diff --git a/test/server/test_world_replication.gd b/test/server/test_world_replication.gd index 898fad4..17b81e5 100644 --- a/test/server/test_world_replication.gd +++ b/test/server/test_world_replication.gd @@ -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()) diff --git a/test/sim/test_drop.gd b/test/sim/test_drop.gd index e3eaa0f..355e929 100644 --- a/test/sim/test_drop.gd +++ b/test/sim/test_drop.gd @@ -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) diff --git a/test/sim/test_match.gd b/test/sim/test_match.gd index 897b870..897e739 100644 --- a/test/sim/test_match.gd +++ b/test/sim/test_match.gd @@ -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) diff --git a/tools/bench.sh b/tools/bench.sh index a72ab0c..8494480 100755 --- a/tools/bench.sh +++ b/tools/bench.sh @@ -3,7 +3,7 @@ # # Server: runs the headless server with 24 bots, unthrottled, for BENCH_TICKS ticks on # each of BENCH_SEEDS seeds, and reads its p50/p99/max tick time. -# Client: renders the moments of the match `make match` saved (whole island, barge, +# Client: renders the moments of the match `make match` saved (whole island, ship, # landed, a build, the final players) and a crowded pine forest in the capture # container, and reads each frame's draw calls, primitives, objects and memory. # @@ -48,7 +48,7 @@ if [[ "$client" == "1" ]]; then echo "bench: no saved match yet; playing one (make match)" >&2 tools/match.sh >/dev/null || { echo "bench FAIL: make match failed"; exit 1; } fi - for stage in match_lobby match_barge match_landed match_built match_final props_forest; do + for stage in match_lobby match_ship match_landed match_built match_final props_forest; do echo "bench: client, $stage" >&2 if ! report="$(tools/capture.sh "$stage" "captures/bench_$stage.png" 2>/dev/null)"; then echo "bench FAIL: the $stage capture failed" diff --git a/tools/match.sh b/tools/match.sh index 0fe8a93..c9c5666 100755 --- a/tools/match.sh +++ b/tools/match.sh @@ -4,12 +4,12 @@ # checks the replay ends in the same state. Prints one JSON line per event and the # verdict. See tools/match.gd. # -# tools/match.sh seed 29, where the scripted player also builds +# tools/match.sh seed 2, where the scripted player also builds # MATCH_SEED=7 tools/match.sh set -uo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." -seed="${MATCH_SEED:-29}" +seed="${MATCH_SEED:-2}" [[ "$seed" =~ ^[0-9]+$ ]] || { echo "match FAIL: bad MATCH_SEED '$seed'"; exit 2; } raw="$(timeout --signal=KILL 900 nice -n 15 tools/godot.sh --script res://tools/match.gd -- --seed="$seed" 2>&1)" code=$? diff --git a/tools/match_captures.sh b/tools/match_captures.sh index cb67875..bb8679a 100755 --- a/tools/match_captures.sh +++ b/tools/match_captures.sh @@ -10,11 +10,11 @@ if [[ ! -f build/match/match.tclog ]]; then exit 1 fi status=0 -for stage in lobby barge glide landed built final tide results; do +for stage in lobby ship launch glide landed built final tide results; do if ! tools/capture.sh "match_$stage" "captures/match_$stage.png"; then echo "match-captures FAIL: stage $stage" status=1 fi done -[[ "$status" -eq 0 ]] && echo "match-captures: ok (8 stages in captures/match_*.png)" +[[ "$status" -eq 0 ]] && echo "match-captures: ok (9 stages in captures/match_*.png)" exit "$status" diff --git a/tools/models/figure.py b/tools/models/figure.py index 44dd830..319c444 100644 --- a/tools/models/figure.py +++ b/tools/models/figure.py @@ -3,7 +3,7 @@ blender --background --factory-startup --python tools/models/figure.py A low-poly islander in an oilskin coat and a sou'wester, with sea boots, a rolled -bedding bundle on the back and a canvas wing-sail for the glide. Writes: +bedding bundle on the back and a gull-kite for the glide. Writes: assets/models/figure/.obj one model per moving part, with .mtl assets/models/figure/figure.json the joints, which part hangs from which, and @@ -47,7 +47,7 @@ JOINTS = { "hip_l": (0.11, 0.90, 0.0), "knee_r": (-0.11, 0.49, 0.0), "knee_l": (0.11, 0.49, 0.0), - "sail": (0.0, 1.46, -0.2), + "kite": (0.0, 1.46, -0.2), } # Part -> (the joint it turns about, the joint it hangs from or None for the root). PARTS = { @@ -62,7 +62,7 @@ PARTS = { "thigh_l": ("hip_l", "hips"), "shin_r": ("knee_r", "hip_r"), "shin_l": ("knee_l", "hip_l"), - "sail": ("sail", None), + "kite": ("kite", None), } # Where the right hand closes on a grip, and the left on a support, in Godot axes. HAND_R = (-0.24, 0.86, 0.03) @@ -165,26 +165,67 @@ def shin(side): items.box((0.13, 0.25, 0.08), b(x, 0.04, 0.05), "TAR_WEATHERED", bevel=0.02) -def sail(): - # A canvas wing on two spars, swept back and bowed up at the tips, hung from a - # yoke over the shoulders. +def kite(): + # A gull-kite: a gull's wings in sailcloth on spars, the inner half of each wing + # raised and the outer half drooping, as a gull holds them on the wind, with tarred + # tips, an ochre leading edge and a short fanned tail, hung from a yoke over the + # shoulders. + base = 2.06 for side in (-1.0, 1.0): - bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(side * 0.66, 2.06, -0.08)) + # Inner wing: from the body out to the bend, raised 20 degrees. + inner_up = math.radians(20) + inner_len = 0.82 + ix = side * (0.06 + inner_len * 0.5 * math.cos(inner_up)) + iy = base + inner_len * 0.5 * math.sin(inner_up) + bend_x = side * (0.06 + inner_len * math.cos(inner_up)) + bend_y = base + inner_len * math.sin(inner_up) + rot_in = (math.radians(3), side * -inner_up, side * math.radians(6)) + bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(ix, iy, -0.06)) panel = bpy.context.active_object - panel.scale = (1.3, 0.85, 0.012) - panel.rotation_euler = (math.radians(4), math.radians(side * -9), math.radians(side * 12)) - items.finish(panel, "CANVAS") - bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(side * 0.62, 2.065, -0.1)) - band = bpy.context.active_object - band.scale = (1.2, 0.12, 0.016) - band.rotation_euler = (math.radians(4), math.radians(side * -9), math.radians(side * 12)) - items.finish(band, "OCHRE_RED") - items.tube(0.02, 1.36, b(side * 0.66, 2.1, 0.33), "PLANK", axis="X", sides=6, - rot_extra=(0.0, math.radians(side * -9), math.radians(side * 12))) - # The lines from the wing down to the yoke. - items.tube(0.007, 0.62, b(side * 0.3, 1.78, -0.12), "TAR", axis="Z", sides=4, - rot_extra=(0.0, math.radians(side * 30), 0.0)) - items.tube(0.024, 0.95, b(0.0, 2.08, -0.1), "PLANK", axis="Y", sides=6) + panel.scale = (inner_len, 0.78, 0.012) + panel.rotation_euler = rot_in + items.finish(panel, "SALT") + # Outer wing: from the bend to the tip, drooping 16 degrees and swept back. + outer_down = math.radians(16) + outer_len = 0.78 + ox = bend_x + side * outer_len * 0.5 * math.cos(outer_down) + oy = bend_y - outer_len * 0.5 * math.sin(outer_down) + rot_out = (math.radians(3), side * outer_down, side * math.radians(16)) + bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(ox, oy, -0.16)) + panel = bpy.context.active_object + panel.scale = (outer_len, 0.56, 0.012) + panel.rotation_euler = rot_out + items.finish(panel, "SALT") + # Tarred wingtip, like a gull's black primaries. + tx = bend_x + side * outer_len * 0.92 * math.cos(outer_down) + ty = bend_y - outer_len * 0.92 * math.sin(outer_down) + bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(tx, ty + 0.004, -0.24)) + tip = bpy.context.active_object + tip.scale = (0.2, 0.44, 0.016) + tip.rotation_euler = rot_out + items.finish(tip, "TAR") + # Ochre leading edges on both halves. + for (cx, cy, z, length, rot) in ((ix, iy, 0.3, inner_len, rot_in), (ox, oy, 0.1, outer_len, rot_out)): + bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(cx, cy + 0.006, z)) + band = bpy.context.active_object + band.scale = (length, 0.1, 0.018) + band.rotation_euler = rot + items.finish(band, "OCHRE_RED") + # Spars along each half, and the bridle lines down to the yoke. + items.tube(0.02, inner_len, b(ix, iy + 0.02, 0.28), "PLANK", axis="X", sides=6, + rot_extra=(0.0, side * -inner_up, side * math.radians(6))) + items.tube(0.018, outer_len, b(ox, oy + 0.02, 0.08), "PLANK", axis="X", sides=6, + rot_extra=(0.0, side * outer_down, side * math.radians(16))) + items.tube(0.007, 0.66, b(side * 0.32, 1.80, -0.12), "TAR", axis="Z", sides=4, + rot_extra=(0.0, math.radians(side * 32), 0.0)) + items.tube(0.007, 0.80, b(side * 0.5, 1.84, -0.12), "TAR", axis="Z", sides=4, + rot_extra=(0.0, math.radians(side * 48), 0.0)) + # The body: a spindle of canvas down the middle, and a fanned tail behind it. + items.tube(0.07, 0.9, b(0.0, base + 0.02, -0.08), "CANVAS", axis="Y", sides=8, radius2=0.03) + bpy.ops.mesh.primitive_cube_add(size=1.0, location=b(0.0, base, -0.68)) + tail = bpy.context.active_object + tail.scale = (0.42, 0.3, 0.012) + items.finish(tail, "SALT") items.box((0.36, 0.05, 0.05), b(0.0, 1.5, -0.2), "PLANK", bevel=0.008) @@ -200,7 +241,7 @@ BUILDERS = { "thigh_l": lambda: thigh(1.0), "shin_r": lambda: shin(-1.0), "shin_l": lambda: shin(1.0), - "sail": sail, + "kite": kite, } diff --git a/tools/provenance.gd b/tools/provenance.gd index 0cf74ee..fd1d037 100644 --- a/tools/provenance.gd +++ b/tools/provenance.gd @@ -29,7 +29,7 @@ is sampled, recorded, downloaded or taken from a third party. How each kind of a made is described in [assets/PROVENANCE.md](../assets/PROVENANCE.md); the licence is CC BY-SA 4.0 ([LICENSE-ASSETS](../LICENSE-ASSETS)). -Code-built art (terrain, sea, points of interest, props, build pieces, the barge, sea +Code-built art (terrain, sea, points of interest, props, build pieces, the ship, sea chests and effects) isn't a file here: it's drawn by the scripts under `src/client/`. This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and diff --git a/tools/tutorial_check.gd b/tools/tutorial_check.gd index 1305f8e..b73e9e6 100644 --- a/tools/tutorial_check.gd +++ b/tools/tutorial_check.gd @@ -39,7 +39,7 @@ func _init() -> void: for problem: String in problems: print("tutorial-check FAIL: %s" % problem) if problems.is_empty(): - print("tutorial-check: ok (%d seeds played from the barge to the end)" % seeds) + print("tutorial-check: ok (%d seeds played from the ship to the end)" % seeds) quit(0 if problems.is_empty() else 1)