7 Commits
Author SHA1 Message Date
claudeandClaude Opus 5.5 557a3e1f11 Devlog: #72
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:50:06 -05:00
claudeandClaude Opus 5.5 aa797580a7 #72: The packet ship, the lifeline mortar and the gull-kite
Eric chose option B on #72. The drop is now the GDD's launch:

- A packet ship sails a seeded straight line past the island, offshore,
  as close in as it can while keeping 45 m of open water from any land
  (eight-way probes; up to 32 headings, then the four world sides).
- Jump fires the lifeline mortar along the look heading. How high the
  player aims sets the charge (-10 to 45 degrees: 16 to 110 m/s over
  the ground; every shot climbs at 75 m/s). The climb can't be steered
  and the kite can't open until the arc tops out. Riders still aboard at
  the end are fired towards the middle of the island.
- Drop.reach() mirrors the fall for both ways down (kite at the top, or
  a fall with the kite opening by itself); bots, the soak and autoplay
  clients and the tutorial pilot aim with Drop.aim_charge().
- Bots fire at their landing spot once abeam of it, when in easy reach
  at their own staggered moment, or just before the route ends, and open
  the kite early only when the spot is beyond the rest of a fall.
- Art: VesselModels.ship() (two-masted packet, tanned square sails, a
  salt-white boot-top, a bowsprit and the mortar on its bed, mirrored to
  face the island), the figure's gull-kite (figure.py), and a lifeline
  cord from the muzzle to each player still climbing.
- Renamed barge to ship and wing-sail to gull-kite throughout code,
  tests, captures, docs and the tutorial text. make match now defaults to
  seed 2, where the scripted player still harvests and builds.

Closes #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:49:21 -05:00
claudeandClaude Opus 5.5 4357861bd4 Devlog: A13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:54:14 -05:00
claudeandClaude Opus 5.5 8142e39ab3 A13: Gamepad and accessibility
Gamepad: PadInput reads pad events in one fixed layout (sticks move and
look, triggers aim and fire, bumpers step slots and build pieces, Start
pauses), fed through ClientInput alongside the keys and mouse. Menus take
South to choose and East or Start to go back. The tutorial names pad
buttons once the pad is used.

Aim assist (option, on by default, pad only): friction across an
opponent in plain sight near the look, and a pull of at most 9 deg/s
while aiming. Client look only; never through cover.

Accessibility (new Access tab): colour-vision sets for the signal colours
(red-green, blue-yellow), checked by simulated colour vision in
test_palette; interface size 90-130%, with the HUD hotbar refitting at the
larger sizes; captions for key sounds with direction; reduce motion
(calmer aim zoom and hurt flash).

Tests for the pad, aim assist, captions, palettes, settings, the menus
driven from a pad, and a pad playing through a real offline session.
make access-captures renders the new screens and options.

Closes #53

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:53:30 -05:00
claudeandClaude Opus 5.5 dbe1ef923a Devlog: A12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 05:48:07 -05:00
claudeandClaude Opus 5.5 b604ced923 A12: Tutorial
A short, skippable tutorial on an island of your own: leave the barge, glide
down, walk and jump, cut materials with the boathook, place a wall, aim and
fire, and get above the line the tide will reach after its next rise.

- MatchRules.tutorial(): one player, no bots, last_team_wins off (alone is
  not a win, only the tide or a fall ends it) and starting_kit (a dock
  carbine with a full magazine and 60 cartridges, Tuning.TUTORIAL_KIT).
  Both rules go in command logs; older logs read with the defaults.
- Tutorial watches the client's own view (predicted player, world copy,
  FX) and moves on when each step is done. Instructions name the player's
  own key bindings. TutorialCard shows it under the minimap.
- TutorialPilot plays it through ClientInput for --tutorial --autoplay,
  the tests and make tutorial-check (12 seeds, all finish).
- First launch offers it (welcome screen, remembered in settings); it is
  always on the main menu; Leave in the pause menu skips it. Finishing is
  saved. --tutorial on the command line.
- make tutorial-captures; PLAY.md, the man page, ARCHITECTURE.md and
  CLAUDE.md updated.

Closes #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 05:47:31 -05:00
claudeandClaude Opus 5.5 4ea170175d Devlog: M7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 03:02:06 -05:00
123 changed files with 4715 additions and 900 deletions
+6 -3
View File
@@ -35,21 +35,24 @@ 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 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 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 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_<stage>.png`), about 3 minutes. Needs Docker. Look at them. | | `make match-captures` | Renders eight stages of that match from its command log (`captures/match_<stage>.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. | | `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`. | | `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 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). | | `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). |
| `tools/godot.sh -- --list-server [--port=N]` | Runs a list server (default UDP port 24660). Game servers started with `--listen --list=HOST[:PORT] --name=NAME` register with it; see `src/server/list_server.gd`. | | `tools/godot.sh -- --list-server [--port=N]` | Runs a list server (default UDP port 24660). Game servers started with `--listen --list=HOST[:PORT] --name=NAME` register with it; see `src/server/list_server.gd`. |
| `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. | | `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 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 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_<stage>.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_<stage>.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 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 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 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 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). | | `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 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`. | | `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`. |
+20 -4
View File
@@ -1,7 +1,7 @@
# Tidewall build entry points. Everything runs headless with the repo-local engine. # Tidewall build entry points. Everything runs headless with the repo-local engine.
GODOT := tools/godot.sh GODOT := tools/godot.sh
.PHONY: qa-captures effects-captures app-icon deb deb-check bench dist dist-check build-captures poi-captures art figure figure-captures sea-captures models item-captures audio audio-check check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine balance bot-matches duo-matches bot-builds match match-captures client-check client-captures hud-captures style-captures menu-captures chart-captures discovery-check fuzz stability soak soak-selfcheck server-package-check .PHONY: access-captures tutorial-check tutorial-captures qa-captures effects-captures app-icon deb deb-check bench dist dist-check build-captures poi-captures art figure figure-captures sea-captures models item-captures audio audio-check check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine balance bot-matches duo-matches bot-builds match match-captures client-check client-captures hud-captures style-captures menu-captures chart-captures discovery-check fuzz stability soak soak-selfcheck server-package-check
## A8: regenerates every sound in assets/audio/ from tools/audio/ (about 6 s). ## A8: regenerates every sound in assets/audio/ from tools/audio/ (about 6 s).
audio: import audio: import
@@ -139,6 +139,16 @@ match: import
match-captures: import match-captures: import
@tools/match_captures.sh @tools/match_captures.sh
## 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}
## A12: the tutorial's card at three steps, and the welcome that offers it
## (captures/tutorial_*.png, menu_welcome.png, about 2 min). Needs Docker. Look at them.
tutorial-captures: import
@for scene in tutorial_move tutorial_build tutorial_tide menu_welcome; do tools/capture.sh $$scene captures/$$scene.png; done
## Joins a real client process to a real server process over loopback UDP and checks ## Joins a real client process to a real server process over loopback UDP and checks
## it gets from the lobby into the match. About a minute, in real time. ## it gets from the lobby into the match. About a minute, in real time.
client-check: import client-check: import
@@ -154,9 +164,9 @@ fuzz: import
discovery-check: import discovery-check: import
@tools/discovery_check.sh @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 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. ## A9: the HUD at 1280x720 and at 3840x2160 (captures/hud_*.png). Needs Docker.
hud-captures: import hud-captures: import
@@ -165,9 +175,15 @@ hud-captures: import
@CAPTURE_SIZE=1280x720 tools/capture.sh client_hud_downed captures/hud_downed_720.png @CAPTURE_SIZE=1280x720 tools/capture.sh client_hud_downed captures/hud_downed_720.png
@CAPTURE_SIZE=3840x2160 tools/capture.sh client_hud captures/hud_2160.png @CAPTURE_SIZE=3840x2160 tools/capture.sh client_hud captures/hud_2160.png
## A13: the Gamepad and Access settings, the menus and HUD at 130%, the build ghost in
## the red-green 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.
access-captures: import
@for scene in menu_settings_gamepad menu_settings_access menu_main_large menu_settings_large client_build_red_green client_build_refused_red_green client_hud_captions client_hud_large camera_aim camera_aim_calm; do CAPTURE_SIZE=1280x720 tools/capture.sh $$scene captures/access_$$scene.png; done
## A10: every menu screen (captures/menu_*.png, about 5 min). Needs Docker. Look at them. ## A10: every menu screen (captures/menu_*.png, about 5 min). Needs Docker. Look at them.
menu-captures: import menu-captures: import
@for scene in menu_main menu_practice menu_join menu_settings menu_settings_mouse menu_pause menu_results; do tools/capture.sh $$scene captures/$$scene.png; done @for scene in menu_welcome menu_main menu_practice menu_join menu_settings menu_settings_mouse menu_pause menu_results; do tools/capture.sh $$scene captures/$$scene.png; done
## A11: the chart and minimap with the first tide forecast, and after it has risen ## A11: the chart and minimap with the first tide forecast, and after it has risen
## (captures/chart_*.png, about 2 min). Needs Docker. Look at them. ## (captures/chart_*.png, about 2 min). Needs Docker. Look at them.
+1 -1
View File
@@ -30,7 +30,7 @@ All of this is checked headless or with **software rendering in a container**. N
- **The 1.0.0 packages are solo only.** Duos with downs and revives ([#30](https://gitea.eom.dev/claude/tidewall/issues/30)) are on `main` since 1.0.0 was tagged: `--team-size=2` on a server, `--duos` or the Practice menu's Crew offline. Bots play as teammates and revive, but don't otherwise stick together. - **The 1.0.0 packages are solo only.** Duos with downs and revives ([#30](https://gitea.eom.dev/claude/tidewall/issues/30)) are on `main` since 1.0.0 was tagged: `--team-size=2` on a server, `--duos` or the Practice menu's Crew offline. Bots play as teammates and revive, but don't otherwise stick together.
- Bots carry powder kegs but don't throw them ([#83](https://gitea.eom.dev/claude/tidewall/issues/83)). - Bots carry powder kegs but don't throw them ([#83](https://gitea.eom.dev/claude/tidewall/issues/83)).
- Most bots fall early in a match ([#74](https://gitea.eom.dev/claude/tidewall/issues/74)). Bots build on `main` since 1.0.0 was tagged ([#29](https://gitea.eom.dev/claude/tidewall/issues/29)), but only cover walls, ramps and a last-stand ring of breakwaters, not forts. The 1.0.0 packages have bots that don't build. - Most bots fall early in a match ([#74](https://gitea.eom.dev/claude/tidewall/issues/74)). Bots build on `main` since 1.0.0 was tagged ([#29](https://gitea.eom.dev/claude/tidewall/issues/29)), but only cover walls, ramps and a last-stand ring of breakwaters, not forts. The 1.0.0 packages have bots that don't build.
- **No gamepad support or tutorial** ([#53](https://gitea.eom.dev/claude/tidewall/issues/53), [#52](https://gitea.eom.dev/claude/tidewall/issues/52)). No character customization ([#43](https://gitea.eom.dev/claude/tidewall/issues/43)) or editing of placed pieces ([#18](https://gitea.eom.dev/claude/tidewall/issues/18)). - **The 1.0.0 packages have no gamepad support, accessibility options or tutorial.** All three are on `main` since 1.0.0 was tagged ([#53](https://gitea.eom.dev/claude/tidewall/issues/53), [#52](https://gitea.eom.dev/claude/tidewall/issues/52)); the gamepad has only been tested with simulated input. No character customization ([#43](https://gitea.eom.dev/claude/tidewall/issues/43)) or editing of placed pieces ([#18](https://gitea.eom.dev/claude/tidewall/issues/18)).
- **The Join menu only searches the LAN** ([#82](https://gitea.eom.dev/claude/tidewall/issues/82)). List servers work from the command line (`--browse --list=...`); in the menu, join other servers by address. - **The Join menu only searches the LAN** ([#82](https://gitea.eom.dev/claude/tidewall/issues/82)). List servers work from the command line (`--browse --list=...`); in the menu, join other servers by address.
- Under OpenGL (the fallback when Vulkan can't start) the sun casts no shadows, because that renderer drew them with washed-out colours ([#81](https://gitea.eom.dev/claude/tidewall/issues/81)). - Under OpenGL (the fallback when Vulkan can't start) the sun casts no shadows, because that renderer drew them with washed-out colours ([#81](https://gitea.eom.dev/claude/tidewall/issues/81)).
- One network soak saw a single transient world-hash mismatch that hasn't been reproduced since ([#80](https://gitea.eom.dev/claude/tidewall/issues/80)). - One network soak saw a single transient world-hash mismatch that hasn't been reproduced since ([#80](https://gitea.eom.dev/claude/tidewall/issues/80)).
+10 -10
View File
@@ -37,6 +37,11 @@
0.92, 0.92,
0.0 0.0
], ],
"kite": [
0.0,
1.46,
-0.2
],
"knee_l": [ "knee_l": [
0.11, 0.11,
0.49, 0.49,
@@ -52,11 +57,6 @@
1.5, 1.5,
0.0 0.0
], ],
"sail": [
0.0,
1.46,
-0.2
],
"shoulder_l": [ "shoulder_l": [
0.225, 0.225,
1.42, 1.42,
@@ -86,12 +86,12 @@
"joint": "neck", "joint": "neck",
"parent": "waist" "parent": "waist"
}, },
"pelvis": { "kite": {
"joint": "hips", "joint": "kite",
"parent": null "parent": null
}, },
"sail": { "pelvis": {
"joint": "sail", "joint": "hips",
"parent": null "parent": null
}, },
"shin_l": { "shin_l": {
@@ -123,5 +123,5 @@
"parent": "waist" "parent": "waist"
} }
}, },
"triangles_before_bevel": 1484 "triangles_before_bevel": 1640
} }
@@ -31,6 +31,16 @@ Ni 1.500000
d 1.000000 d 1.000000
illum 2 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 newmtl TAR
Ns 39.999996 Ns 39.999996
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
+764
View File
@@ -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
+25
View File
@@ -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
-403
View File
@@ -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
-25
View File
@@ -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
+18 -9
View File
@@ -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 **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, 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 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 during results, becomes a watcher (`Match.watch()`): they spectate a living player
(the winner during results) through the same snapshots an eliminated player gets, (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 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 `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 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 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 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 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, `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 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`. 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 `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 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 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 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. 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 the generated art described in assets/PROVENANCE.md; `test_world_art` fails on any
primitive stand-in mesh. 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 `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 `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 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 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 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 drawing code. Captures and tests still point a `MatchView` straight at a server's
@@ -523,8 +523,17 @@ game starts an offline match, or joins a server with `--connect`. Without a wind
(`tools/godot.sh` is always headless) a mode has to be asked for. `--autoplay` puts a (`tools/godot.sh` is always headless) a mode has to be asked for. `--autoplay` puts a
small script at the controls and `--client-seconds=N` quits after N seconds with one small script at the controls and `--client-seconds=N` quits after N seconds with one
JSON line saying how far the client got, which is what `make client-check` reads. JSON line saying how far the client got, which is what `make client-check` reads.
There are no menus yet (N6, A10) and no HUD (A9): one line of text says when the With a window and no mode, `AppShell` opens the menus (A10) and the HUD (A9) draws
client is connecting, in the lobby or watching. over each match.
The tutorial (A12, `--tutorial` or the menus) is an ordinary offline match under
`MatchRules.tutorial()`: one player, no bots, `last_team_wins` off so being alone
isn't a win, and `starting_kit` putting `Tuning.TUTORIAL_KIT` in hand. The server
rules are the only change to the game; the lesson itself is client-side. `Tutorial`
watches what the client already has (its predicted player, its copy of the world and
the FX it is sent) and moves on when each step is done; `TutorialCard` shows it on the
HUD with the player's own key names; `TutorialPilot` plays it through `ClientInput`
for `--autoplay`, the tests and `make tutorial-check`.
## Performance budgets ## Performance budgets
@@ -550,7 +559,7 @@ budget:
The max includes one long tick per match: unthrottled, the 15 s results screen passes 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 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. 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 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, 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). primitives, objects, nodes and memory (`tools/capture.gd`'s `render` field).
@@ -622,7 +631,7 @@ model and tier. The hotbar shows the icons.
## Player figure (A2) ## Player figure (A2)
`tools/models/figure.py` builds the islander in headless Blender as twelve rigid `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 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 joints and hand points (`make art` rebuilds these and the items). OBJ has no
skeleton, so the figure is jointed rather than skinned. skeleton, so the figure is jointed rather than skinned.
+3 -3
View File
@@ -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 made is described in [assets/PROVENANCE.md](../assets/PROVENANCE.md); the licence is
CC BY-SA 4.0 ([LICENSE-ASSETS](../LICENSE-ASSETS)). 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/`. 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 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/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.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/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.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/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.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_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. | | `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. |
+244
View File
@@ -1622,3 +1622,247 @@ control group.
1. If the release has its binaries, verify them and close R5. 1. If the release has its binaries, verify them and close R5.
2. Otherwise M7 (#30), duos and revive, the last open issue in v0.4. 2. Otherwise M7 (#30), duos and revive, the last open issue in v0.4.
3. Then A12 and A13, tutorial and gamepad (#52, #53). 3. Then A12 and A13, tutorial and gamepad (#52, #53).
## 2026-11-15 (early morning): M7, duos and revive
The v1.0.0 release is still a draft with no binaries, so R5 still waits on Eric. This
run took M7 (#30), the last open issue in v0.4. Its commit, 2167900, is on `main` after
the v1.0.0 tag, so the 1.0.0 packages are still solo only. v0.4 is closed and tagged
`v0.4.0`.
**The design.** Teams live in the simulation, not just in `Match`, so the server
enforces them and a replay reproduces them.
- **Teams:** `SimEntity.team` is set by `Match`. `Weapons.damage_player` is the single
friendly-fire rule, and every weapon, the boathook and blasts go through it.
- **Down:** if your health runs out while a teammate is standing, you go down instead of
out. You have 60 health to bleed, one point every 15 ticks, and you crawl at 1 m/s.
- **Revive:** a standing teammate within 2 m holds interact for 6 s and you get up with
30 health. Reviving takes the reviver's turn, so they can't loot or fire meanwhile.
- **Out:** you're out when your health runs out again, or when no teammate is standing.
The credit goes to whoever downed you.
- **Same tick:** both teammates reaching 0 health on one tick are both out, since
neither counts as standing for the other.
- **Wire:** a `FLAG_DOWNED` bit. Player flags went from u8 to u16, in the record and in
the own block (SELF_BYTES is now 38). Protocol version 5.
- **Options:** `--team-size=2` on the server, `--duos` offline, and Practice → Crew.
**Bots.** The first bot duos run had 36 downs and 0 revives in 3 matches. Teammates
landed far apart.
- **Landing:** teammates now land at the same marker (`BotWorld.team_landings`), and
regroup once they're more than 30 m apart.
- **Second change:** that gave 2 revives in 3 matches. Tracing the downs showed most
were finished by their attacker while the teammate looted or retreated.
- **Retargeting:** a bot whose target is down now turns to the target's standing
teammate when it's in view. On seeds 4 and 5 that raised revives from 2 to 7.
- **Final batch:** `make duo-matches`, 10 matches, had 128 downs and 15 revives.
**Gates on 2167900:**
- `make check`: 732 tests, smoke ok.
- `make match`: ok.
- `make client-check`: ok.
- `make duo-matches`: ok. 10 matches, each won by one team, 3.6% drowned, worst p99
tick 3.5 ms.
- `make bot-matches`: ok. 3.9% drowned, the same as the last run, so solo bots didn't
change.
**Captures (software rendering), looked at:**
- `hud_downed_720`: the red down line above the hotbar, and the downs in the feed.
- `figure_states`: a new last figure in the crawl pose, hands and knees on the ground
and nothing in hand. The first render had the boathook still in its hand.
`EntityView._hold` now hides it for downed players.
**Follow-ups:**
- L6 (#87): revive progress and a crewmate marker.
- The revive rate goes on H10 (#74).
- Nobody has played duos with a person in the team. That's part of R6.
**Next run:**
1. If the release has its binaries, verify them and close R5.
2. Otherwise A12, the tutorial (#52).
3. Then A13, gamepad and accessibility (#53).
## 2026-11-15 (morning): A12, the tutorial
The v1.0.0 release is still a draft with no binaries, so R5 still waits on Eric. This
run took A12 (#52). Commit b604ced is on `main` after the v1.0.0 tag, like M7.
**The design.** The tutorial is an ordinary offline match. Only the server's rules
change; the lesson itself lives on the client.
- **Rules:** `MatchRules.tutorial()` is one player and no bots. `last_team_wins` is
off, so a player alone isn't the winner at once; only the tide, or nobody left
standing, ends it. `starting_kit` gives `Tuning.TUTORIAL_KIT`: a dock carbine with a
full magazine and 60 cartridges.
- **Command logs:** both new rules are recorded. Logs without them read with the
defaults (`OPTIONAL_RULE_KEYS`), so older logs still load.
- **Steps:** `Tutorial` (src/app) watches the predicted player, the world copy and the
FX. The steps are leap, glide, walk 12 m and jump, gather 15 with enough for a wall,
place a piece (a PLACE FX), hit something with a weapon (an IMPACT FX), and open the
chart then stand 1 m above the tide line after next for 2 s.
- **Card:** `TutorialCard` sits under the minimap. Every instruction names the
player's own bindings.
- **Pilot:** `TutorialPilot` plays the tutorial through `ClientInput`, setting the held
keys and actions and where it looks. It pauses half a second in build mode before
placing, as a person would; without that pause, the build capture caught the moment
after placing.
- **Menus:** a new `welcome` screen on first launch (until answered, saved as
`tutorial.offered`), a Tutorial button on the main menu, and `tutorial.done` saved
on finishing. `--tutorial` works on the command line.
**Tests:**
- `make check`: 745 tests, smoke ok. `test_menus` now opens with the tutorial already
offered, and its focus-order test includes the new button.
- `make tutorial-check` (new): 12 of 12 seeds finish, in 23–32 s of game time each.
- `tidewall --tutorial --autoplay --seed=7 --client-seconds=75`, in real time: done,
0 corrections.
- `make match`: ok, and the replay hash matches.
**Captures (software rendering), looked at:**
- `tutorial_move`, `tutorial_build` and `tutorial_tide`: the card under the minimap,
readable, with the step counter and progress line.
- `menu_welcome`: the offer, with both buttons and the focus ring on Start.
**Notes:**
- Most seeds land the player well above the line, so the tide step is mostly about
opening the chart and reading the numbers.
- The wording follows the code's "barge" and "sail". #72 (the launch fiction) may
change it.
**Next run:**
1. If the release has its binaries, verify them and close R5.
2. Otherwise A13, gamepad and accessibility (#53). It's the last workable issue in a
build milestone apart from the priority/low ones and #80, which is open until it
reproduces.
3. Then the Finishing steps: README status, comments on R6 and R7, and disable the
task.
## 2026-11-15 (late morning): A13, gamepad and accessibility
The v1.0.0 release is still a draft with no binaries, so R5 still waits on Eric. This
run took A13 (#53), the last workable issue in a build milestone that isn't
priority/low. It is on `main` after the v1.0.0 tag, like M7 and A12.
**Gamepad.**
- `PadInput` reads pad events as the session is given them, not the Input singleton,
so tests drive it with simulated events and any pad works. One fixed layout, named by
position (South, East...): sticks move and look, triggers aim and fire, bumpers step
through slots or build pieces, clicking the left stick sprints until you stop, the
right stick toggles build mode, the D-pad does chart, drop and material, Start pauses.
- `ClientInput.poll(delta)` adds the left stick to the keys and turns the look by the
right stick (dead zone, response curve, its own speed setting; aim speed and invert
shared with the mouse). `pad.active` says the pad was used last, so the tutorial
names pad buttons.
- Menus: South chooses, East and Start go back (`PadInput.install_menu_actions()`),
the D-pad and left stick already move focus. East leaves a key rebinding. Start in
play opens the pause menu, and in the pause menu closes it.
- Finding: sliders and tab bars follow a pad only through Input's state, so the menu
tests feed events with `Input.parse_input_event`, the path a real pad takes.
`Viewport.push_input` moved the focus but didn't move a slider or change a tab.
**Aim assist** (`AimAssist`, on by default, a Gamepad tab option): friction (the stick
turns at 45% at an opponent's centre) and, while aiming and moving, a pull of at most
9°/s towards the chest of an opponent within 6° of the look, 90 m, with a clear line by
the world's own raycast. Never for the mouse, never through cover, and it only turns
the client's look, so the server's judgement is unchanged.
**Accessibility** (a new Access tab):
- Colour vision: `Palette.VISION_SIGNALS`, three sets of the four signal colours, read
through `Palette.ghost_ok()`, `ghost_refused()`, `warning()` and `own()`.
`test_palette` simulates protan, deutan and tritan vision (Machado 2009) and requires
each set's pairs at least 0.25 apart in Oklab. The standard ghost is only 0.18 apart
for deutan eyes; the red-green set makes it 0.37.
- Interface size: 90–130%, through the root viewport's `content_scale_factor`. At 130%
the HUD's hotbar collided with the health panel, so `Hud._fit_bottom()` now places it
between the side panels and narrows the slots when needed.
- Captions: `Captions` turns SoundDirector's cues into lines with a direction (the
tide's sounds, gunfire, hits, kegs, footsteps within 20 m, building), skipping the
player's own, refreshing repeats, fading after 3 s.
- Reduce motion: there is no camera shake, so it calms the aim zoom (62° not 48°, eased
over 0.3 s) and the hurt flash (35%).
**Tests:** new `test_pad_input` (10), `test_aim_assist` (5), `test_captions` (7), and
additions to `test_palette`, `test_game_settings`, `test_hud`, `test_menus` and
`test_client_session` (a pad walks the landed player, picks a slot and pauses through a
real offline session).
**Captures (software rendering), looked at:** `make access-captures`. The Gamepad tab's
layout first filled the whole panel, so it became a two-column grid in a scroll
container. The HUD captions capture first showed nothing (no sound near the player in
the staged second), so the scenario now plays on until something is heard: "Gunfire,
behind" and "Shot strikes someone, behind". Blue/orange ghost in the red-green set; the
aim view visibly wider with reduce motion; menus and HUD at 130% fit.
**Not verified:** no physical gamepad has been tried; aim assist strength is untuned by
play. Both belong to R6.
**Gates on 8142e39:** `make check` 780 tests and smoke ok; `make tutorial-check` 12/12;
`make match` ok, replay hash matches.
**Pace:** every build-milestone issue that isn't priority/low or `needs-eric` is now
closed, apart from #80, which hasn't reproduced in about 9,000 comparisons. The
schedule is no longer behind, so the deferred priority/low issues are workable again.
**Next run:**
1. If the release has its binaries, verify them and close R5.
2. Otherwise B4, editing placed pieces (#18): the first open milestone's issue. It
touches the simulation and the protocol, so it needs a soak before it is closed.
3. Then A3 character customization (#43), H10 bot follow-ups (#74), and H8 (#71),
which can only close with a real-GPU profile.
## 2026-11-15 (midday): #72, the packet ship and the lifeline mortar
**Process miss, found this run:** Eric answered #72 on 2026-11-12 ("B is good"), and
three days of runs passed it by. They treated `needs-eric` issues as untouchable until
the label changed, and never read the comments. **From now on, at the start of every
run, read new comments on every open `needs-eric` issue.** A decision from Eric is the
first work of that run.
**What was built (aa79758, closes #72):** the GDD's launch replaces the sky barge.
- `Drop.plan()`: the packet ship sails past offshore, on the first route (up to 32
headings from the "drop" stream, offsets 300 to 465 m from the middle) with no land
within `SHIP_COAST_CLEARANCE` (45 m, probed in eight directions). If none is clear,
it tries the four world sides; seed 38 is the only one in 60 that needed them. The
deck is at `SHIP_DECK_HEIGHT` (4 m).
- The mortar: jump fires along the look yaw; `charge_for_pitch()` maps -10° to 45° to a
charge from 0 to 1, giving 16 to 110 m/s over the ground. Every shot climbs at 75 m/s
(the apex is about 145 m). In `Movement._fall_from_ship()`, a FREEFALL player moving
up is climbing: no steering, no kite. There is no new drop state, so the protocol is
unchanged. `fire_at_end()` aims anyone left aboard at 80% of the way to the middle.
- `Drop.reach(charge, kite_at_top)` mirrors the fall tick by tick. A full charge
carries 782 m on a fall and 987 m with the kite opened at the top; land lies no more
than about 907 m from any route (60 seeds). `aim_charge()` picks a fall when one
reaches, since it is quicker.
- Bots: `NavBot._ride` fires when abeam of the goal, or in easy reach at its own
staggered moment, or just before the route ends (the forced shot aims at the middle,
not at the bot's goal). `_descend` opens the kite only when the goal is beyond the
rest of a fall. The first version, which glided from the top of every arc, took
everyone 45 to 63 s to land; this one takes 30 to 38 s, like the barge's 32 to 37 s.
- Art: `VesselModels.ship()` (two masts with tanned square sails, a salt-white boot-top,
a bowsprit, and the mortar on its bed; mirrored so the mortar faces the island),
`lifeline()`, the figure's `kite` part (figure.py; the `sail` part is gone), and
lifeline cords in `EntityView`. Barge was renamed to ship and wing-sail to gull-kite
everywhere, including the `match_ship` and `client_ship` capture scenes and a new
`match_launch` stage.
- `make match` and `test_scripted_player` moved from seed 29 back to seed 2. On 29 the
scripted player now falls in a landing fight.
**Tests and gates on aa79758:** `make check` 783 tests and smoke ok; `make match` ok
(seed 2, replay hash matches); `make tutorial-check` 12/12; `make client-check` ok (0
corrections); `make bot-matches` ok (20, 4.3% drowned); `make duo-matches` ok;
`make balance` ok (median 13.7 min, rivet repeater 30.7%, sea deaths 7.6%, up from
3.6%; noted on #74).
**Captures, looked at:** `vessels`, `match_ship`, `match_launch`, `match_glide`,
`client_ship`, `client_glide`, `figure_states`. The first `match_launch` showed the
cords running from the masthead and stopping short: `Basis.scaled()` scales world
axes. Fixed with `* Basis.from_scale()`, with a test on both ends of the cord.
**Release:** the v1.0.0 tag and draft predate this change. #64 now recommends cutting
v1.0.1 from `main`, which is Eric's call. Not soaked this run: the protocol didn't
change and `client-check` and the prediction link tests agree, but a `make soak`
before any v1.0.1 is due.
**Next run:**
1. Read new comments on `needs-eric` issues (#64, #65, #66). If Eric says to cut
v1.0.1, bump the version, run `make soak`, `dist-check` and `deb-check`, and prepare
the draft.
2. Otherwise B4 (#18), then A3 (#43) and H10 (#74), starting with the drownings.
+18 -11
View File
@@ -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 1. **Lobby.** Players join. Once `MATCH_MIN_PLAYERS` are in, it waits
`MATCH_LOBBY_SECONDS` for more, or counts down at once when full. `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. 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. 4. **Play.** Ends when at most one team has anyone standing.
5. **Results.** Finishing places and the winners stay up for `MATCH_RESULTS_SECONDS`, 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. 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 ### The drop
Every match starts with the drop, simulated in [`src/sim/drop.gd`](../src/sim/drop.gd). 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. A packet ship sails past the island on a straight route drawn from the seed, its deck
The route passes within `BARGE_CENTRE_JITTER` of the middle and always crosses at least `SHIP_DECK_HEIGHT` above the sea. The route runs as close in as it can while keeping
`BARGE_MIN_LAND_METRES` of dry land. Players ride it until they press jump, then fall, `SHIP_COAST_CLEARANCE` of open water between itself and any land, so it never crosses
steering at `FREEFALL_STEER_SPEED`, up to `FREEFALL_MAX_SPEED`. Jump opens the sail, and the island. Players ride it until they press jump, which fires them inland by lifeline
it opens by itself `WING_AUTO_DEPLOY_HEIGHT` above the ground or water. Under the sail mortar along the way they face. How high they aim sets the charge: from
they sink at `GLIDE_FALL_SPEED` and steer at `GLIDE_SPEED`, and touch down without damage. `MORTAR_PITCH_LOW_DEGREES` (or lower) to `MORTAR_PITCH_HIGH_DEGREES` (or higher) the shot's
Anyone still aboard at the end of the route is thrown off. The carrier's name and look, speed over the ground runs from `MORTAR_MIN_SPEED` to `MORTAR_MAX_SPEED`, and every shot
sky barge or the packet ship and mortar of the core loop above, are open in #72. 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 ## 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` The balance targets are checked by `make balance` over at least `BALANCE_MIN_MATCHES`
bot-only matches of `SOLO_PLAYERS` players (H3): 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; `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 - no one weapon takes more than `BALANCE_MAX_WEAPON_SHARE` of the eliminations made with
weapons, the boathook included. weapons, the boathook included.
@@ -348,7 +355,7 @@ Keys are matched by position. Defaults for keyboard and mouse:
| Action | Default | | Action | Default |
|---|---| |---|---|
| Move | W A S D | | 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 | | Crouch; dive when swimming | Left Ctrl |
| Sprint | Left Shift | | Sprint | Left Shift |
| Use, fire, harvest or place | Left mouse | | Use, fire, harvest or place | Left mouse |
+71 -9
View File
@@ -1,7 +1,7 @@
# Playing Tidewall on Linux # Playing Tidewall on Linux
Tidewall is a free and open-source build-and-survive battle royale. Up to 24 players 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. 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). To run a server, see [SERVER.md](SERVER.md).
@@ -35,8 +35,14 @@ Replace `1.0.0` with the version you downloaded.
## Starting a match ## Starting a match
The game opens on its main menu. 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: 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
else is there, so only the tide can end it. Leave it whenever you like from the pause
menu (Escape).
- **Practice** plays offline against bots on an island of its own. No network needed. - **Practice** plays offline against bots on an island of its own. No network needed.
Crew picks solo or duos, with a bot as your crewmate. Crew picks solo or duos, with a bot as your crewmate.
- **Join a server** lists the servers it finds on your local network. Pick one, or type - **Join a server** lists the servers it finds on your local network. Pick one, or type
@@ -45,6 +51,7 @@ The game opens on its main menu.
You can also start straight into a match from a terminal: You can also start straight into a match from a terminal:
./tidewall --tutorial # the tutorial
./tidewall --offline # practice against 23 bots ./tidewall --offline # practice against 23 bots
./tidewall --offline --bots=5 --seed=42 # fewer bots, a chosen island ./tidewall --offline --bots=5 --seed=42 # fewer bots, a chosen island
./tidewall --offline --duos # duos, with the first bot as your crewmate ./tidewall --offline --duos # duos, with the first bot as your crewmate
@@ -73,13 +80,13 @@ practice. Crewmates can't hurt each other, with any weapon or keg.
## Controls ## Controls
Every key can be rebound in Settings → Controls. Mouse sensitivity and inversion are on Every key can be rebound in Settings → Controls. Mouse sensitivity and inversion are on
the Mouse tab. Escape opens the pause menu and can't be rebound. Keys are matched by the Mouse tab. A gamepad works too (below). Escape opens the pause menu and can't be rebound. Keys are matched by
position, so they sit in the same place on any keyboard layout. position, so they sit in the same place on any keyboard layout.
| Action | Default | | Action | Default |
|---|---| |---|---|
| Move | W A S D | | 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 | | Crouch; in water, dive | Left Ctrl |
| Sprint | Left Shift | | Sprint | Left Shift |
| Use, fire, harvest or place | Left mouse | | Use, fire, harvest or place | Left mouse |
@@ -94,14 +101,69 @@ position, so they sit in the same place on any keyboard layout.
| In build mode: next material | Tab | | In build mode: next material | Tab |
| Chart (the full map) | M | | Chart (the full map) | M |
Gamepads aren't supported in this release. ### Gamepad
A gamepad works alongside the keyboard and mouse, with one fixed layout (listed in
Settings → Gamepad). Buttons are named by position, so they sit the same on any pad:
South is A on most pads.
| Action | Gamepad |
|---|---|
| Move | Left stick |
| Look | Right stick |
| Sprint (until you stop) | Click the left stick |
| 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) |
| Use, fire, harvest or place | Right trigger |
| Aim | Left trigger |
| Next / previous slot, or piece in build mode | Right / left bumper |
| Build mode on and off | Click the right stick |
| In build mode: next / previous material | D-pad right / left |
| Chart | D-pad up |
| Drop the held item | D-pad down |
| Pause menu | Start |
In the menus the D-pad or the left stick moves between controls, South chooses and East
or Start goes back. Settings → Gamepad sets the stick's look speed and turns **aim
assist** on or off (on by default). Aim assist only works with the stick, never the
mouse, and only on an opponent in plain sight close to where you already look: the
stick turns more slowly across them, and while aiming the view eases towards them, by
at most 9° a second. It moves your view only, as your thumb would; the server judges
every shot the same way. Speed while aiming and Invert on the Mouse tab apply to the
stick too. The tutorial names pad buttons once you use the pad.
Gamepads were tested with simulated input only; no physical pad has been tried yet.
## Accessibility
Settings → Access:
- **Colour vision.** Standard, Red-green (protan, deutan) or Blue-yellow (tritan).
Changes the build preview's allowed and refused colours, danger marks (the tide's
next line, low health, "not enough") and your own marks (the tide gauge pointer, your
lines in the feed) to colours that stay apart for that kind of colour blindness.
Nothing in the HUD relies on colour alone in any set: there are words, numbers and
patterns too.
- **Interface size.** 90%, 100%, 115% or 130%: menus and HUD drawn larger or smaller.
At the larger sizes the hotbar moves beside the health panel and its slots narrow.
- **Captions for sounds.** Names the sounds that matter, and which way they came from
(ahead, left, right, behind): the tide's foghorn, bell, surges and lighthouse,
gunfire, shots striking someone, keg blasts, footsteps within 20 m, building and
breaking, splashes, and being hit. Your own sounds aren't captioned.
- **Reduce motion.** Aiming zooms in less (62° rather than 48° of view) and more
slowly, and the flash at the screen's edge when you're hurt is gentler. Tidewall has
no camera shake or head bob.
## How a match goes ## How a match goes
1. **The drop.** Everyone rides a sky barge across the island. Press jump to leap, 1. **The drop.** Everyone rides a packet ship that sails past the island, offshore.
steer with the move keys while you fall, and press jump again to open the wing-sail. Face where you want to land and press jump to fire yourself inland by lifeline
It opens by itself near the ground. Anyone still aboard at the end of the route is mortar: aim level for the shore, and look higher to carry further, up to the far
thrown off. 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 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). 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. Washed-up crates on the beaches spill loot when broken.
+25 -3
View File
@@ -87,6 +87,27 @@ or `src/app`, and on any palette colour this table doesn't list. Values are sRGB
| `WARNING` | 0.86, 0.32, 0.22 | HUD danger: the tide's next line, low health | | `WARNING` | 0.86, 0.32, 0.22 | HUD danger: the tide's next line, low health |
| `SEA_INK` | 0.20, 0.34, 0.42 | The sea on the tide gauge and map | | `SEA_INK` | 0.20, 0.34, 0.42 | The sea on the tide gauge and map |
### Colour vision (A13)
The signals above are the `Standard` set. Red against green (the build ghost) and rust
against oilskin yellow (danger beside the player's own marks) are hard to tell apart
for many players, so the Access settings offer a set for each common kind of colour
blindness (`VISION_NAMES`: `VISION_STANDARD`, `VISION_RED_GREEN`, `VISION_BLUE_YELLOW`).
Everything that signals asks `Palette.ghost_ok()`, `ghost_refused()`, `warning()` and
`own()` for its colour, which read `VISION_SIGNALS` for the set in use.
| Set | Allowed | Refused | Danger | Own marks |
|---|---|---|---|---|
| Standard | `GHOST_OK` | `GHOST_REFUSED` | `WARNING` | `OILSKIN` |
| Red-green (protan, deutan) | blue 0.22, 0.52, 0.95 | orange 0.98, 0.56, 0.08 | magenta 0.78, 0.16, 0.62 | `OILSKIN` |
| Blue-yellow (tritan) | teal 0.16, 0.70, 0.74 | vermilion 0.90, 0.16, 0.20 | red 0.88, 0.14, 0.18 | pale blue 0.62, 0.86, 0.98 |
`test_palette` checks each set with a simulation of the colour vision it is for
(Machado, Oliveira and Fernandes 2009, at full severity): each pair must be at least
0.25 apart in Oklab, and clearly further apart than the standard colours where those
are weakest (the standard ghost is only 0.18 apart for deutan eyes). Simulations are a
guide, not a substitute for asking players with colour blindness.
The terrain shader's sand, marsh, grass, rock and summit colours are shader uniforms The terrain shader's sand, marsh, grass, rock and summit colours are shader uniforms
and follow the same rules. The sea shader's colours are set from the `SEA_` entries and follow the same rules. The sea shader's colours are set from the `SEA_` entries
above by `WaterView`. Water goes from `SEA_SHALLOW` to `SEA_DEEP` with its depth and above by `WaterView`. Water goes from `SEA_SHALLOW` to `SEA_DEEP` with its depth and
@@ -158,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 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 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`). 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 - **The packet ship and sea chests** (`VesselModels`): a two-masted packet with a lofted
rubbing strake under a gored canvas envelope, striped tanned and banded ochre; sea tarred hull, an ochre rubbing strake, a salt-white boot-top at the waterline, tanned
chests painted sea-green with tarred bands, a salt-white border and a gilt hasp. 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 - **Terrain** (`terrain.gdshader`): sand with shingle, marsh, grass in tussocks and
wind-dried patches, rock with lichen blotches, pale summits. Fine detail fades out wind-dried patches, rock with lichen blotches, pale summits. Fine detail fades out
past about 150 m so it doesn't shimmer. past about 150 m so it doesn't shimmer.
+2 -2
View File
@@ -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 | | 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 | | 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 | | 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 | | 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 | | 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 | | 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 | | 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 | | 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 | | 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 | | 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 | | Results | `match_tide`, `match_results` | The drowned island from the lobby's viewpoint; the last players on the highest ground. | Pass after H15 |
+12 -3
View File
@@ -1,4 +1,4 @@
.TH TIDEWALL 6 "2026-11-14" "Tidewall" "Games" .TH TIDEWALL 6 "2026-11-15" "Tidewall" "Games"
.SH NAME .SH NAME
tidewall \- build-and-survive battle royale on a drowning island tidewall \- build-and-survive battle royale on a drowning island
.SH SYNOPSIS .SH SYNOPSIS
@@ -8,11 +8,16 @@ tidewall \- build-and-survive battle royale on a drowning island
.RI [ "game options" ] .RI [ "game options" ]
.SH DESCRIPTION .SH DESCRIPTION
.B tidewall .B tidewall
starts the game on its main menu: practice offline against bots, find a starts the game on its main menu (offering the tutorial the first time): learn the
game in the tutorial, practice offline against bots, find a
server on the local network, or join one by address. The sea rises in phases server on the local network, or join one by address. The sea rises in phases
and swallows the low ground; gather salvage, build, and be the last one and swallows the low ground; gather salvage, build, and be the last one
standing. standing.
.PP .PP
Play with the keyboard and mouse or a gamepad. Keys, the gamepad layout, aim assist,
colour vision, interface size, captions for sounds and reduced motion are in the
Settings menu; the player guide, docs/PLAY.md in the source, has the details.
.PP
The game's own options below may be given on their own or after The game's own options below may be given on their own or after
.BR \-\- ; .BR \-\- ;
any other option goes to the Godot engine. any other option goes to the Godot engine.
@@ -33,10 +38,14 @@ Start a practice match against bots at once.
.TP .TP
.B \-\-duos .B \-\-duos
With \-\-offline, play duos with the first bot as your crewmate. With \-\-offline, play duos with the first bot as your crewmate.
.TP
.B \-\-tutorial
Start the tutorial at once: a short match alone that teaches the drop, gathering,
building, firing and the tide, using your own key bindings.
.SH FILES .SH FILES
.TP .TP
.I ~/.local/share/godot/app_userdata/Tidewall/ .I ~/.local/share/godot/app_userdata/Tidewall/
Settings and key bindings. Settings, key bindings and accessibility options.
.SH SEE ALSO .SH SEE ALSO
.BR tidewall\-server (6) .BR tidewall\-server (6)
.PP .PP
+21 -2
View File
@@ -1,5 +1,5 @@
## The game program on a display: the menus, and a ClientSession while a match is ## The game program on a display: the menus, and a ClientSession while a match is
## played. Practice and Join start a session; Escape in a match brings up the pause ## played. The first launch offers the tutorial (A12). Practice, Tutorial and Join start a session; Escape in a match brings up the pause
## menu (the match goes on: it's a live server, even offline); Leave ends the session ## menu (the match goes on: it's a live server, even offline); Leave ends the session
## and goes back to the main menu; when a match the player was in ends, the results ## and goes back to the main menu; when a match the player was in ends, the results
## screen shows where they placed. ## screen shows where they placed.
@@ -42,6 +42,7 @@ func _init(with: GameSettings = null, path: String = GameSettings.DEFAULT_PATH)
menus.use_settings(settings, path) menus.use_settings(settings, path)
layer.add_child(menus) layer.add_child(menus)
menus.practice_requested.connect(start_practice) menus.practice_requested.connect(start_practice)
menus.tutorial_requested.connect(start_tutorial)
menus.join_requested.connect(join) menus.join_requested.connect(join)
menus.resume_requested.connect(resume) menus.resume_requested.connect(resume)
menus.leave_requested.connect(leave) menus.leave_requested.connect(leave)
@@ -59,7 +60,7 @@ func _init(with: GameSettings = null, path: String = GameSettings.DEFAULT_PATH)
func _ready() -> void: func _ready() -> void:
settings.apply_to_program(get_tree()) settings.apply_to_program(get_tree())
if session == null: if session == null:
menus.show_screen("main", false) menus.show_screen("main" if settings.tutorial_offered else "welcome", false)
## Starts an offline match against bots, solo or in duos (`team_size` 2, M7). ## Starts an offline match against bots, solo or in duos (`team_size` 2, M7).
@@ -70,6 +71,15 @@ func start_practice(bots: int, difficulty: int, team_size: int = 1) -> void:
_begin(practice) _begin(practice)
## Starts the tutorial (A12): an offline match alone, with its card on the HUD.
func start_tutorial() -> void:
var match_seed: int = int(Time.get_unix_time_from_system() * 1000.0) & 0x7FFFFFFF
var lesson: ClientSession = ClientSession.new()
lesson.use_settings(settings)
lesson.play_tutorial(match_seed)
_begin(lesson)
## Joins a server. Says so on the join screen if the connection can't be opened. ## Joins a server. Says so on the join screen if the connection can't be opened.
func join(host: String, port: int, player_name: String) -> Error: func join(host: String, port: int, player_name: String) -> Error:
var joining: ClientSession = ClientSession.new() var joining: ClientSession = ClientSession.new()
@@ -137,6 +147,15 @@ func _begin(started: ClientSession) -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if session != null: if session != null:
watch_match() watch_match()
watch_tutorial()
## Remembers once the tutorial has been finished. Called every frame.
func watch_tutorial() -> void:
if session.tutorial == null or not session.tutorial.finished() or settings.tutorial_done:
return
settings.tutorial_done = true
settings.save(settings_path)
## Counts this player's eliminations from the feed, and shows the results when a match ## Counts this player's eliminations from the feed, and shows the results when a match
+10 -1
View File
@@ -2,6 +2,8 @@
## ##
## tidewall the main menu (with a window) ## tidewall the main menu (with a window)
## tidewall --offline an offline match against bots ## tidewall --offline an offline match against bots
## tidewall --tutorial the tutorial (A12), an offline match alone; with
## --autoplay its scripted player plays it through
## tidewall --connect=HOST[:PORT] join a server ## tidewall --connect=HOST[:PORT] join a server
## options: --name=NAME --seed=N --bots=N (offline) --duos (offline) --autoplay ## options: --name=NAME --seed=N --bots=N (offline) --duos (offline) --autoplay
## --client-seconds=N quit after N seconds, saying what happened ## --client-seconds=N quit after N seconds, saying what happened
@@ -27,6 +29,8 @@ var has_seed: bool = false
var bots: int = DEFAULT_BOTS var bots: int = DEFAULT_BOTS
## Offline in duos (M7) with --duos: the player and the first bot are a team. ## Offline in duos (M7) with --duos: the player and the first bot are a team.
var team_size: int = 1 var team_size: int = 1
## The tutorial (A12) with --tutorial.
var tutorial: bool = false
var autoplay: bool = false var autoplay: bool = false
## Quit after this many seconds; 0 runs until the window is closed. ## Quit after this many seconds; 0 runs until the window is closed.
var seconds: float = 0.0 var seconds: float = 0.0
@@ -45,7 +49,7 @@ var errors: Array[String] = []
## Every option parse() knows, by name. ## Every option parse() knows, by name.
const OPTIONS: Array[String] = [ const OPTIONS: Array[String] = [
"--offline", "--autoplay", "--duos", "--browse", "--list", "--lan-port", "--lan-target", "--offline", "--tutorial", "--autoplay", "--duos", "--browse", "--list", "--lan-port", "--lan-target",
"--connect", "--name", "--seed", "--bots", "--client-seconds", "--connect", "--name", "--seed", "--bots", "--client-seconds",
] ]
@@ -73,6 +77,9 @@ static func parse(args: PackedStringArray) -> ClientConfig:
match parts[0]: match parts[0]:
"--offline": "--offline":
config.asked = true config.asked = true
"--tutorial":
config.asked = true
config.tutorial = true
"--autoplay": "--autoplay":
config.autoplay = true config.autoplay = true
"--duos": "--duos":
@@ -126,6 +133,8 @@ static func parse(args: PackedStringArray) -> ClientConfig:
config.errors.append("unknown option '%s'" % arg) config.errors.append("unknown option '%s'" % arg)
if config.team_size > 1 and not config.host.is_empty(): if config.team_size > 1 and not config.host.is_empty():
config.errors.append("--duos is for an offline match; a server decides its own teams") config.errors.append("--duos is for an offline match; a server decides its own teams")
if config.tutorial and (not config.host.is_empty() or config.browse or config.team_size > 1):
config.errors.append("--tutorial is played alone and offline: leave out --connect, --browse and --duos")
if config.browse and not config.host.is_empty(): if config.browse and not config.host.is_empty():
config.errors.append("--browse and --connect can't be used together") config.errors.append("--browse and --connect can't be used together")
return config return config
+78 -6
View File
@@ -46,6 +46,15 @@ var _status: Label = null
var _fx_seen: int = 0 var _fx_seen: int = 0
## The hit marker and hurt flash (A7). ## The hit marker and hurt flash (A7).
var feedback: HitFeedback = HitFeedback.new() var feedback: HitFeedback = HitFeedback.new()
## Captions for key sounds (A13), shown when the setting is on.
var captions: Captions = Captions.new()
## How strong the hurt flash is with reduce motion on (A13).
const CALM_HURT: float = 0.35
## The tutorial (A12), when this session is one, its card on the HUD, and the script
## that plays it when nobody is at the keyboard (`input.autoplay`).
var tutorial: Tutorial = null
var tutorial_card: TutorialCard = null
var pilot: TutorialPilot = null
func _init() -> void: func _init() -> void:
@@ -66,12 +75,25 @@ func play_offline(match_seed: int, bots: int, rules: MatchRules = null, difficul
local = LocalServer.new(match_seed, bots, rules, difficulty) local = LocalServer.new(match_seed, bots, rules, difficulty)
## Starts the tutorial (A12): an offline match of this player alone, under
## MatchRules.tutorial(), with the tutorial watching. Set `input.autoplay` first for
## the scripted player to play it.
func play_tutorial(match_seed: int) -> void:
local = LocalServer.new(match_seed, 0, MatchRules.tutorial())
tutorial = Tutorial.new()
tutorial.bindings = settings.bindings
if input.autoplay:
pilot = TutorialPilot.new(tutorial, input)
## Takes the player's settings: their keys and mouse now, and graphics for each ## Takes the player's settings: their keys and mouse now, and graphics for each
## match's view. ## match's view.
func use_settings(with: GameSettings) -> void: func use_settings(with: GameSettings) -> void:
settings = with settings = with
input.settings = with.mouse input.settings = with.mouse
input.bindings = with.bindings input.bindings = with.bindings
if tutorial != null:
tutorial.bindings = with.bindings
if view != null: if view != null:
view.apply_settings(with) view.apply_settings(with)
@@ -105,11 +127,14 @@ func status_text() -> String:
func pump(delta: float) -> void: func pump(delta: float) -> void:
frames += 1 frames += 1
if paused: if paused:
# Nothing held while a menu is up, so the player stops rather than runs on. # Nothing held while a menu is up, so the player stops rather than runs on. The
# pad's events go to the menu meanwhile, so forget what it held.
input.move = Vector2.ZERO input.move = Vector2.ZERO
input.buttons = 0 input.buttons = 0
input.pad.release()
else: else:
input.poll() _aim_targets()
input.poll(delta)
if link != null: if link != null:
game.poll() game.poll()
if local != null: if local != null:
@@ -119,6 +144,8 @@ func pump(delta: float) -> void:
phases.append(game.match_phase) phases.append(game.match_phase)
if game.playing(): if game.playing():
frames_playing += 1 frames_playing += 1
if tutorial != null:
tutorial.update(game, input, delta)
mirror.sync(game) mirror.sync(game)
_show(delta) _show(delta)
@@ -146,6 +173,10 @@ func _ready() -> void:
chart.position = Vector2(-300.0, -300.0) chart.position = Vector2(-300.0, -300.0)
chart.visible = false chart.visible = false
hud.add_child(chart) hud.add_child(chart)
if tutorial != null:
tutorial_card = TutorialCard.new()
tutorial_card.position = Vector2(18.0, 204.0)
hud.add_child(tutorial_card)
if DisplayServer.get_name() != "headless" and not input.autoplay: if DisplayServer.get_name() != "headless" and not input.autoplay:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
@@ -157,22 +188,37 @@ func _process(delta: float) -> void:
sound.rain = view.weather.weather.rain() sound.rain = view.weather.weather.rain()
sound.gale = view.weather.weather.wind() sound.gale = view.weather.weather.wind()
sound.update(game, mirror.own_id, view.camera.global_position if view != null else Vector3.ZERO, delta) sound.update(game, mirror.own_id, view.camera.global_position if view != null else Vector3.ZERO, delta)
_hear_captions(delta)
if _status != null: if _status != null:
_status.text = status_text() _status.text = status_text()
if hud != null: if hud != null:
var state: HudState = hud_state() var state: HudState = hud_state()
feedback.update(state.health if state.playing else -1, delta) feedback.update(state.health if state.playing else -1, delta)
state.hit = feedback.hit() state.hit = feedback.hit()
state.hurt = feedback.hurt() state.hurt = feedback.hurt() * (CALM_HURT if settings.reduce_motion else 1.0)
hud.show_state(state) hud.show_state(state)
if tutorial_card != null:
tutorial_card.show_tutorial(tutorial, game.playing())
_show_charts(delta) _show_charts(delta)
## Passes this frame's sounds to the captions, heard from the camera.
func _hear_captions(delta: float) -> void:
if not settings.captions or view == null:
captions.clear()
return
var forward: Vector3 = -view.camera.global_transform.basis.z
var own: Vector3 = game.own_position() if game.playing() else Vector3.INF
captions.hear(sound.cues, view.camera.global_position, atan2(forward.x, forward.z), own, delta)
## What the HUD should show now. ## What the HUD should show now.
func hud_state() -> HudState: func hud_state() -> HudState:
var state: HudState = HudState.from_client(game, input, own_handle()) var state: HudState = HudState.from_client(game, input, own_handle())
state.hit = feedback.hit() state.hit = feedback.hit()
state.hurt = feedback.hurt() state.hurt = feedback.hurt() * (CALM_HURT if settings.reduce_motion else 1.0)
if settings.captions:
state.captions = captions.lines()
return state return state
@@ -180,7 +226,9 @@ func _unhandled_input(event: InputEvent) -> void:
var captured: bool = Input.mouse_mode == Input.MOUSE_MODE_CAPTURED var captured: bool = Input.mouse_mode == Input.MOUSE_MODE_CAPTURED
var key: InputEventKey = event as InputEventKey var key: InputEventKey = event as InputEventKey
var click: InputEventMouseButton = event as InputEventMouseButton var click: InputEventMouseButton = event as InputEventMouseButton
if key != null and key.pressed and not key.echo and key.physical_keycode == KEY_ESCAPE: var pad: InputEventJoypadButton = event as InputEventJoypadButton
var start: bool = pad != null and pad.pressed and pad.button_index == JOY_BUTTON_START
if start or (key != null and key.pressed and not key.echo and key.physical_keycode == KEY_ESCAPE):
# Escape lets go of the mouse and asks for the pause menu; a click takes the # Escape lets go of the mouse and asks for the pause menu; a click takes the
# mouse back when there is no menu. # mouse back when there is no menu.
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
@@ -196,7 +244,31 @@ func _exit_tree() -> void:
leave() leave()
## Gives aim assist (A13) the camera and the chests of the opponents in the world:
## players still in, not downed, and not on the player's own team. Only gathered when
## the gamepad is in use and the setting is on.
func _aim_targets() -> void:
input.targets.clear()
if not (input.pad.active and input.settings.aim_assist and game.playing() and view != null and game.world != null):
return
var world: Simulation = game.world
var me: SimEntity = world.entities.find(mirror.own_id)
if me == null:
return
input.eye = view.camera.global_position if view.camera.is_inside_tree() else view.camera.position
if not input.clear.is_valid():
input.clear = func(from: Vector3, to: Vector3) -> bool: return game.world != null and game.world.ground.raycast(from, to) >= 1.0
for entity: SimEntity in world.entities.entities():
if entity.archetype != SimEntity.ARCHETYPE_PLAYER or entity.id == me.id or entity.eliminated or entity.downed:
continue
if world.are_teammates(me, entity) or entity.drop_state != Drop.NONE:
continue
input.targets.append(entity.position + Vector3(0.0, Movement.body_height(entity) * 0.7, 0.0))
func _sample(tick: int) -> PlayerCommand: func _sample(tick: int) -> PlayerCommand:
if pilot != null:
return pilot.command(tick, game)
if input.autoplay and game.world != null: if input.autoplay and game.world != null:
return input.autoplay_command(tick, game.prediction.player, game.world.ground) return input.autoplay_command(tick, game.prediction.player, game.world.ground)
return input.command(tick) return input.command(tick)
@@ -224,7 +296,7 @@ func _show(delta: float) -> void:
if view == null: if view == null:
return return
view.entities.local_id = mirror.own_id if mirror.own_id != 0 else view.entities.local_id 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.rig.update_aim(input.aiming() and mirror.own_id != 0, delta)
view.sync() view.sync()
var fresh: int = mini(game.fx_received - _fx_seen, game.fx.size()) var fresh: int = mini(game.fx_received - _fx_seen, game.fx.size())
+9 -4
View File
@@ -1,7 +1,7 @@
## Application entry point. Picks the mode from the command line: ## Application entry point. Picks the mode from the command line:
## ##
## tools/godot.sh -- --server [options] headless dedicated server (see ServerConfig) ## tools/godot.sh -- --server [options] headless dedicated server (see ServerConfig)
## tidewall [options] the game: an offline match, or ## tidewall [options] the game: an offline match, the tutorial, or
## tidewall --connect=HOST[:PORT] a match on a server (see ClientConfig) ## tidewall --connect=HOST[:PORT] a match on a server (see ClientConfig)
## tidewall --browse list the servers it can find ## tidewall --browse list the servers it can find
## tools/godot.sh -- --list-server a list server (see ListServerRunner) ## tools/godot.sh -- --list-server a list server (see ListServerRunner)
@@ -53,7 +53,9 @@ func _ready() -> void:
return return
_session = ClientSession.new() _session = ClientSession.new()
_session.input.autoplay = _config.autoplay _session.input.autoplay = _config.autoplay
if _config.host.is_empty(): if _config.tutorial:
_session.play_tutorial(_config.match_seed if _config.has_seed else int(Time.get_unix_time_from_system() * 1000.0) & 0x7FFFFFFF)
elif _config.host.is_empty():
var match_seed: int = _config.match_seed if _config.has_seed else int(Time.get_unix_time_from_system() * 1000.0) & 0x7FFFFFFF var match_seed: int = _config.match_seed if _config.has_seed else int(Time.get_unix_time_from_system() * 1000.0) & 0x7FFFFFFF
_session.play_offline(match_seed, _config.bots, LocalServer.offline_rules(_config.bots, _config.team_size)) _session.play_offline(match_seed, _config.bots, LocalServer.offline_rules(_config.bots, _config.team_size))
else: else:
@@ -122,12 +124,15 @@ func _process(delta: float) -> void:
for phase: int in _session.phases: for phase: int in _session.phases:
phases.append(Match.PHASE_NAMES[phase]) phases.append(Match.PHASE_NAMES[phase])
var joined: bool = _session.local != null or _session.link.state == NetClient.JOINED var joined: bool = _session.local != null or _session.link.state == NetClient.JOINED
print(JSON.stringify({ var report: Dictionary = {
"event": "client", "joined": joined, "status": _session.status_text(), "phases": phases, "event": "client", "joined": joined, "status": _session.status_text(), "phases": phases,
"frames": _session.frames, "frames_playing": _session.frames_playing, "frames": _session.frames, "frames_playing": _session.frames_playing,
"world_messages": _session.game.replica.applied, "bad_packets": _session.game.bad_packets, "world_messages": _session.game.replica.applied, "bad_packets": _session.game.bad_packets,
"corrections": _session.game.prediction.mispredictions, "corrections": _session.game.prediction.mispredictions,
})) }
if _session.tutorial != null:
report["tutorial"] = _session.tutorial.step_name()
print(JSON.stringify(report))
_session.leave() _session.leave()
_session = null _session = null
get_tree().quit(0 if joined else 1) get_tree().quit(0 if joined else 1)
+217
View File
@@ -0,0 +1,217 @@
## The tutorial (A12): a short run through the game on an island of your own. It
## watches the client's own view of the match (ClientGame, the predicted player and
## 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: 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.
##
## The match itself is an ordinary offline one under MatchRules.tutorial(): you alone,
## with nobody to end it but the tide. Skip it from the pause menu (Leave) at any time.
class_name Tutorial
extends RefCounted
const LEAP: int = 0
const GLIDE: int = 1
const MOVE: int = 2
const HARVEST: int = 3
const BUILD: int = 4
const FIRE: int = 5
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 ship", "Glide down", "Find your feet", "Gather materials",
"Build a wall", "Aim and fire", "Beat the tide", "Ready to set out",
]
## Walk this far from where you landed, and jump once.
const WALK_METRES: float = 12.0
## Gather at least this much, and enough of one material for a wall.
const HARVEST_GOAL: int = 15
## Stand this far above the tide line, on the ground, for this long.
const TIDE_MARGIN_METRES: float = 1.0
const TIDE_HOLD_SECONDS: float = 2.0
var step: int = LEAP
## Seconds spent on each step, by index, for the scripted check's report.
var step_seconds: PackedFloat32Array = PackedFloat32Array()
var bindings: KeyBindings = KeyBindings.new()
## True while the player is using a gamepad: prompts name its buttons (A13).
var pad: bool = false
var _landed_at: Vector3 = Vector3.ZERO
var _walked: float = 0.0
var _jumped: bool = false
var _was_on_ground: bool = true
var _gathered_from: int = -1
var _gathered: int = 0
var _fx_seen: int = 0
var _chart_opened: bool = false
var _feet: float = NAN
var _tide_line: float = NAN
var _held_dry: float = 0.0
func _init() -> void:
step_seconds.resize(STEP_NAMES.size())
func finished() -> bool:
return step == DONE
func step_name() -> String:
return STEP_NAMES[step]
## Looks at the match as this client sees it, once a frame, and moves on when the
## step is done. `input` says whether the chart is open.
func update(game: ClientGame, input: ClientInput, delta: float) -> void:
pad = input.pad.active
step_seconds[step] += delta
var fresh: Array[Dictionary] = _fresh_fx(game)
if step == DONE or not game.playing():
return
var me: SimEntity = game.prediction.player
match step:
LEAP:
if me.drop_state != Drop.ABOARD:
_advance()
GLIDE:
if me.drop_state == Drop.NONE:
_landed_at = me.position
_was_on_ground = me.on_ground
_advance()
MOVE:
_walked = maxf(_walked, Vector2(me.position.x - _landed_at.x, me.position.z - _landed_at.z).length())
if _was_on_ground and not me.on_ground and me.velocity.y > 0.5 and not me.swimming:
_jumped = true
_was_on_ground = me.on_ground
if _walked >= WALK_METRES and _jumped:
_advance()
HARVEST:
var total: int = _total(me.materials)
if _gathered_from < 0:
_gathered_from = total
_gathered = maxi(total - _gathered_from, _gathered)
if _gathered >= HARVEST_GOAL and _most(me.materials) >= StructureSet.cost_of(StructureSet.WALL):
_advance()
BUILD:
for record: Dictionary in fresh:
if int(record["kind"]) == NetFx.PLACE and int(record["player"]) == me.id:
_advance()
break
FIRE:
for record: Dictionary in fresh:
if int(record["kind"]) == NetFx.IMPACT and int(record["player"]) == me.id \
and int(record.get("item", -1)) >= 0 and int(record.get("item", -1)) != ItemCatalog.boathook().code \
and int(record.get("hit", Weapons.HIT_NONE)) != Weapons.HIT_NONE:
_advance()
break
TIDE:
if input.map_open:
_chart_opened = true
_tide_line = tide_line(game.world.tide, game.world.tick)
_feet = me.position.y
var dry: bool = me.on_ground and not me.swimming and _feet >= _tide_line + TIDE_MARGIN_METRES
_held_dry = _held_dry + delta if dry else 0.0
if _chart_opened and _held_dry >= TIDE_HOLD_SECONDS:
_advance()
## The level the tide will reach after the next rise: where you must stand to be safe
## for a while. Past the last phase, the last level.
static func tide_line(tide: Tide, tick: int) -> float:
var phase: int = mini(tide.phase_at(tick) + 1, Tide.phase_count() - 1)
return tide.levels[phase]
## What to do now, naming the player's keys.
func instruction() -> String:
match step:
LEAP:
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. 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." % [
_moves(), "right stick" if pad else "mouse", ("Click %s" if pad else "Hold %s") % _key("sprint"), _key("jump")]
HARVEST:
return "Press %s for the boathook. Walk up to driftwood, a rock or scrap and press %s to cut it." % [_key("slot_0"), _key("fire")]
BUILD:
return "Press %s for build mode. %s picks the wall, %s the material, and %s places it. %s again leaves build mode." % [
_key("build"), _key("slot_0"), _key("material"), _key("fire"), _key("build")]
FIRE:
return "You carry a dock carbine. Press %s to hold it, hold %s to aim down the sights and press %s to fire at a rock, a tree or your wall. %s reloads." % [
_key("slot_1"), _key("aim"), _key("fire"), _key("reload")]
TIDE:
return "The sea rises in stages and drowns whoever it catches. Press %s to open the chart and see the tide's next line, then climb above where it will reach after that." % _key("map")
_:
return "That's the whole of it. Others carry weapons too, and chests and crates hold more (%s opens and picks up). Press %s and leave when you're ready, or stay and look around." % [_key("interact"), _key("pause")]
## How far along the step is, or "" when there is nothing to count.
func progress() -> String:
match step:
MOVE:
return "Walked %d of %d m%s" % [mini(floori(_walked), int(WALK_METRES)), int(WALK_METRES), " · jumped" if _jumped else " · jump once"]
HARVEST:
return "Gathered %d of %d" % [mini(_gathered, HARVEST_GOAL), HARVEST_GOAL]
TIDE:
if is_nan(_tide_line):
return ""
var chart: String = "chart opened" if _chart_opened else "open the chart"
return "Your feet %.0f m · safe above %.0f m · %s" % [_feet, _tide_line + TIDE_MARGIN_METRES, chart]
return ""
## "Step N of M", counting the steps a player does.
func counter() -> String:
if step == DONE:
return "Tutorial complete"
return "Step %d of %d" % [step + 1, DONE]
func _advance() -> void:
step += 1
func _key(action: String) -> String:
if pad:
return "[%s]" % PadInput.describe(action)
if action == "pause":
return "[Escape]"
return "[%s]" % KeyBindings.describe(bindings.code_of(action))
## The movement keys, or the stick.
func _moves() -> String:
if pad:
return _key("forward")
return "%s %s %s %s" % [_key("forward"), _key("left"), _key("back"), _key("right")]
func _fresh_fx(game: ClientGame) -> Array[Dictionary]:
var fresh: int = mini(game.fx_received - _fx_seen, game.fx.size())
_fx_seen = game.fx_received
var records: Array[Dictionary] = []
if fresh > 0:
records = game.fx.slice(game.fx.size() - fresh)
return records
static func _total(carried: PackedInt32Array) -> int:
var sum: int = 0
for amount: int in carried:
sum += amount
return sum
static func _most(carried: PackedInt32Array) -> int:
var best: int = 0
for amount: int in carried:
best = maxi(best, amount)
return best
+1
View File
@@ -0,0 +1 @@
uid://ohf3eudp270x
+301
View File
@@ -0,0 +1,301 @@
## A scripted player for the tutorial (A12): it plays each step the way a person at the
## keyboard would, through ClientInput (the keys it holds, the actions it presses and
## where it looks), so a headless run proves the tutorial can be finished from start
## to end with the game's real controls. `--tutorial --autoplay` uses it, and so do the
## tests and `make tutorial-check`.
##
## It knows only what the client knows: its own predicted player and the client's copy
## of the world.
class_name TutorialPilot
extends RefCounted
const TICKS: int = Tuning.TICK_RATE_HZ
## Looks for something to cut or shoot this far away.
const SEARCH_METRES: float = 60.0
## Gives up on a target it makes no headway towards for this long.
const STUCK_SECONDS: float = 6.0
## Fires from no farther than this.
const FIRE_METRES: float = 20.0
## Climbs to ground at least this far above the tide line.
const CLIMB_MARGIN_METRES: float = 3.0
var tutorial: Tutorial
var input: ClientInput
var _target: int = -1
var _skipped: Dictionary = {}
var _goal: Vector3 = Vector3.INF
var _bad_goals: Array[Vector3] = []
var _progress_at: Vector3 = Vector3.INF
var _progress_tick: int = 0
var _best_distance: float = INF
var _build_turns: int = 0
var _build_tick: int = -1
var _map_tick: int = -1
var _walk_yaw: float = 0.0
func _init(for_tutorial: Tutorial, with_input: ClientInput) -> void:
tutorial = for_tutorial
input = with_input
## The command for `tick`, made by setting the input as a player's hands would.
func command(tick: int, game: ClientGame) -> PlayerCommand:
input.move = Vector2.ZERO
input.buttons = 0
if game.world == null or not game.playing():
return input.command(tick)
var me: SimEntity = game.prediction.player
var world: Simulation = game.world
if tutorial.step != Tutorial.BUILD and input.build_mode:
input.act("build")
match tutorial.step:
Tutorial.LEAP:
_face_centre(me)
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)
input.move = Vector2(0.0, 1.0)
Tutorial.MOVE:
input.yaw = _walk_yaw
input.pitch = 0.0
input.move = Vector2(0.0, 1.0)
if tick % (2 * TICKS) == 0:
input.buttons = PlayerCommand.BUTTON_JUMP
if _stuck(tick, me):
_walk_yaw += PI * 0.5
Tutorial.HARVEST:
_harvest(tick, me, world)
Tutorial.BUILD:
_build(tick, me)
Tutorial.FIRE:
_fire(tick, me, world)
Tutorial.TIDE:
_climb(tick, me, world)
return input.command(tick)
func _face_centre(me: SimEntity) -> void:
var centre: float = Tuning.WORLD_SIZE_METRES * 0.5
input.yaw = atan2(centre - me.position.x, centre - me.position.z)
input.pitch = deg_to_rad(-12.0)
## Selects slot `number` (0 the boathook) as the number key would.
func _hold_slot(number: int) -> void:
if input.slot != number:
input.act("slot_%d" % number)
## Walks up to the nearest standing prop and swings the boathook at it.
func _harvest(tick: int, me: SimEntity, world: Simulation) -> void:
_hold_slot(0)
if _target < 0 or not world.props.is_standing(_target):
_target = _nearest_prop(me, world)
_reset_progress(tick, me)
if _target < 0:
_wander(tick, me)
return
var box: AABB = world.props.boxes[_target]
var eye: Vector3 = Harvest.eye(me)
var centre: Vector3 = box.get_center()
var aim: Vector3 = Vector3(centre.x, clampf(eye.y, box.position.y + 0.2, box.end.y - 0.1), centre.z)
_look_at(eye, aim)
if PropSet._distance_to_box(box, eye) <= Harvest.reach() - 0.6:
input.buttons = PlayerCommand.BUTTON_FIRE
_reset_progress(tick, me)
return
input.pitch = 0.0
input.move = Vector2(0.0, 1.0)
if tick % (2 * TICKS) == TICKS:
input.buttons = PlayerCommand.BUTTON_JUMP
if _stuck(tick, me, PropSet._distance_to_box(box, me.position)):
_skipped[_target] = true
_target = -1
## Build mode, the wall, the material it has most of, and a press of fire; a quarter
## turn after each try that places nothing.
func _build(tick: int, me: SimEntity) -> void:
if not input.build_mode:
input.act("build")
if input.build_kind != StructureSet.WALL:
input.act("slot_%d" % StructureSet.WALL)
var best: int = 0
for index: int in me.materials.size():
if me.materials[index] > me.materials[best]:
best = index
if input.material != best:
input.act("material")
return
input.pitch = 0.0
if _build_tick < 0:
_build_tick = tick
input.yaw = float(me.yaw) / PlayerCommand.YAW_STEPS * TAU
var since: int = tick - _build_tick
if since % TICKS == 0 and since > 0:
_build_turns += 1
input.yaw += PI * 0.5
if _build_turns % 4 == 0:
# No room here: step aside and try again.
input.move = Vector2(1.0, 0.0)
# Half a second to look at the ghost, then a press of fire, each try.
var phase: int = since % TICKS
if phase >= TICKS / 2 and phase < TICKS / 2 + 3:
input.buttons = PlayerCommand.BUTTON_FIRE
elif phase > TICKS / 2 + 3 and _build_turns % 4 == 0 and _build_turns > 0:
input.move = Vector2(1.0, 0.0)
## The carbine, aimed down the sights at the nearest prop in range, fired in taps.
func _fire(tick: int, me: SimEntity, world: Simulation) -> void:
_hold_slot(1)
if _target < 0 or not world.props.is_standing(_target):
_target = _nearest_prop(me, world)
_reset_progress(tick, me)
if _target < 0:
_wander(tick, me)
return
var box: AABB = world.props.boxes[_target]
var eye: Vector3 = Harvest.eye(me)
var centre: Vector3 = box.get_center()
_look_at(eye, Vector3(centre.x, clampf(eye.y, box.position.y + 0.3, box.end.y - 0.2), centre.z))
if eye.distance_to(centre) <= FIRE_METRES:
input.buttons = PlayerCommand.BUTTON_AIM
if tick % 10 < 2:
input.buttons |= PlayerCommand.BUTTON_FIRE
if tick % (3 * TICKS) == 0 and tick > 0:
# A miss or a blocked line: try the next one.
_skipped[_target] = true
_target = -1
return
input.pitch = 0.0
input.move = Vector2(0.0, 1.0)
if _stuck(tick, me, eye.distance_to(centre)):
_skipped[_target] = true
_target = -1
## Opens the chart for a moment, closes it, then walks to the nearest ground well above
## the tide line it must beat.
func _climb(tick: int, me: SimEntity, world: Simulation) -> void:
if _map_tick < 0:
_map_tick = tick
if not input.map_open:
input.act("map")
return
if input.map_open:
if tick - _map_tick >= TICKS:
input.act("map")
return
var line: float = Tutorial.tide_line(world.tide, world.tick) + Tutorial.TIDE_MARGIN_METRES
if me.position.y >= line + 0.5 and me.on_ground:
return
if _goal == Vector3.INF:
_goal = _high_ground(me, world, line + CLIMB_MARGIN_METRES)
_reset_progress(tick, me)
if _goal == Vector3.INF:
_wander(tick, me)
return
input.yaw = atan2(_goal.x - me.position.x, _goal.z - me.position.z)
input.pitch = 0.0
input.move = Vector2(0.0, 1.0)
if tick % TICKS == 0:
input.buttons = PlayerCommand.BUTTON_JUMP | PlayerCommand.BUTTON_SPRINT
else:
input.buttons = PlayerCommand.BUTTON_SPRINT
var flat: float = Vector2(_goal.x - me.position.x, _goal.z - me.position.z).length()
if _stuck(tick, me, flat):
_bad_goals.append(_goal)
_goal = Vector3.INF
## The nearest point of the terrain at least `height` up, from rings around the player,
## leaving out goals already given up on.
func _high_ground(me: SimEntity, world: Simulation, height: float) -> Vector3:
for ring: int in range(1, 40):
var radius: float = float(ring) * 6.0
var points: int = 8 + ring * 2
for index: int in points:
var angle: float = TAU * float(index) / float(points)
var x: float = me.position.x + sin(angle) * radius
var z: float = me.position.z + cos(angle) * radius
if x < 0.0 or z < 0.0 or x > Tuning.WORLD_SIZE_METRES or z > Tuning.WORLD_SIZE_METRES:
continue
var y: float = world.ground.terrain_height(x, z)
if y < height:
continue
var spot: Vector3 = Vector3(x, y, z)
var refused: bool = false
for bad: Vector3 in _bad_goals:
if Vector2(bad.x - x, bad.z - z).length() < 15.0:
refused = true
if not refused:
return spot
return Vector3.INF
func _nearest_prop(me: SimEntity, world: Simulation) -> int:
var best: int = -1
var best_distance: float = INF
for prop: int in world.props.near(me.position, SEARCH_METRES):
if _skipped.has(prop) or not world.props.is_standing(prop):
continue
var box: AABB = world.props.boxes[prop]
if box.position.y < world.sea_level + 0.5 or absf(box.position.y - me.position.y) > 6.0:
continue
var distance: float = PropSet._distance_to_box(box, me.position)
if distance < best_distance:
best_distance = distance
best = prop
return best
func _look_at(eye: Vector3, point: Vector3) -> void:
var to: Vector3 = point - eye
input.yaw = atan2(to.x, to.z)
input.pitch = atan2(to.y, Vector2(to.x, to.z).length())
## Walks on in some direction when there's nothing near to go to.
func _wander(tick: int, me: SimEntity) -> void:
input.yaw = _walk_yaw
input.pitch = 0.0
input.move = Vector2(0.0, 1.0)
if tick % (2 * TICKS) == 0:
input.buttons = PlayerCommand.BUTTON_JUMP
if _stuck(tick, me):
_walk_yaw += PI * 0.5
func _reset_progress(tick: int, me: SimEntity) -> void:
_progress_at = me.position
_progress_tick = tick
_best_distance = INF
## True, once, after STUCK_SECONDS without headway: closer to the target by a metre
## when `distance` is given, else a few metres from where it was.
func _stuck(tick: int, me: SimEntity, distance: float = -1.0) -> bool:
if _progress_at == Vector3.INF:
_reset_progress(tick, me)
var moved: bool
if distance >= 0.0:
moved = distance < _best_distance - 1.0
if moved:
_best_distance = distance
else:
moved = me.position.distance_to(_progress_at) > 3.0
if moved:
_progress_at = me.position
_progress_tick = tick
elif tick - _progress_tick > roundi(STUCK_SECONDS * TICKS):
_reset_progress(tick, me)
return true
return false
+1
View File
@@ -0,0 +1 @@
uid://bbs8nxm0k8fed
+3 -2
View File
@@ -463,7 +463,8 @@ func _stop() -> void:
# The drop # 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: func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
state = "drop" state = "drop"
var rider: SimEntity = sim.entities.find(player_id) 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(): for index: int in world.markers.size():
var at: Vector2 = Vector2(world.markers[index].x, world.markers[index].z) var at: Vector2 = Vector2(world.markers[index].x, world.markers[index].z)
var closest: Vector2 = Geometry2D.get_closest_point_to_segment(at, a, b) 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) near.append(index)
if near.is_empty(): if near.is_empty():
_landing = rng.randi_range(0, world.markers.size() - 1) _landing = rng.randi_range(0, world.markers.size() - 1)
+35 -11
View File
@@ -36,7 +36,7 @@ var _stuck_ticks: int = 0
var _stuck_tries: int = 0 var _stuck_tries: int = 0
var _jump_next: bool = false var _jump_next: bool = false
var _leap_tick: int = -1 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 _ride_gap: float = INF
var _rng: RandomNumberGenerator = null var _rng: RandomNumberGenerator = null
var _rng_seed: int = 0 var _rng_seed: int = 0
@@ -87,8 +87,8 @@ func think(sim: Simulation, grid: NavGrid) -> PlayerCommand:
if player.drop_state == Drop.ABOARD: if player.drop_state == Drop.ABOARD:
return _ride(sim, player) return _ride(sim, player)
if player.drop_state != Drop.NONE: if player.drop_state != Drop.NONE:
# Gliding down: head for the goal. # Coming down: head for the goal.
return _steer(sim, player, goal, 0) return _descend(sim, player)
if status != MOVING: if status != MOVING:
return PlayerCommand.from_input(sim.tick, Vector2.ZERO, deg_to_rad(player.yaw * 360.0 / PlayerCommand.YAW_STEPS), 0.0) 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: 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) 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 ## Aboard the ship: with a goal, fire the mortar at it with the charge that reaches it,
## 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. ## 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: func _ride(sim: Simulation, player: SimEntity) -> PlayerCommand:
if _leap_tick < 0 and sim.drop != null: 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) _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 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: if status == MOVING:
# With somewhere to land, wait until it's in gliding reach, or until the barge target = Vector2(goal.x, goal.z)
# has passed it and is drawing away (H3: bots used to leap on the timer and land reach = 1.0
# hundreds of metres short). var gap: float = target.distance_to(Vector2(player.position.x, player.position.z))
var gap: float = Vector2(goal.x - player.position.x, goal.z - player.position.z).length() # Abeam of the goal; or in easy reach of it once this bot's own moment has come,
leap = gap < 0.6 * (player.position.y - goal.y) or gap > _ride_gap + 0.01 # 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 _ride_gap = gap
var to: Vector2 = target - Vector2(player.position.x, player.position.z)
var buttons: int = PlayerCommand.BUTTON_JUMP if leap else 0 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 ## A random open dry point within ROAM_RANGE that a path reaches, from the bot's own
+4 -3
View File
@@ -1,5 +1,5 @@
## The script a soak-test client plays by. It only sees what a network client sees: its ## 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), ## 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, ## 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 ## 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 to_top: Vector2 = _top - Vector2(me.position.x, me.position.z)
var yaw: float = atan2(to_top.x, to_top.y) var yaw: float = atan2(to_top.x, to_top.y)
if me.drop_state == Drop.ABOARD: 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 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 var pitch: float = Drop.pitch_for_charge(Drop.aim_charge(to_top.length()))
return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, 0.0, PlayerCommand.BUTTON_JUMP if tick > wait and over_land else 0) return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, pitch, PlayerCommand.BUTTON_JUMP if tick > wait else 0)
if me.drop_state != Drop.NONE: if me.drop_state != Drop.NONE:
return PlayerCommand.from_input(tick, Vector2(0.0, 1.0), yaw, 0.0) return PlayerCommand.from_input(tick, Vector2(0.0, 1.0), yaw, 0.0)
var phase: int = (tick + number * 11) % (6 * TICKS) var phase: int = (tick + number * 11) % (6 * TICKS)
+68
View File
@@ -0,0 +1,68 @@
## Aim assist for the gamepad (A13), an option, on by default, and never applied to the
## mouse. Two gentle effects, both only for an opponent in plain sight close to where
## the player is already looking:
##
## - Friction: the right stick turns more slowly across an opponent, so a stick can
## settle on them instead of sliding past.
## - Pull: while aiming down sights and moving (the stick or the player), the look
## eases towards the opponent's chest, by no more than PULL_RADIANS_PER_SECOND.
##
## It only turns the client's look, the same as a player's own thumb, so it changes
## nothing the server judges. It never aims through cover: `clear` decides what is
## in sight, and the session passes the world's own line test.
class_name AimAssist
extends RefCounted
## How far either side of the look an opponent can be and still count.
const CONE_RADIANS: float = deg_to_rad(6.0)
## Further than this, nobody counts.
const RANGE_METRES: float = 90.0
## Look speed at the very centre of an opponent, against 1 away from them.
const FRICTION: float = 0.45
## The fastest the pull turns the look.
const PULL_RADIANS_PER_SECOND: float = deg_to_rad(9.0)
## The opponent nearest the look within the cone: {"point", "angle"}, or {} for none.
## `clear` takes (eye, point) and returns true when nothing is between them.
static func nearest(eye: Vector3, yaw: float, pitch: float, targets: Array[Vector3], clear: Callable = Callable()) -> Dictionary:
var look: Vector3 = CameraRig.look_direction(yaw, pitch)
var best: Dictionary = {}
var best_angle: float = CONE_RADIANS
for point: Vector3 in targets:
var to: Vector3 = point - eye
var distance: float = to.length()
if distance < 0.5 or distance > RANGE_METRES:
continue
var angle: float = look.angle_to(to / distance)
if angle >= best_angle:
continue
if clear.is_valid() and not bool(clear.call(eye, point)):
continue
best_angle = angle
best = {"point": point, "angle": angle}
return best
## How much the stick's turn is slowed: 1 with nobody near the look, down to FRICTION
## at an opponent's centre.
static func friction(found: Dictionary) -> float:
if found.is_empty():
return 1.0
return lerpf(FRICTION, 1.0, clampf(float(found["angle"]) / CONE_RADIANS, 0.0, 1.0))
## The look after `delta` seconds of pull towards `found`: Vector2(yaw, pitch). Pulls
## harder the closer the look already is, and never past the opponent.
static func pull(eye: Vector3, yaw: float, pitch: float, found: Dictionary, delta: float) -> Vector2:
if found.is_empty():
return Vector2(yaw, pitch)
var to: Vector3 = Vector3(found["point"]) - eye
var want_yaw: float = atan2(to.x, to.z)
var want_pitch: float = atan2(to.y, Vector2(to.x, to.z).length())
var turn: Vector2 = Vector2(angle_difference(yaw, want_yaw), want_pitch - pitch)
var closeness: float = 1.0 - clampf(float(found["angle"]) / CONE_RADIANS, 0.0, 1.0)
var step: float = PULL_RADIANS_PER_SECOND * closeness * delta
if turn.length() > step:
turn = turn.normalized() * step
return Vector2(fposmod(yaw + turn.x, TAU), clampf(pitch + turn.y, -InputSettings.PITCH_LIMIT, InputSettings.PITCH_LIMIT))
+1
View File
@@ -0,0 +1 @@
uid://u6jrr2nuxaod
+5 -3
View File
@@ -1,10 +1,12 @@
## The placement preview: a translucent copy of the piece where fire would put it, sea ## The placement preview: a translucent copy of the piece where fire would put it, in the
## green when the server would accept it and rust red when it wouldn't. It asks the same ## colour-vision set's allowed colour (sea green as standard) when the server would
## accept it and its refused colour (rust red) when it wouldn't. It asks the same
## Building.target() and Building.check() the server runs, so the ghost and the server ## Building.target() and Building.check() the server runs, so the ghost and the server
## agree on the client's predicted state. ## agree on the client's predicted state.
class_name BuildGhost class_name BuildGhost
extends Node3D extends Node3D
## The standard set's colours; Palette.vision can change what is shown.
const VALID_COLOUR: Color = Palette.GHOST_OK const VALID_COLOUR: Color = Palette.GHOST_OK
const INVALID_COLOUR: Color = Palette.GHOST_REFUSED const INVALID_COLOUR: Color = Palette.GHOST_REFUSED
@@ -44,7 +46,7 @@ func update(sim: Simulation, player: SimEntity, kind: int, material: int) -> voi
if key != _shown_key: if key != _shown_key:
_shown_key = key _shown_key = key
_mesh.mesh = PieceMesher.box_mesh(Building.boxes_for_target(target, sim.ground), Color.WHITE) _mesh.mesh = PieceMesher.box_mesh(Building.boxes_for_target(target, sim.ground), Color.WHITE)
_surface.albedo_color = VALID_COLOUR if valid else INVALID_COLOUR _surface.albedo_color = Palette.ghost_ok() if valid else Palette.ghost_refused()
func colour() -> Color: func colour() -> Color:
+7 -2
View File
@@ -21,15 +21,20 @@ const CLEARANCE: float = 0.1
const CLEAR_STEPS: int = 16 const CLEAR_STEPS: int = 16
## Seconds to move most of the way between hip and aim. ## Seconds to move most of the way between hip and aim.
const AIM_BLEND_SECONDS: float = 0.12 const AIM_BLEND_SECONDS: float = 0.12
## With reduce motion on (A13): a smaller zoom, eased in over longer. Tidewall has no
## camera shake, so the aim zoom is the largest camera motion the player doesn't make.
const CALM_AIM_FOV: float = 62.0
const CALM_AIM_BLEND_SECONDS: float = 0.3
## 0 at the hip, 1 fully aimed. Advanced by `update_aim`. ## 0 at the hip, 1 fully aimed. Advanced by `update_aim`.
var aim_blend: float = 0.0 var aim_blend: float = 0.0
var reduce_motion: bool = false
## Eases aim_blend towards aiming or not over `delta` seconds. ## Eases aim_blend towards aiming or not over `delta` seconds.
func update_aim(aiming: bool, delta: float) -> void: func update_aim(aiming: bool, delta: float) -> void:
var target: float = 1.0 if aiming else 0.0 var target: float = 1.0 if aiming else 0.0
var rate: float = 1.0 - exp(-delta * 3.0 / AIM_BLEND_SECONDS) var rate: float = 1.0 - exp(-delta * 3.0 / (CALM_AIM_BLEND_SECONDS if reduce_motion else AIM_BLEND_SECONDS))
aim_blend = lerpf(aim_blend, target, rate) aim_blend = lerpf(aim_blend, target, rate)
if absf(aim_blend - target) < 0.001: if absf(aim_blend - target) < 0.001:
aim_blend = target aim_blend = target
@@ -66,7 +71,7 @@ func solve(feet: Vector3, yaw: float, pitch: float, crouching: bool, ground: Sim
func fov() -> float: func fov() -> float:
return lerpf(FOV, AIM_FOV, aim_blend) return lerpf(FOV, CALM_AIM_FOV if reduce_motion else AIM_FOV, aim_blend)
## Moves from `from` towards `to`, stopping MARGIN short of the first surface. ## Moves from `from` towards `to`, stopping MARGIN short of the first surface.
+60 -8
View File
@@ -6,10 +6,11 @@
## 1 the boathook, 2 to 6 the five slots · B build mode on and off · ## 1 the boathook, 2 to 6 the five slots · B build mode on and off ·
## in build mode 1 to 5 pick wall, floor, ramp, roof or breakwater, Tab the material, ## in build mode 1 to 5 pick wall, floor, ramp, roof or breakwater, Tab the material,
## and left mouse places · M the chart. ## and left mouse places · M the chart.
## Gamepads come with A13. ## 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 ## With `autoplay` on, a simple script plays instead: it fires itself off the ship
## land, glides, and walks about. That is for tests and for checking a connection with ## towards the middle of the island, glides, and walks about. That is for tests and for checking a connection with
## nobody at the keyboard. ## nobody at the keyboard.
class_name ClientInput class_name ClientInput
extends RefCounted extends RefCounted
@@ -31,6 +32,15 @@ var map_open: bool = false
var build_kind: int = StructureSet.WALL var build_kind: int = StructureSet.WALL
var material: int = Materials.DRIFTWOOD var material: int = Materials.DRIFTWOOD
var autoplay: bool = false var autoplay: bool = false
## The gamepad's state, fed by handle().
var pad: PadInput = PadInput.new()
## For aim assist: where the camera is, and the chests of opponents in the world.
## The session fills these each frame; `clear` is its line-of-sight test.
var eye: Vector3 = Vector3.ZERO
var targets: Array[Vector3] = []
var clear: Callable = Callable()
## Sprint latched by clicking the left stick, until the stick is let go.
var _pad_sprint: bool = false
## Actions held down, and the command buttons they hold. ## Actions held down, and the command buttons they hold.
const HELD: Dictionary = { const HELD: Dictionary = {
@@ -45,18 +55,43 @@ func aiming() -> bool:
return buttons & PlayerCommand.BUTTON_AIM != 0 and not build_mode return buttons & PlayerCommand.BUTTON_AIM != 0 and not build_mode
## Reads what is held down from the keyboard and mouse. Call once a frame. ## Reads what is held down from the keyboard, the mouse and the gamepad, and turns
func poll() -> void: ## the look by the right stick over `delta` seconds. Call once a frame.
func poll(delta: float = 0.0) -> void:
if autoplay: if autoplay:
return return
move = Vector2( move = Vector2(
_axis("right", "left"), _axis("right", "left"),
_axis("forward", "back"), _axis("forward", "back"),
) )
var stick: Vector2 = pad.move()
if stick != Vector2.ZERO:
move = (move + stick).limit_length(1.0)
elif _pad_sprint and move == Vector2.ZERO:
_pad_sprint = false
buttons = 0 buttons = 0
for action: String in HELD: for action: String in HELD:
if bindings.is_held(action): if bindings.is_held(action) or pad.is_held(action):
buttons |= int(HELD[action]) buttons |= int(HELD[action])
if _pad_sprint:
buttons |= PlayerCommand.BUTTON_SPRINT
_pad_look(delta)
## Turns the look by the right stick, with aim assist when it's on.
func _pad_look(delta: float) -> void:
var stick: Vector2 = pad.look()
var found: Dictionary = {}
if settings.aim_assist and pad.active and not targets.is_empty():
found = AimAssist.nearest(eye, yaw, pitch, targets, clear)
if stick != Vector2.ZERO:
var look: Vector2 = settings.apply_stick(stick, yaw, pitch, aiming(), delta, AimAssist.friction(found))
yaw = look.x
pitch = look.y
if not found.is_empty() and aiming() and (stick != Vector2.ZERO or move != Vector2.ZERO):
var pulled: Vector2 = AimAssist.pull(eye, yaw, pitch, found, delta)
yaw = pulled.x
pitch = pulled.y
## Takes one input event: mouse motion turns the look, and keys that act once per ## Takes one input event: mouse motion turns the look, and keys that act once per
@@ -64,6 +99,10 @@ func poll() -> void:
func handle(event: InputEvent, captured: bool) -> void: func handle(event: InputEvent, captured: bool) -> void:
if autoplay: if autoplay:
return return
if pad.feed(event):
for action: String in pad.take_presses():
act(action)
return
var motion: InputEventMouseMotion = event as InputEventMouseMotion var motion: InputEventMouseMotion = event as InputEventMouseMotion
if motion != null and captured: if motion != null and captured:
turn(motion.relative) turn(motion.relative)
@@ -95,6 +134,16 @@ func act(action: String) -> void:
map_open = not map_open map_open = not map_open
elif action == "material" and build_mode: elif action == "material" and build_mode:
material = (material + 1) % Materials.NAMES.size() material = (material + 1) % Materials.NAMES.size()
elif action == "material_back" and build_mode:
material = posmod(material - 1, Materials.NAMES.size())
elif action == "slot_next" or action == "slot_back":
var step: int = 1 if action == "slot_next" else -1
if build_mode:
build_kind = posmod(build_kind + step, StructureSet.KINDS.size())
else:
slot = posmod(slot + step, Inventory.slot_count() + 1)
elif action == "sprint":
_pad_sprint = true
elif action.begins_with("slot_"): elif action.begins_with("slot_"):
var number: int = action.substr(5).to_int() var number: int = action.substr(5).to_int()
if build_mode: if build_mode:
@@ -123,8 +172,11 @@ func autoplay_command(tick: int, me: SimEntity, ground: SimGround) -> PlayerComm
move = Vector2.ZERO move = Vector2.ZERO
buttons = 0 buttons = 0
if me.drop_state == Drop.ABOARD: if me.drop_state == Drop.ABOARD:
# Over dry land, with a moment to look about first. # With a moment to look about first, fire the mortar most of the way to the
if tick > 3 * Tuning.TICK_RATE_HZ and ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 2.0: # 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 buttons = PlayerCommand.BUTTON_JUMP
elif me.drop_state != Drop.NONE: elif me.drop_state != Drop.NONE:
move = Vector2(0.0, 1.0) move = Vector2(0.0, 1.0)
+66 -23
View File
@@ -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 ## 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. ## 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 ## 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 ## 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 ## 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 ## looks. The ship and the sea chests are VesselModels, generated in code. The ship's
## here is ever used for collision. ## 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 class_name EntityView
extends Node3D extends Node3D
@@ -21,7 +22,7 @@ const SKIN: Color = Palette.SKIN
## shows darker, its paint dulled. ## shows darker, its paint dulled.
const CHEST_SHUT: Color = Color.WHITE const CHEST_SHUT: Color = Color.WHITE
const CHEST_OPEN: Color = Palette.OPENED_DULL 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. ## carries them all at one point; this only spreads them out to be seen.
const DECK_SPACING: float = 1.3 const DECK_SPACING: float = 1.3
const DECK_ROWS: int = 4 const DECK_ROWS: int = 4
@@ -30,16 +31,19 @@ const PICKUP_SCALE: float = 1.4
## The entity drawn in the brightest oilskin, or 0. ## The entity drawn in the brightest oilskin, or 0.
var local_id: int = 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. ## 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 var _sim: Simulation
## Entity ID -> its FigureRig. ## Entity ID -> its FigureRig.
var _figures: Dictionary = {} var _figures: Dictionary = {}
## Whether _process steps the figures. Captures that pose figures exactly turn it off. ## Whether _process steps the figures. Captures that pose figures exactly turn it off.
var animate_live: bool = true 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. ## Items lying in the world: one MultiMeshInstance3D per item model and tier.
var _pickups: Node3D var _pickups: Node3D
var _pickup_fields: Dictionary = {} var _pickup_fields: Dictionary = {}
@@ -48,9 +52,9 @@ var _chests: MultiMeshInstance3D
func setup(sim: Simulation) -> void: func setup(sim: Simulation) -> void:
_sim = sim _sim = sim
_barge = _build_barge() _ship = _build_ship()
_barge.visible = false _ship.visible = false
add_child(_barge) add_child(_ship)
_pickups = Node3D.new() _pickups = Node3D.new()
_pickups.name = "Pickups" _pickups.name = "Pickups"
add_child(_pickups) add_child(_pickups)
@@ -68,8 +72,8 @@ func figure_of(entity_id: int) -> FigureRig:
return _figures.get(entity_id) return _figures.get(entity_id)
func barge() -> Node3D: func ship() -> Node3D:
return _barge return _ship
## Items drawn lying in the world. ## Items drawn lying in the world.
@@ -106,10 +110,15 @@ func sync() -> void:
if drop != null: if drop != null:
var along: Vector3 = drop.finish - drop.start var along: Vector3 = drop.finish - drop.start
heading = atan2(along.x, along.z) heading = atan2(along.x, along.z)
_barge.visible = crossing _ship.visible = crossing
if crossing: if crossing:
_barge.position = barge_at if barge_at != Vector3.INF else drop.barge_position(_sim.tick) _ship.position = ship_at if ship_at != Vector3.INF else drop.ship_position(_sim.tick)
_barge.rotation.y = heading _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 seen: Dictionary = {}
var aboard: int = 0 var aboard: int = 0
@@ -133,7 +142,12 @@ func sync() -> void:
figure.position += offset.rotated(Vector3.UP, heading) figure.position += offset.rotated(Vector3.UP, heading)
figure.rotation.y = heading figure.rotation.y = heading
aboard += 1 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) _hold(figure, entity)
for index: int in range(lines, _lifelines.size()):
_lifelines[index].visible = false
for entity_id: int in _figures.keys(): for entity_id: int in _figures.keys():
if not seen.has(entity_id): if not seen.has(entity_id):
_figures[entity_id].queue_free() _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 ## 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: func _hold(figure: FigureRig, entity: SimEntity) -> void:
var busy: bool = entity.drop_state != Drop.NONE or entity.swimming or entity.eliminated or entity.downed var busy: bool = entity.drop_state != Drop.NONE or entity.swimming or entity.eliminated or entity.downed
figure.hand().visible = not busy figure.hand().visible = not busy
@@ -248,6 +262,35 @@ func _item_field(key: String) -> MultiMeshInstance3D:
return field 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: 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 coat: Color = OILSKINS[0] if entity_id == local_id else OILSKINS[1 + entity_id % (OILSKINS.size() - 1)]
var figure: FigureRig = FigureRig.new(coat) var figure: FigureRig = FigureRig.new(coat)
@@ -255,13 +298,13 @@ func _build_figure(entity_id: int) -> FigureRig:
return figure return figure
## The barge (VesselModels): a hull hung under a canvas envelope. Its deck is at the ## The packet ship (VesselModels). Its deck is at the origin, where the simulation
## origin, where the simulation carries the passengers. ## carries the passengers.
func _build_barge() -> Node3D: func _build_ship() -> Node3D:
var barge: MeshInstance3D = MeshInstance3D.new() var ship: MeshInstance3D = MeshInstance3D.new()
barge.name = "Barge" ship.name = "Ship"
barge.mesh = VesselModels.barge() ship.mesh = VesselModels.ship()
return barge return ship
func _chest_field() -> MultiMeshInstance3D: func _chest_field() -> MultiMeshInstance3D:
+2 -2
View File
@@ -188,7 +188,7 @@ static func _clips() -> Dictionary:
[0.4, over(air, {"shoulder_r": Vector3(-20, 0, -46), "shoulder_l": Vector3(-20, 0, 46)})], [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 = { var skydive: Dictionary = {
"hips": Vector3(72, 0, 0), "waist": Vector3(6, 0, 0), "neck": Vector3(-55, 0, 0), "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), "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)})], [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 = { var glide: Dictionary = {
"hips": Vector3(12, 0, 0), "waist": Vector3(-4, 0, 0), "neck": Vector3(10, 0, 0), "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), "shoulder_r": Vector3(-158, 0, -16), "shoulder_l": Vector3(-158, 0, 16),
+10 -9
View File
@@ -36,7 +36,7 @@ const ANIMATED: Array[String] = [
const PARENT: Dictionary = { const PARENT: Dictionary = {
"hips": "", "waist": "hips", "spine": "waist", "neck": "spine", "hips": "", "waist": "hips", "spine": "waist", "neck": "spine",
"shoulder_r": "spine", "elbow_r": "shoulder_r", "shoulder_l": "spine", "elbow_l": "shoulder_l", "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. ## Part model -> the joint pivot it hangs on.
const PART_JOINT: Dictionary = { const PART_JOINT: Dictionary = {
@@ -44,7 +44,7 @@ const PART_JOINT: Dictionary = {
"upper_arm_r": "shoulder_r", "forearm_r": "elbow_r", "upper_arm_r": "shoulder_r", "forearm_r": "elbow_r",
"upper_arm_l": "shoulder_l", "forearm_l": "elbow_l", "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", "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 ## Material names in the part models -> Palette colours. COAT and COAT_DARK are the
## player's own oilskin. ## player's own oilskin.
@@ -52,6 +52,7 @@ const COLOURS: Dictionary = {
"TAR": Palette.TAR, "TAR_WEATHERED": Palette.TAR_WEATHERED, "SKIN": Palette.SKIN, "TAR": Palette.TAR, "TAR_WEATHERED": Palette.TAR_WEATHERED, "SKIN": Palette.SKIN,
"INK": Palette.INK, "BARK": Palette.BARK, "CANVAS": Palette.CANVAS, "GILT": Palette.GILT, "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, "PLANK": Palette.PLANK, "OCHRE_RED": Palette.OCHRE_RED, "TANNED_SAIL": Palette.TANNED_SAIL,
"SALT": Palette.SALT,
} }
const COAT_SHADE: float = 0.28 const COAT_SHADE: float = 0.28
## The states of `move`, in input order. ## The states of `move`, in input order.
@@ -88,7 +89,7 @@ var speed: float = 0.0
var _hand: Node3D var _hand: Node3D
var _held: MeshInstance3D var _held: MeshInstance3D
var _sail: Node3D var _kite: Node3D
var _pitch: float = 0.0 var _pitch: float = 0.0
var _holding: bool = true var _holding: bool = true
var _airborne: float = 0.0 var _airborne: float = 0.0
@@ -124,8 +125,8 @@ func _init(coat_colour: Color = Palette.OILSKIN) -> void:
instance.name = part instance.name = part
instance.mesh = mesh instance.mesh = mesh
(joints[PART_JOINT[part]] as Node3D).add_child(instance) (joints[PART_JOINT[part]] as Node3D).add_child(instance)
_sail = joints["sail"] _kite = joints["kite"]
_sail.visible = false _kite.visible = false
_hand = Node3D.new() _hand = Node3D.new()
_hand.name = "hand_r" _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])) _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 ## 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 ## 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 ## 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. ## its finish: FINISH_COAT, FINISH_GILT or FINISH_PLAIN.
static func _merged(source: Mesh, coat_colour: Color) -> ArrayMesh: static func _merged(source: Mesh, coat_colour: Color) -> ArrayMesh:
@@ -256,8 +257,8 @@ func held() -> MeshInstance3D:
return _held return _held
func sail() -> Node3D: func kite() -> Node3D:
return _sail return _kite
## Sets the tree from an entity's replicated state. `delta` is the time since the last ## 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() flinch()
_last_health = entity.health _last_health = entity.health
_pitch = float(entity.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5) _pitch = float(entity.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5)
_sail.visible = state == "glide" _kite.visible = state == "glide"
_hand.visible = _holding _hand.visible = _holding
tree.set("parameters/move/transition_request", state) tree.set("parameters/move/transition_request", state)
tree.set("parameters/ground/blend_position", speed) tree.set("parameters/ground/blend_position", speed)
+157 -68
View File
@@ -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): ## colours (no imported art):
## ##
## - the barge: a tarred, lofted hull with a sheer and pointed ends, a planked deck, ## - the packet ship (#72): a tarred, lofted hull with a sheer, an ochre rubbing strake
## rails, mooring lines, and a gored canvas envelope with tanned stripes and an ochre ## and a salt-white boot-top at the waterline, a planked deck, rails, two masts with
## band, in the folk-art manner of docs/STYLE.md. Its deck top is at the origin, where ## tanned square sails on yards, a bowsprit, shrouds, and the lifeline mortar on its
## the simulation carries the passengers; it points along +z; ## 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 ## - 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. ## gilt hasp, its base at the origin.
class_name VesselModels class_name VesselModels
extends RefCounted extends RefCounted
## Hull half-length, half-breadth at the deck, and depth amidships, in metres. ## Hull half-length, half-breadth at the deck, and depth amidships, in metres. The keel
const HULL_HALF_LENGTH: float = 5.5 ## sits HULL_DEPTH under the deck, below the waterline.
const HULL_HALF_BREADTH: float = 3.4 const HULL_HALF_LENGTH: float = 12.0
const HULL_DEPTH: float = 1.6 const HULL_HALF_BREADTH: float = 3.8
## Envelope centre height above the deck and its semi-axes (x, y, z), in metres. const HULL_DEPTH: float = Tuning.SHIP_DECK_HEIGHT + 1.8
const ENVELOPE_HEIGHT: float = 10.5 ## Masts: where along the deck (z), and how tall above it.
const ENVELOPE_AXES: Vector3 = Vector3(5.2, 3.8, 9.0) const MASTS: Array[Vector2] = [Vector2(6.6, 17.0), Vector2(-5.8, 14.5)]
const ENVELOPE_RINGS: int = 14 ## Where the mortar stands on the deck: forward of the passengers, aft of the foremast,
const ENVELOPE_SIDES: int = 20 ## 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. ## 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 CHEST_SIZE: Vector3 = Vector3(0.9, 0.55, 0.6)
const LID: float = 0.3 const LID: float = 0.3
static func barge() -> ArrayMesh: static func ship() -> ArrayMesh:
var tool: SurfaceTool = SurfaceTool.new() var tool: SurfaceTool = SurfaceTool.new()
tool.begin(Mesh.PRIMITIVE_TRIANGLES) tool.begin(Mesh.PRIMITIVE_TRIANGLES)
tool.set_smooth_group(-1) tool.set_smooth_group(-1)
@@ -43,30 +54,117 @@ static func barge() -> ArrayMesh:
x += 0.32 x += 0.32
index += 1 index += 1
# Rails follow the sheer on stanchions at every station. # Rails follow the sheer on stanchions at every station.
var rail: Vector3 = Vector3(0.0, 0.65, 0.0) var rail: Vector3 = Vector3(0.0, 0.8, 0.0)
for side: int in [0, 4]: for side: int in [0, 6]:
var inward: Vector3 = Vector3(0.12 if side == 0 else -0.12, 0.0, 0.0) var inward: Vector3 = Vector3(0.12 if side == 0 else -0.12, 0.0, 0.0)
for station: int in rings.size(): for station: int in rings.size():
var at: Vector3 = rings[station][side] + inward var at: Vector3 = rings[station][side] + inward
_line(tool, at, at + rail, 0.1, Palette.TAR) _line(tool, at, at + rail, 0.1, Palette.TAR)
if station + 1 < rings.size(): if station + 1 < rings.size():
_line(tool, at + rail, rings[station + 1][side] + inward + rail, 0.1, Palette.TAR) _line(tool, at + rail, rings[station + 1][side] + inward + rail, 0.1, Palette.TAR)
for side: float in [-1.0, 1.0]: # Bowsprit, raking up from the bow.
# Mooring lines from the rail to the envelope's belly. var bow: Vector3 = Vector3(0.0, _sheer(1.0) + 0.3, HULL_HALF_LENGTH - 0.4)
for end: float in [-1.0, 1.0]: var sprit_end: Vector3 = bow + Vector3(0.0, 2.4, 6.0)
var foot: Vector3 = Vector3(side * (HULL_HALF_BREADTH - 0.35), 0.6, end * 3.6) _line(tool, bow, sprit_end, 0.28, Palette.PLANK.darkened(0.15))
var hx: float = 0.55 for mast: Vector2 in MASTS:
var hz: float = 0.5 _mast(tool, mast.x, mast.y, sprit_end if mast == MASTS[0] else Vector3.INF)
var under: float = ENVELOPE_AXES.y * sqrt(1.0 - hx * hx - hz * hz) _mortar(tool)
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)
tool.generate_normals() tool.generate_normals()
var mesh: ArrayMesh = tool.commit() var mesh: ArrayMesh = tool.commit()
mesh.surface_set_material(0, _material(0.85)) mesh.surface_set_material(0, _material(0.85))
return mesh 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: static func chest() -> ArrayMesh:
var tool: SurfaceTool = SurfaceTool.new() var tool: SurfaceTool = SurfaceTool.new()
tool.begin(Mesh.PRIMITIVE_TRIANGLES) tool.begin(Mesh.PRIMITIVE_TRIANGLES)
@@ -89,65 +187,56 @@ static func chest() -> ArrayMesh:
return mesh return mesh
## The hull as rings of five points (rail, bilge, keel, bilge, rail) along z. Returns ## The hull as rings of seven points along z: rail, boot-top, waterline, keel and back
## the rings, for the rails. ## 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]: 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] = [] var rings: Array[PackedVector3Array] = []
for station: int in stations + 1: for station: int in stations + 1:
var t: float = float(station) / stations * 2.0 - 1.0 var t: float = float(station) / stations * 2.0 - 1.0
var z: float = t * HULL_HALF_LENGTH 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 breadth: float = HULL_HALF_BREADTH * sqrt(maxf(1.0 - pow(absf(t), 3.0), 0.01))
var keel: float = -HULL_DEPTH * (1.0 - 0.55 * pow(absf(t), 3.0)) var keel: float = -HULL_DEPTH * (1.0 - 0.3 * pow(absf(t), 3.0))
var sheer: float = 0.25 * t * t var sheer: float = _sheer(t)
var ring: PackedVector3Array = PackedVector3Array([ var ring: PackedVector3Array = PackedVector3Array([
Vector3(-breadth, sheer, z), Vector3(-breadth * 0.8, keel * 0.6, z), Vector3(0.0, keel, z), Vector3(-breadth, sheer, z),
Vector3(breadth * 0.8, keel * 0.6, 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) rings.append(ring)
for station: int in stations: for station: int in stations:
for side: int in 4: for side: int in 6:
var colour: Color = Palette.TAR if side == 1 or side == 2 else Palette.TAR_WEATHERED var colour: Color = Palette.TAR_WEATHERED
# A painted strake under the rail, every other station a shade lighter. if side == 1 or side == 4:
if side == 0 or side == 3: 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) 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) _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. # Rubbing strake: an ochre band along the top of the hull.
for station: int in stations: for station: int in stations:
for side: int in [0, 4]: for side: int in [0, 6]:
var a: Vector3 = rings[station][side] var a: Vector3 = rings[station][side]
var b: Vector3 = rings[station + 1][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 out: Vector3 = Vector3(0.04 * signf(a.x), 0.0, 0.0)
var drop: Vector3 = Vector3(0.0, -0.22, 0.0) var drop: Vector3 = Vector3(0.0, -0.3, 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) _quad(tool, a + out, b + out, b + drop + out, a + drop + out, Palette.OCHRE_RED)
return rings 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`. ## A square line `width` thick from `a` to `b`.
static func _line(tool: SurfaceTool, a: Vector3, b: Vector3, width: float, colour: Color) -> void: static func _line(tool: SurfaceTool, a: Vector3, b: Vector3, width: float, colour: Color) -> void:
var along: Vector3 = (b - a).normalized() var along: Vector3 = (b - a).normalized()
+37 -3
View File
@@ -31,6 +31,8 @@ const WINDOW_MODES: Array[String] = ["Windowed", "Fullscreen", "Exclusive fullsc
## Frame caps offered, 0 for none. ## Frame caps offered, 0 for none.
const FRAME_CAPS: Array[int] = [0, 30, 60, 90, 120, 144, 165, 240] const FRAME_CAPS: Array[int] = [0, 30, 60, 90, 120, 144, 165, 240]
const MAX_NAME_LENGTH: int = 24 const MAX_NAME_LENGTH: int = 24
## Interface scales offered (A13): menus and HUD drawn this much larger.
const UI_SCALES: Array[float] = [0.9, 1.0, 1.15, 1.3]
var bindings: KeyBindings = KeyBindings.new() var bindings: KeyBindings = KeyBindings.new()
var mouse: InputSettings = InputSettings.new() var mouse: InputSettings = InputSettings.new()
@@ -75,6 +77,25 @@ var practice_difficulty: int = -1:
var practice_team_size: int = 1: var practice_team_size: int = 1:
set(value): set(value):
practice_team_size = clampi(value, 1, Tuning.DUO_TEAM_SIZE) practice_team_size = clampi(value, 1, Tuning.DUO_TEAM_SIZE)
## The tutorial (A12): offered on the first launch until answered, and finished once.
var tutorial_offered: bool = false
var tutorial_done: bool = false
## Accessibility (A13). Colour vision: an index into Palette.VISION_NAMES.
var vision: int = Palette.VISION_STANDARD:
set(value):
vision = clampi(value, 0, Palette.VISION_NAMES.size() - 1)
## How large the menus and HUD are drawn: one of UI_SCALES.
var ui_scale: float = 1.0:
set(value):
ui_scale = 1.0
for offered: float in UI_SCALES:
if absf(offered - value) < 0.001:
ui_scale = offered
## Captions for the sounds that matter in play (Captions).
var captions: bool = false
## Less motion and flashing: a smaller zoom when aiming, eased in more slowly, and a
## gentler flash when hurt.
var reduce_motion: bool = false
func shadow_distance() -> float: func shadow_distance() -> float:
@@ -106,9 +127,7 @@ func apply_to_viewport(viewport: Viewport) -> void:
func save(path: String = DEFAULT_PATH) -> Error: func save(path: String = DEFAULT_PATH) -> Error:
var config: ConfigFile = ConfigFile.new() var config: ConfigFile = ConfigFile.new()
# The mouse keeps its own section, as InputSettings has always saved it. # The mouse keeps its own section, as InputSettings has always saved it.
config.set_value(InputSettings.SECTION, "mouse_sensitivity", mouse.mouse_sensitivity) mouse.write(config)
config.set_value(InputSettings.SECTION, "aim_sensitivity_scale", mouse.aim_sensitivity_scale)
config.set_value(InputSettings.SECTION, "invert_y", mouse.invert_y)
bindings.write(config) bindings.write(config)
config.set_value("graphics", "quality", quality) config.set_value("graphics", "quality", quality)
config.set_value("graphics", "print_pass", print_pass) config.set_value("graphics", "print_pass", print_pass)
@@ -123,6 +142,12 @@ func save(path: String = DEFAULT_PATH) -> Error:
config.set_value("practice", "bots", practice_bots) config.set_value("practice", "bots", practice_bots)
config.set_value("practice", "difficulty", practice_difficulty) config.set_value("practice", "difficulty", practice_difficulty)
config.set_value("practice", "team_size", practice_team_size) config.set_value("practice", "team_size", practice_team_size)
config.set_value("tutorial", "offered", tutorial_offered)
config.set_value("tutorial", "done", tutorial_done)
config.set_value("access", "vision", vision)
config.set_value("access", "ui_scale", ui_scale)
config.set_value("access", "captions", captions)
config.set_value("access", "reduce_motion", reduce_motion)
return config.save(path) return config.save(path)
@@ -150,6 +175,12 @@ static func load_from(path: String = DEFAULT_PATH) -> GameSettings:
settings.practice_bots = _int(config, "practice", "bots", settings.practice_bots) settings.practice_bots = _int(config, "practice", "bots", settings.practice_bots)
settings.practice_difficulty = _int(config, "practice", "difficulty", settings.practice_difficulty) settings.practice_difficulty = _int(config, "practice", "difficulty", settings.practice_difficulty)
settings.practice_team_size = _int(config, "practice", "team_size", settings.practice_team_size) settings.practice_team_size = _int(config, "practice", "team_size", settings.practice_team_size)
settings.tutorial_offered = _bool(config, "tutorial", "offered", settings.tutorial_offered)
settings.tutorial_done = _bool(config, "tutorial", "done", settings.tutorial_done)
settings.vision = _int(config, "access", "vision", settings.vision)
settings.ui_scale = _float(config, "access", "ui_scale", settings.ui_scale)
settings.captions = _bool(config, "access", "captions", settings.captions)
settings.reduce_motion = _bool(config, "access", "reduce_motion", settings.reduce_motion)
return settings return settings
@@ -158,6 +189,9 @@ static func load_from(path: String = DEFAULT_PATH) -> GameSettings:
## when there is none. ## when there is none.
func apply_to_program(tree: SceneTree) -> void: func apply_to_program(tree: SceneTree) -> void:
_apply_audio() _apply_audio()
Palette.vision = vision
if tree != null:
tree.root.content_scale_factor = ui_scale
if DisplayServer.get_name() == "headless": if DisplayServer.get_name() == "headless":
return return
Engine.max_fps = max_fps Engine.max_fps = max_fps
+109
View File
@@ -0,0 +1,109 @@
## Captions for the sounds that matter in play (A13), for players who can't hear them
## or play with the sound down: what was heard and, for placed sounds, which way it
## came from against where the camera looks. It reads the cues SoundDirector decided
## each frame, so a caption is shown exactly when its sound is played.
##
## Repeats of a caption refresh it rather than stacking ("Footsteps, behind" stays one
## line while they go on), the newest line is last, and lines fade after SECONDS.
## Sounds the player makes themselves (their own steps, shots and pieces) aren't
## captioned: they know.
class_name Captions
extends RefCounted
const SECONDS: float = 3.0
const MAX_LINES: int = 4
## Placed sounds closer than this to the player are their own.
const OWN_METRES: float = 2.5
## Footsteps further than this aren't worth a line.
const STEP_METRES: float = 20.0
## Each sound's words. Footsteps, shots and pieces go by prefix (see words_for()).
const WORDS: Dictionary = {
"foghorn": "Foghorn: the sea is rising",
"bell": "Ship's bell",
"surge": "A surge breaks",
"lighthouse": "Lighthouse tone: high water, last land",
"hurt": "You're hit",
"eliminated": "Someone is out",
"keg_blast": "Powder keg blast",
"hit_player": "Shot strikes someone",
"splash": "Splash",
"swim": "Swimming",
"swing_boathook": "Boathook swing",
"chest_open": "Chest opened",
}
## Live lines: words -> {"words", "side", "left" (seconds)}, newest last.
var _lines: Array[Dictionary] = []
## The words for a sound, or "" for one that isn't captioned.
static func words_for(sound: String) -> String:
if sound.begins_with("step_"):
return "Footsteps"
if sound.begins_with("shot_"):
return "Gunfire"
if sound.begins_with("break_"):
return "A piece breaks"
if sound.begins_with("build_"):
return "Building"
return String(WORDS.get(sound, ""))
## Which way `at` is from a listener at `eye` looking along `yaw` (simulation
## convention): "ahead", "right", "behind" or "left".
static func side_of(eye: Vector3, yaw: float, at: Vector3) -> String:
var to: Vector2 = Vector2(at.x - eye.x, at.z - eye.z)
if to.length() < 0.01:
return ""
var turn: float = angle_difference(yaw, atan2(to.x, to.y))
# Positive turn is to the left: yaw grows anticlockwise seen from above.
if absf(turn) <= PI / 4.0:
return "ahead"
if absf(turn) >= PI * 3.0 / 4.0:
return "behind"
return "left" if turn > 0.0 else "right"
## Takes a frame's cues. `eye` and `yaw` are the camera's; `own` is where the player
## is, or Vector3.INF with no player.
func hear(cues: Array[Dictionary], eye: Vector3, yaw: float, own: Vector3, delta: float) -> void:
for line: Dictionary in _lines:
line["left"] = float(line["left"]) - delta
_lines = _lines.filter(func(line: Dictionary) -> bool: return float(line["left"]) > 0.0)
for cue: Dictionary in cues:
var words: String = words_for(String(cue["sound"]))
if words.is_empty():
continue
var side: String = ""
if bool(cue["spatial"]):
var at: Vector3 = cue["at"]
if own != Vector3.INF and at.distance_to(own) < OWN_METRES:
continue
if words == "Footsteps" and own != Vector3.INF and at.distance_to(own) > STEP_METRES:
continue
side = side_of(eye, yaw, at)
_show(words, side)
func _show(words: String, side: String) -> void:
var text: String = words if side.is_empty() else "%s, %s" % [words, side]
for index: int in _lines.size():
if _lines[index]["text"] == text:
_lines.remove_at(index)
break
_lines.append({"text": text, "left": SECONDS})
while _lines.size() > MAX_LINES:
_lines.remove_at(0)
## The lines to show now, oldest first.
func lines() -> Array[String]:
var shown: Array[String] = []
for line: Dictionary in _lines:
shown.append(String(line["text"]))
return shown
func clear() -> void:
_lines.clear()
+1
View File
@@ -0,0 +1 @@
uid://cx1cgtph7dshj
+6 -6
View File
@@ -1,6 +1,6 @@
## The island as a hand-drawn nautical chart (A11): paper land with ink contours every ## 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 ## 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. ## 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 ## 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 var world: Simulation = null
## Place names and where they are, in world metres (x, z). ## Place names and where they are, in world metres (x, z).
var places: Array[Dictionary] = [] 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() var route: PackedVector2Array = PackedVector2Array()
## The player: position (x, z) in metres, facing (radians, the simulation's yaw), and ## The player: position (x, z) in metres, facing (radians, the simulation's yaw), and
## whether to draw them. ## 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`. ## 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. ## 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: func setup(simulation: Simulation, match_seed: int, drop: Drop = null, share: ChartMap = null) -> void:
world = simulation world = simulation
@@ -174,8 +174,8 @@ func _draw_overlay() -> void:
var coming: PackedByteArray = coming_flood(world) var coming: PackedByteArray = coming_flood(world)
var per_cell: int = maxi(roundi(PIXELS / float(flood.side)), 1) var per_cell: int = maxi(roundi(PIXELS / float(flood.side)), 1)
var taken: Color = Color(Palette.SEA_INK.lightened(0.3), 0.7) var taken: Color = Color(Palette.SEA_INK.lightened(0.3), 0.7)
var hatch: Color = Color(Palette.WARNING, 0.95) var hatch: Color = Color(Palette.warning(), 0.95)
var wash: Color = Color(Palette.WARNING, 0.16) var wash: Color = Color(Palette.warning(), 0.16)
for cz: int in flood.side: for cz: int in flood.side:
for cx: int in flood.side: for cx: int in flood.side:
var index: int = cz * flood.side + cx var index: int = cz * flood.side + cx
@@ -241,7 +241,7 @@ func _draw() -> void:
var ahead: Vector2 = Vector2(sin(facing), cos(facing)) var ahead: Vector2 = Vector2(sin(facing), cos(facing))
var side: Vector2 = Vector2(ahead.y, -ahead.x) var side: Vector2 = Vector2(ahead.y, -ahead.x)
var arrow: PackedVector2Array = PackedVector2Array([at + ahead * 11.0, at - ahead * 7.0 + side * 7.0, at - ahead * 3.0, at - ahead * 7.0 - side * 7.0]) var arrow: PackedVector2Array = PackedVector2Array([at + ahead * 11.0, at - ahead * 7.0 + side * 7.0, at - ahead * 3.0, at - ahead * 7.0 - side * 7.0])
draw_colored_polygon(arrow, Palette.OILSKIN) draw_colored_polygon(arrow, Palette.own())
arrow.append(arrow[0]) arrow.append(arrow[0])
draw_polyline(arrow, Palette.INK, 2.0) draw_polyline(arrow, Palette.INK, 2.0)
# North, and the frame's ink edge. # North, and the frame's ink edge.
+72 -13
View File
@@ -30,6 +30,8 @@ var _build: Label
var _down: Label var _down: Label
var _reticle: Reticle var _reticle: Reticle
var _hurt: HurtEdge var _hurt: HurtEdge
## Captions for key sounds (A13), above the materials, newest at the bottom.
var _captions: VBoxContainer
## When a feed line was first shown (msec), so lines fade after HudState.FEED_SECONDS. ## When a feed line was first shown (msec), so lines fade after HudState.FEED_SECONDS.
var _feed_seen: Dictionary = {} var _feed_seen: Dictionary = {}
## Captures turn this off to keep every line of the feed. ## Captures turn this off to keep every line of the feed.
@@ -81,11 +83,13 @@ func _init() -> void:
add_child(_vitals) add_child(_vitals)
_hotbar = HBoxContainer.new() _hotbar = HBoxContainer.new()
_hotbar.set_anchors_preset(Control.PRESET_CENTER_BOTTOM) # Placed by _fit_bottom(): centred, unless a larger interface size (A13) leaves no
# room, when it moves clear of the vitals and its slots narrow.
_hotbar.set_anchors_preset(Control.PRESET_BOTTOM_LEFT)
_hotbar.add_theme_constant_override("separation", 6) _hotbar.add_theme_constant_override("separation", 6)
_hotbar.alignment = BoxContainer.ALIGNMENT_CENTER _hotbar.alignment = BoxContainer.ALIGNMENT_CENTER
_hotbar.size = Vector2(6.0 * 86.0 + 5.0 * 6.0, 112.0) _hotbar.size = Vector2(6.0 * 86.0 + 5.0 * 6.0, 112.0)
_hotbar.position = Vector2(-_hotbar.size.x * 0.5, -112.0 - MARGIN) _hotbar.position = Vector2(640.0 - _hotbar.size.x * 0.5, -112.0 - MARGIN)
add_child(_hotbar) add_child(_hotbar)
_build = _label(FONT_BODY, Palette.PAPER) _build = _label(FONT_BODY, Palette.PAPER)
@@ -94,7 +98,7 @@ func _init() -> void:
_build.size = Vector2(520.0, 24.0) _build.size = Vector2(520.0, 24.0)
_build.position = Vector2(-260.0, -112.0 - MARGIN - 30.0) _build.position = Vector2(-260.0, -112.0 - MARGIN - 30.0)
add_child(_build) add_child(_build)
_down = _label(FONT_BODY, Palette.WARNING) _down = _label(FONT_BODY, Palette.warning())
_down.set_anchors_preset(Control.PRESET_CENTER_BOTTOM) _down.set_anchors_preset(Control.PRESET_CENTER_BOTTOM)
_down.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER _down.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_down.size = Vector2(720.0, 24.0) _down.size = Vector2(720.0, 24.0)
@@ -109,9 +113,23 @@ func _init() -> void:
_materials.position = Vector2(-190.0 - MARGIN, -84.0 - MARGIN) _materials.position = Vector2(-190.0 - MARGIN, -84.0 - MARGIN)
_materials.add_theme_constant_override("separation", 2) _materials.add_theme_constant_override("separation", 2)
add_child(_materials) add_child(_materials)
_captions = VBoxContainer.new()
_captions.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
_captions.size = Vector2(420.0, 4.0 * 24.0)
# Above the build line and the hotbar's top, so a long caption never runs into them.
_captions.position = Vector2(-420.0 - MARGIN, -112.0 - MARGIN - 52.0 - _captions.size.y)
_captions.alignment = BoxContainer.ALIGNMENT_END
_captions.add_theme_constant_override("separation", 2)
add_child(_captions)
show_state(state) show_state(state)
func _notification(what: int) -> void:
if what == NOTIFICATION_RESIZED and _hotbar != null:
_fit_bottom()
## Shows `shown`, and nothing that isn't in it. ## Shows `shown`, and nothing that isn't in it.
func show_state(shown: HudState) -> void: func show_state(shown: HudState) -> void:
state = shown state = shown
@@ -134,7 +152,7 @@ func show_state(shown: HudState) -> void:
for index: int in lines.size(): for index: int in lines.size():
var label: Label = _feed.get_child(index) as Label var label: Label = _feed.get_child(index) as Label
label.text = String(lines[index]["text"]) label.text = String(lines[index]["text"])
label.add_theme_color_override("font_color", Palette.OILSKIN if lines[index]["you"] else Palette.PAPER) label.add_theme_color_override("font_color", Palette.own() if lines[index]["you"] else Palette.PAPER)
if shown.feed.is_empty(): if shown.feed.is_empty():
_feed_seen.clear() _feed_seen.clear()
@@ -155,6 +173,7 @@ func show_state(shown: HudState) -> void:
var box: SlotBox = SlotBox.new() var box: SlotBox = SlotBox.new()
box.custom_minimum_size = Vector2(86.0, 112.0) box.custom_minimum_size = Vector2(86.0, 112.0)
_hotbar.add_child(box) _hotbar.add_child(box)
_fit_bottom()
for index: int in _hotbar.get_child_count(): for index: int in _hotbar.get_child_count():
var box: SlotBox = _hotbar.get_child(index) as SlotBox var box: SlotBox = _hotbar.get_child(index) as SlotBox
box.visible = index < shown.slots.size() box.visible = index < shown.slots.size()
@@ -169,13 +188,53 @@ func show_state(shown: HudState) -> void:
var count: int = shown.materials[code] if code < shown.materials.size() else 0 var count: int = shown.materials[code] if code < shown.materials.size() else 0
(_materials.get_child(code) as Label).text = "%s %d" % [Materials.NAMES[code].replace("_", " ").capitalize(), count] (_materials.get_child(code) as Label).text = "%s %d" % [Materials.NAMES[code].replace("_", " ").capitalize(), count]
_fit_labels(_captions, shown.captions.size(), HORIZONTAL_ALIGNMENT_RIGHT)
for index: int in shown.captions.size():
(_captions.get_child(index) as Label).text = "[ %s ]" % shown.captions[index]
_down.visible = shown.playing and shown.downed _down.visible = shown.playing and shown.downed
_down.add_theme_color_override("font_color", Palette.warning())
_build.visible = shown.playing and not shown.build.is_empty() _build.visible = shown.playing and not shown.build.is_empty()
if _build.visible: if _build.visible:
var build: Dictionary = shown.build var build: Dictionary = shown.build
_build.text = "BUILDING · %s in %s · costs %d%s" % [String(build["kind"]).capitalize(), String(build["material"]).replace("_", " "), _build.text = "BUILDING · %s in %s · costs %d%s" % [String(build["kind"]).capitalize(), String(build["material"]).replace("_", " "),
int(build["cost"]), "" if build["affordable"] else " · NOT ENOUGH"] int(build["cost"]), "" if build["affordable"] else " · NOT ENOUGH"]
_build.add_theme_color_override("font_color", Palette.PAPER if build["affordable"] else Palette.WARNING) _build.add_theme_color_override("font_color", Palette.PAPER if build["affordable"] else Palette.warning())
## The narrowest a hotbar slot gets when there isn't room for the full width.
const SLOT_WIDTH: float = 86.0
const SLOT_MIN_WIDTH: float = 66.0
## Places the hotbar between the vitals and the materials: centred when there is room,
## as at 1280x720; on a narrower canvas (a larger interface size) beside the vitals,
## with its slots narrowed to fit.
func _fit_bottom() -> void:
var count: int = maxi(_hotbar.get_child_count(), 1)
var gap: float = 6.0
var left: float = MARGIN + _vitals.size.x + 10.0
var right: float = size.x - MARGIN - _materials.size.x - 10.0
var slot: float = clampf((right - left - gap * (count - 1)) / count, SLOT_MIN_WIDTH, SLOT_WIDTH)
var width: float = slot * count + gap * (count - 1)
for child: Node in _hotbar.get_children():
(child as Control).custom_minimum_size = Vector2(slot, 112.0)
_hotbar.size = Vector2(width, 112.0)
var x: float = clampf(size.x * 0.5 - width * 0.5, left, maxf(left, right - width))
_hotbar.position = Vector2(x, size.y - 112.0 - MARGIN)
## Where the hotbar is drawn, for tests.
func hotbar_rect() -> Rect2:
return Rect2(_hotbar.position, _hotbar.size)
func vitals_rect() -> Rect2:
return Rect2(_vitals.position, _vitals.size)
func materials_rect() -> Rect2:
return Rect2(_materials.position, _materials.size)
## Keeps exactly `count` labels in `box`, adding or removing at the end. ## Keeps exactly `count` labels in `box`, adding or removing at the end.
@@ -262,12 +321,12 @@ class TidePost:
# The next level: a rust notch cut into both sides, with a dashed line across. # The next level: a rust notch cut into both sides, with a dashed line across.
if next > sea + 0.05: if next > sea + 0.05:
var next_y: float = to_y.call(next) var next_y: float = to_y.call(next)
draw_dashed_line(Vector2(post.position.x - 6.0, next_y), Vector2(post.end.x + 6.0, next_y), Palette.WARNING, 2.0, 4.0) draw_dashed_line(Vector2(post.position.x - 6.0, next_y), Vector2(post.end.x + 6.0, next_y), Palette.warning(), 2.0, 4.0)
draw_colored_polygon(PackedVector2Array([Vector2(post.position.x - 10.0, next_y - 5.0), Vector2(post.position.x - 2.0, next_y), Vector2(post.position.x - 10.0, next_y + 5.0)]), Palette.WARNING) draw_colored_polygon(PackedVector2Array([Vector2(post.position.x - 10.0, next_y - 5.0), Vector2(post.position.x - 2.0, next_y), Vector2(post.position.x - 10.0, next_y + 5.0)]), Palette.warning())
# The player's own height: a yellow pointer on the right of the post. # The player's own height: a yellow pointer on the right of the post.
if not is_nan(feet): if not is_nan(feet):
var feet_y: float = to_y.call(feet) var feet_y: float = to_y.call(feet)
draw_colored_polygon(PackedVector2Array([Vector2(post.end.x + 2.0, feet_y), Vector2(post.end.x + 12.0, feet_y - 6.0), Vector2(post.end.x + 12.0, feet_y + 6.0)]), Palette.OILSKIN) draw_colored_polygon(PackedVector2Array([Vector2(post.end.x + 2.0, feet_y), Vector2(post.end.x + 12.0, feet_y - 6.0), Vector2(post.end.x + 12.0, feet_y + 6.0)]), Palette.own())
draw_polyline(PackedVector2Array([Vector2(post.end.x + 2.0, feet_y), Vector2(post.end.x + 12.0, feet_y - 6.0), Vector2(post.end.x + 12.0, feet_y + 6.0), Vector2(post.end.x + 2.0, feet_y)]), Palette.INK, 1.0) draw_polyline(PackedVector2Array([Vector2(post.end.x + 2.0, feet_y), Vector2(post.end.x + 12.0, feet_y - 6.0), Vector2(post.end.x + 12.0, feet_y + 6.0), Vector2(post.end.x + 2.0, feet_y)]), Palette.INK, 1.0)
var x: float = post.end.x + 26.0 var x: float = post.end.x + 26.0
@@ -285,12 +344,12 @@ class TidePost:
timing = "HIGH WATER · last land" timing = "HIGH WATER · last land"
_: _:
timing = "Slack water" timing = "Slack water"
Hud.draw_text(self, Vector2(x, 54.0), timing, Hud.FONT_BODY, Palette.WARNING if stage != Tide.HOLD else Palette.INK, width) Hud.draw_text(self, Vector2(x, 54.0), timing, Hud.FONT_BODY, Palette.warning() if stage != Tide.HOLD else Palette.INK, width)
Hud.draw_text(self, Vector2(x, 74.0), "Sea %.1f m · next %.1f m" % [sea, next], Hud.FONT_SMALL, Palette.INK, width) Hud.draw_text(self, Vector2(x, 74.0), "Sea %.1f m · next %.1f m" % [sea, next], Hud.FONT_SMALL, Palette.INK, width)
if not is_nan(feet): if not is_nan(feet):
var above: float = feet - next var above: float = feet - next
var line: String = "You: %.1f m above the next line" % above if above >= 0.0 else "You: %.1f m BELOW the next line" % -above var line: String = "You: %.1f m above the next line" % above if above >= 0.0 else "You: %.1f m BELOW the next line" % -above
Hud.draw_text(self, Vector2(x, 92.0), line, Hud.FONT_SMALL, Palette.INK if above >= 0.0 else Palette.WARNING, width) Hud.draw_text(self, Vector2(x, 92.0), line, Hud.FONT_SMALL, Palette.INK if above >= 0.0 else Palette.warning(), width)
## Health and armour bars: each a number, a word, notches every quarter and its own ## Health and armour bars: each a number, a word, notches every quarter and its own
@@ -314,7 +373,7 @@ class Vitals:
Hud.draw_text(self, Vector2(10.0, rect.position.y + rect.size.y * 0.5 + 5.0), word, Hud.FONT_SMALL) Hud.draw_text(self, Vector2(10.0, rect.position.y + rect.size.y * 0.5 + 5.0), word, Hud.FONT_SMALL)
draw_rect(rect, Color(Palette.INK, 0.15)) draw_rect(rect, Color(Palette.INK, 0.15))
var filled: Rect2 = Rect2(rect.position, Vector2(rect.size.x * clampf(float(value) / most, 0.0, 1.0), rect.size.y)) var filled: Rect2 = Rect2(rect.position, Vector2(rect.size.x * clampf(float(value) / most, 0.0, 1.0), rect.size.y))
var fill: Color = Palette.WARNING if low else (Palette.SEA_PAINT if striped else Palette.OCHRE_RED.lerp(Palette.TAR, 0.1)) var fill: Color = Palette.warning() if low else (Palette.SEA_PAINT if striped else Palette.OCHRE_RED.lerp(Palette.TAR, 0.1))
draw_rect(filled, fill) draw_rect(filled, fill)
if striped or low: if striped or low:
# Armour is hatched one way; low health the other. # Armour is hatched one way; low health the other.
@@ -370,7 +429,7 @@ class SlotBox:
return return
Hud.draw_card(self, rect, selected) Hud.draw_card(self, rect, selected)
if selected: if selected:
draw_rect(Rect2(rect.position, Vector2(rect.size.x, 6.0)), Palette.OILSKIN) draw_rect(Rect2(rect.position, Vector2(rect.size.x, 6.0)), Palette.own())
draw_rect(Rect2(rect.position, Vector2(rect.size.x, 6.0)), Palette.INK, false, 1.0) draw_rect(Rect2(rect.position, Vector2(rect.size.x, 6.0)), Palette.INK, false, 1.0)
Hud.draw_text(self, rect.position + Vector2(5.0, 15.0), str(number), Hud.FONT_SMALL - 2, Palette.INK) Hud.draw_text(self, rect.position + Vector2(5.0, 15.0), str(number), Hud.FONT_SMALL - 2, Palette.INK)
var picture: Texture2D = ItemModels.icon(String(slot.get("id", ""))) var picture: Texture2D = ItemModels.icon(String(slot.get("id", "")))
@@ -450,7 +509,7 @@ class HurtEdge:
for step: int in steps: for step: int in steps:
var inset: float = band * step / steps var inset: float = band * step / steps
var alpha: float = 0.42 * strength * (1.0 - float(step) / steps) var alpha: float = 0.42 * strength * (1.0 - float(step) / steps)
var colour: Color = Color(Palette.WARNING, alpha / steps * 2.0) var colour: Color = Color(Palette.warning(), alpha / steps * 2.0)
var width: float = band / steps var width: float = band / steps
draw_rect(Rect2(inset, inset, size.x - inset * 2.0, width), colour) draw_rect(Rect2(inset, inset, size.x - inset * 2.0, width), colour)
draw_rect(Rect2(inset, size.y - inset - width, size.x - inset * 2.0, width), colour) draw_rect(Rect2(inset, size.y - inset - width, size.x - inset * 2.0, width), colour)
+2
View File
@@ -33,6 +33,8 @@ var reticle: bool = false
## flash for being hurt, each 1 just after and 0 when gone. ## flash for being hurt, each 1 just after and 0 when gone.
var hit: float = 0.0 var hit: float = 0.0
var hurt: float = 0.0 var hurt: float = 0.0
## Captions for key sounds (A13, Captions), oldest first; empty when they're off.
var captions: Array[String] = []
## The HUD for a client: its own predicted player, the world's tide and the server's feed. ## The HUD for a client: its own predicted player, the world's tide and the server's feed.
+62
View File
@@ -0,0 +1,62 @@
## The tutorial's card on the HUD (A12): a paper card under the minimap with the step
## counter, the step's title, what to do (naming the player's own keys) and how far
## along it is. Hidden until the player is in the match. Drawn like the HUD's other
## cards (Hud.draw_card); everything is words, so nothing relies on colour.
class_name TutorialCard
extends Control
const WIDTH: float = 340.0
const PADDING: float = 14.0
var _counter: Label
var _title: Label
var _body: Label
var _progress: Label
var _column: VBoxContainer
func _init() -> void:
name = "TutorialCard"
mouse_filter = Control.MOUSE_FILTER_IGNORE
_column = VBoxContainer.new()
_column.position = Vector2(PADDING, PADDING * 0.7)
_column.add_theme_constant_override("separation", 4)
_column.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_column)
_counter = _ink(Hud.FONT_SMALL, Palette.SEA_INK)
_title = _ink(Hud.FONT_TITLE, Palette.INK)
_body = _ink(Hud.FONT_BODY, Palette.INK)
_body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_body.custom_minimum_size = Vector2(WIDTH - PADDING * 2.0, 0.0)
_progress = _ink(Hud.FONT_SMALL, Palette.OCHRE_RED)
for label: Label in [_counter, _title, _body, _progress]:
_column.add_child(label)
visible = false
## Shows `tutorial`'s step, or hides the card while the player isn't in the match.
func show_tutorial(tutorial: Tutorial, playing: bool) -> void:
visible = tutorial != null and playing
if not visible:
return
_counter.text = tutorial.counter().to_upper()
_title.text = Tutorial.TITLES[tutorial.step]
_body.text = tutorial.instruction()
_progress.text = tutorial.progress()
_progress.visible = not _progress.text.is_empty()
var height: float = _column.get_combined_minimum_size().y + PADDING * 1.4
if not size.is_equal_approx(Vector2(WIDTH, height)):
size = Vector2(WIDTH, height)
queue_redraw()
func _draw() -> void:
Hud.draw_card(self, Rect2(Vector2.ZERO, size))
func _ink(font_size: int, colour: Color) -> Label:
var label: Label = Label.new()
label.add_theme_font_size_override("font_size", font_size)
label.add_theme_color_override("font_color", colour)
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
return label
+1
View File
@@ -0,0 +1 @@
uid://dimljb3jidhs8
+35 -1
View File
@@ -10,6 +10,8 @@ const MIN_SENSITIVITY: float = 0.05
const MAX_SENSITIVITY: float = 10.0 const MAX_SENSITIVITY: float = 10.0
## Looking straight up or down flips the camera basis, so stop just short. ## Looking straight up or down flips the camera basis, so stop just short.
const PITCH_LIMIT: float = deg_to_rad(85.0) const PITCH_LIMIT: float = deg_to_rad(85.0)
const MIN_PAD_SENSITIVITY: float = 0.2
const MAX_PAD_SENSITIVITY: float = 3.0
var mouse_sensitivity: float = 1.0: var mouse_sensitivity: float = 1.0:
set(value): set(value):
@@ -19,6 +21,12 @@ var aim_sensitivity_scale: float = 0.6:
set(value): set(value):
aim_sensitivity_scale = clampf(value, 0.1, 2.0) aim_sensitivity_scale = clampf(value, 0.1, 2.0)
var invert_y: bool = false var invert_y: bool = false
## The gamepad's right stick, against PadInput.LOOK_RADIANS_PER_SECOND (A13).
var pad_sensitivity: float = 1.0:
set(value):
pad_sensitivity = clampf(value, MIN_PAD_SENSITIVITY, MAX_PAD_SENSITIVITY)
## Aim assist for the gamepad (AimAssist). Never applies to the mouse.
var aim_assist: bool = true
## Applies a mouse motion to a look direction. Returns Vector2(yaw, pitch) in radians. ## Applies a mouse motion to a look direction. Returns Vector2(yaw, pitch) in radians.
@@ -33,13 +41,33 @@ func apply_mouse(relative: Vector2, yaw: float, pitch: float, aiming: bool) -> V
return Vector2(new_yaw, new_pitch) return Vector2(new_yaw, new_pitch)
## Applies `delta` seconds of the right stick (PadInput.look(): x right, y down) to a
## look direction, slowed by `friction` (AimAssist). Returns Vector2(yaw, pitch).
## Pushing right turns right and pushing up looks up, unless invert_y is set.
func apply_stick(stick: Vector2, yaw: float, pitch: float, aiming: bool, delta: float, friction: float = 1.0) -> Vector2:
var scale: float = PadInput.LOOK_RADIANS_PER_SECOND * pad_sensitivity * delta * friction
if aiming:
scale *= aim_sensitivity_scale
var vertical: float = stick.y if invert_y else -stick.y
var new_yaw: float = fposmod(yaw - stick.x * scale, TAU)
var new_pitch: float = clampf(pitch + vertical * scale, -PITCH_LIMIT, PITCH_LIMIT)
return Vector2(new_yaw, new_pitch)
func save(path: String = DEFAULT_PATH) -> Error: func save(path: String = DEFAULT_PATH) -> Error:
var config: ConfigFile = ConfigFile.new() var config: ConfigFile = ConfigFile.new()
config.load(path) # Keep other sections; a missing file is fine. config.load(path) # Keep other sections; a missing file is fine.
write(config)
return config.save(path)
## Writes these settings into `config`'s input section.
func write(config: ConfigFile) -> void:
config.set_value(SECTION, "mouse_sensitivity", mouse_sensitivity) config.set_value(SECTION, "mouse_sensitivity", mouse_sensitivity)
config.set_value(SECTION, "aim_sensitivity_scale", aim_sensitivity_scale) config.set_value(SECTION, "aim_sensitivity_scale", aim_sensitivity_scale)
config.set_value(SECTION, "invert_y", invert_y) config.set_value(SECTION, "invert_y", invert_y)
return config.save(path) config.set_value(SECTION, "pad_sensitivity", pad_sensitivity)
config.set_value(SECTION, "aim_assist", aim_assist)
## Loads saved settings. Missing or malformed values keep their defaults. ## Loads saved settings. Missing or malformed values keep their defaults.
@@ -57,4 +85,10 @@ static func load_from(path: String = DEFAULT_PATH) -> InputSettings:
var invert: Variant = config.get_value(SECTION, "invert_y", false) var invert: Variant = config.get_value(SECTION, "invert_y", false)
if invert is bool: if invert is bool:
settings.invert_y = invert settings.invert_y = invert
var pad: Variant = config.get_value(SECTION, "pad_sensitivity", 1.0)
if (pad is float and is_finite(pad)) or pad is int:
settings.pad_sensitivity = float(pad)
var assist: Variant = config.get_value(SECTION, "aim_assist", true)
if assist is bool:
settings.aim_assist = assist
return settings return settings
+2 -1
View File
@@ -39,6 +39,7 @@ func apply_settings(settings: GameSettings) -> void:
print_pass.visible = settings.print_pass print_pass.visible = settings.print_pass
if effects != null: if effects != null:
effects.budget = settings.particle_budget() effects.budget = settings.particle_budget()
rig.reduce_motion = settings.reduce_motion
## Builds the scene for `simulation`. `local_id` is the player this client plays, or 0. ## Builds the scene for `simulation`. `local_id` is the player this client plays, or 0.
@@ -121,7 +122,7 @@ func follow(entity_id: int, pitch: float = NAN, look_yaw: float = NAN) -> bool:
return false return false
var yaw: float = look_yaw if not is_nan(look_yaw) else float(player.yaw) / PlayerCommand.YAW_STEPS * TAU 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) 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. # one point the simulation carries every passenger at.
var feet: Vector3 = player.position var feet: Vector3 = player.position
var figure: Node3D = entities.figure_of(entity_id) var figure: Node3D = entities.figure_of(entity_id)
+177
View File
@@ -0,0 +1,177 @@
## The gamepad (A13): one fixed layout, read from the input events the game is given
## rather than from the Input singleton, so tests can drive it with simulated events and
## any pad (device) works. Buttons use Godot's JoyButton positions, named here as on the
## common layouts (south A, east B, west X, north Y).
##
## Left stick move · right stick look · click the left stick to sprint (until you stop)
## South jump · East crouch · West reload · North pick up or open
## Right trigger use, fire or place · left trigger aim
## Right bumper next slot or piece · left bumper the one before
## Click the right stick: build mode · D-pad up the chart · D-pad down drop the held item
## D-pad right / left: next / previous material · Start the pause menu
##
## In the menus the D-pad and the left stick move the focus (Godot's own ui_ actions),
## South chooses and East or Start goes back (install_menu_actions()).
class_name PadInput
extends RefCounted
## Sticks inside this radius count as centred.
const DEADZONE: float = 0.18
## A trigger pulled further than this is held.
const TRIGGER_PULL: float = 0.45
## Radians a second the look turns with the right stick pushed fully, at look speed 1.
const LOOK_RADIANS_PER_SECOND: float = 3.2
## The look's response: stick deflection (past the dead zone) raised to this, so small
## pushes turn finely and full pushes turn fast.
const LOOK_CURVE: float = 1.7
## Actions held while their button is.
const HELD_BUTTONS: Dictionary = {
"jump": JOY_BUTTON_A, "crouch": JOY_BUTTON_B, "reload": JOY_BUTTON_X,
"interact": JOY_BUTTON_Y,
}
## Actions held while their trigger is pulled.
const HELD_TRIGGERS: Dictionary = {
"fire": JOY_AXIS_TRIGGER_RIGHT, "aim": JOY_AXIS_TRIGGER_LEFT,
}
## Actions that happen once per press. "drop" is also held (the command's drop button),
## so it is in both: pressed() reports it and held() holds it.
const PRESS_BUTTONS: Dictionary = {
JOY_BUTTON_RIGHT_STICK: "build", JOY_BUTTON_DPAD_UP: "map",
JOY_BUTTON_DPAD_RIGHT: "material", JOY_BUTTON_DPAD_LEFT: "material_back",
JOY_BUTTON_RIGHT_SHOULDER: "slot_next", JOY_BUTTON_LEFT_SHOULDER: "slot_back",
JOY_BUTTON_LEFT_STICK: "sprint", JOY_BUTTON_START: "pause",
}
const DROP_BUTTON: JoyButton = JOY_BUTTON_DPAD_DOWN
## Names for the settings menu and the tutorial, by action.
const NAMES: Dictionary = {
"forward": "Left stick", "back": "Left stick", "left": "Left stick", "right": "Left stick",
"look": "Right stick", "jump": "South (A)", "crouch": "East (B)", "reload": "West (X)",
"interact": "North (Y)", "fire": "Right trigger", "aim": "Left trigger",
"sprint": "Click left stick", "build": "Click right stick", "map": "D-pad up",
"drop": "D-pad down", "material": "D-pad right", "material_back": "D-pad left",
"slot_next": "Right bumper", "slot_back": "Left bumper", "pause": "Start",
}
## The layout as the settings menu lists it: [what, which].
const LAYOUT: Array[Array] = [
["Move", "Left stick"], ["Look", "Right stick"], ["Sprint (until you stop)", "Click left stick"],
["Jump", "South (A)"], ["Crouch", "East (B)"], ["Reload", "West (X)"],
["Pick up or open", "North (Y)"], ["Use, fire or place", "Right trigger"],
["Aim", "Left trigger"], ["Next slot or piece", "Right bumper"],
["Slot or piece before", "Left bumper"], ["Build mode", "Click right stick"],
["Chart", "D-pad up"], ["Drop held item", "D-pad down"],
["Next / previous material", "D-pad right / left"], ["Pause menu", "Start"],
]
var _buttons: Dictionary = {}
var _axes: PackedFloat32Array = PackedFloat32Array()
## Presses since the last take_presses(), as action ids, in order.
var _presses: Array[String] = []
## True once the pad has been used since the keyboard or mouse last was, so prompts
## can name pad buttons.
var active: bool = false
func _init() -> void:
_axes.resize(JOY_AXIS_MAX)
## Takes one input event. Returns true if it was the pad's.
func feed(event: InputEvent) -> bool:
var button: InputEventJoypadButton = event as InputEventJoypadButton
if button != null:
var index: int = int(button.button_index)
var was: bool = bool(_buttons.get(index, false))
_buttons[index] = button.pressed
if button.pressed and not was:
active = true
if PRESS_BUTTONS.has(index):
_presses.append(String(PRESS_BUTTONS[index]))
return true
var motion: InputEventJoypadMotion = event as InputEventJoypadMotion
if motion != null:
var axis: int = int(motion.axis)
if axis >= 0 and axis < _axes.size():
_axes[axis] = clampf(motion.axis_value, -1.0, 1.0)
if absf(motion.axis_value) > 0.5:
active = true
return true
if event is InputEventKey or event is InputEventMouseButton:
active = false
return false
## The once-per-press actions since the last call, oldest first.
func take_presses() -> Array[String]:
var taken: Array[String] = _presses
_presses = []
return taken
func is_held(action: String) -> bool:
if action == "drop":
return bool(_buttons.get(int(DROP_BUTTON), false))
if HELD_BUTTONS.has(action):
return bool(_buttons.get(int(HELD_BUTTONS[action]), false))
if HELD_TRIGGERS.has(action):
return _axes[int(HELD_TRIGGERS[action])] > TRIGGER_PULL
return false
## The left stick as Vector2(strafe right, forward), dead zone removed, length up to 1.
func move() -> Vector2:
var stick: Vector2 = _stick(JOY_AXIS_LEFT_X, JOY_AXIS_LEFT_Y)
return Vector2(stick.x, -stick.y)
## The right stick, dead zone removed and curved: x right, y down, length up to 1.
func look() -> Vector2:
var stick: Vector2 = _stick(JOY_AXIS_RIGHT_X, JOY_AXIS_RIGHT_Y)
var length: float = stick.length()
if length <= 0.0:
return Vector2.ZERO
return stick / length * pow(length, LOOK_CURVE)
## Forgets everything held (the pad was unplugged, or a menu opened).
func release() -> void:
_buttons.clear()
_axes.fill(0.0)
_presses.clear()
## A stick with a radial dead zone, rescaled so it starts from 0 at the zone's edge.
func _stick(x_axis: JoyAxis, y_axis: JoyAxis) -> Vector2:
var raw: Vector2 = Vector2(_axes[int(x_axis)], _axes[int(y_axis)])
var length: float = raw.length()
if length <= DEADZONE:
return Vector2.ZERO
return raw / length * minf((length - DEADZONE) / (1.0 - DEADZONE), 1.0)
## The name of the pad input for `action`, for prompts.
static func describe(action: String) -> String:
if action.begins_with("slot_") and not NAMES.has(action):
return "Bumpers"
return String(NAMES.get(action, "?"))
## Adds the pad to Godot's menu actions: South chooses, East and Start go back. The
## D-pad and the left stick already move the focus. Safe to call more than once.
static func install_menu_actions() -> void:
_add_button("ui_accept", JOY_BUTTON_A)
_add_button("ui_cancel", JOY_BUTTON_B)
_add_button("ui_cancel", JOY_BUTTON_START)
static func _add_button(action: String, index: JoyButton) -> void:
if not InputMap.has_action(action):
return
for existing: InputEvent in InputMap.action_get_events(action):
var pad: InputEventJoypadButton = existing as InputEventJoypadButton
if pad != null and pad.button_index == index:
return
var event: InputEventJoypadButton = InputEventJoypadButton.new()
event.button_index = index
event.device = -1
InputMap.action_add_event(action, event)
+1
View File
@@ -0,0 +1 @@
uid://bftj1asrutyll
+46
View File
@@ -116,3 +116,49 @@ const GHOST_REFUSED: Color = Color(0.86, 0.32, 0.22, 0.38)
const WARNING: Color = Color(0.86, 0.32, 0.22) const WARNING: Color = Color(0.86, 0.32, 0.22)
## The sea on the HUD's tide gauge and map. ## The sea on the HUD's tide gauge and map.
const SEA_INK: Color = Color(0.20, 0.34, 0.42) const SEA_INK: Color = Color(0.20, 0.34, 0.42)
# --- Colour vision (A13) ------------------------------------------------------------
## The signal colours above suit most eyes, but red against green (the build ghost) and
## rust against oilskin yellow are hard for many people to tell apart. The settings
## offer a set for each common kind of colour blindness; everything that signals asks
## for its colour through the functions below, so the set chosen applies everywhere.
## test_palette checks each set with a simulation of the colour vision it is for.
const VISION_NAMES: Array[String] = ["Standard", "Red-green (protan, deutan)", "Blue-yellow (tritan)"]
const VISION_STANDARD: int = 0
const VISION_RED_GREEN: int = 1
const VISION_BLUE_YELLOW: int = 2
## Per set: allowed and refused in the build ghost, danger, and the player's own marks.
const VISION_SIGNALS: Array[Dictionary] = [
{"ghost_ok": GHOST_OK, "ghost_refused": GHOST_REFUSED, "warning": WARNING, "own": OILSKIN},
# Blue for allowed and orange for refused; danger a deep magenta, apart from the
# yellow of the player's own marks.
{"ghost_ok": Color(0.22, 0.52, 0.95, 0.40), "ghost_refused": Color(0.98, 0.56, 0.08, 0.40),
"warning": Color(0.78, 0.16, 0.62), "own": OILSKIN},
# Teal for allowed and vermilion for refused; the player's marks turn white-blue,
# since yellow and pink run together.
{"ghost_ok": Color(0.16, 0.70, 0.74, 0.40), "ghost_refused": Color(0.90, 0.16, 0.20, 0.40),
"warning": Color(0.88, 0.14, 0.18), "own": Color(0.62, 0.86, 0.98)},
]
## Which set is in use. GameSettings.apply_to_program sets it.
static var vision: int = VISION_STANDARD:
set(value):
vision = clampi(value, 0, VISION_SIGNALS.size() - 1)
static func ghost_ok() -> Color:
return VISION_SIGNALS[vision]["ghost_ok"]
static func ghost_refused() -> Color:
return VISION_SIGNALS[vision]["ghost_refused"]
## Danger on the HUD and chart (WARNING in the standard set).
static func warning() -> Color:
return VISION_SIGNALS[vision]["warning"]
## The player's own marks on the HUD and chart (OILSKIN in the standard set).
static func own() -> Color:
return VISION_SIGNALS[vision]["own"]
+2 -2
View File
@@ -7,7 +7,7 @@
## packets to receive() and sends whatever advance() leaves in `outbox`. ## 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 ## 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 ## 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 ## 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 ## messages say what the player carries (`replica`, a ClientWorld). Pieces the player
@@ -322,7 +322,7 @@ func _take_snapshot() -> void:
_recent.clear() _recent.clear()
return return
if not prediction.active: 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)) prediction.begin(world.ground, Drop.plan(world.ground, SimRng.new(world_seed), 0))
clock.start(receiver.sim_tick) clock.start(receiver.sim_tick)
clock.observe(receiver.sim_tick, receiver.command_tick) clock.observe(receiver.sim_tick, receiver.command_tick)
+9 -9
View File
@@ -5,7 +5,7 @@
## pieces, props, chests and tide in line with the server. This adds the rest of the ## 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, ## 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 ## 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 ## here is authoritative, and nothing reads it back but views and the client's own
## check before placing a piece. ## check before placing a piece.
class_name ClientMirror class_name ClientMirror
@@ -16,8 +16,8 @@ extends RefCounted
var watched_id: int = 0 var watched_id: int = 0
## The client's own player while it is in the match, or 0. ## The client's own player while it is in the match, or 0.
var own_id: int = 0 var own_id: int = 0
## Where the barge is being drawn, or Vector3.INF when it isn't crossing. ## Where the ship is being drawn, or Vector3.INF when it isn't crossing.
var barge_at: Vector3 = Vector3.INF var ship_at: Vector3 = Vector3.INF
## The moment being drawn, in simulation ticks. ## The moment being drawn, in simulation ticks.
var time: float = 0.0 var time: float = 0.0
@@ -35,7 +35,7 @@ func sync(game: ClientGame) -> void:
var world: Simulation = game.world var world: Simulation = game.world
watched_id = 0 watched_id = 0
own_id = 0 own_id = 0
barge_at = Vector3.INF ship_at = Vector3.INF
if world == null: if world == null:
return return
var receiver: SnapshotReceiver = game.receiver var receiver: SnapshotReceiver = game.receiver
@@ -60,7 +60,7 @@ func sync(game: ClientGame) -> void:
_drop.finished = _drop.is_over(world.tick) _drop.finished = _drop.is_over(world.tick)
world.drop = _drop world.drop = _drop
if not _drop.finished: 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: else:
world.drop = null 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 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. # What is in the player's hands, for whoever draws it: the item's code, or -1.
entity.item = record[NetSnapshot.R_HELD] - 1 entity.item = record[NetSnapshot.R_HELD] - 1
if entity.drop_state == Drop.ABOARD and barge_at != Vector3.INF: if entity.drop_state == Drop.ABOARD and ship_at != Vector3.INF:
entity.position = barge_at entity.position = ship_at
## The client's own player: where and how it was predicted, not where the server last ## 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.velocity = me.velocity
entity.reload_ticks = me.reload_ticks entity.reload_ticks = me.reload_ticks
entity.use_ticks = me.use_ticks entity.use_ticks = me.use_ticks
if me.drop_state == Drop.ABOARD and barge_at != Vector3.INF: if me.drop_state == Drop.ABOARD and ship_at != Vector3.INF:
entity.position = barge_at entity.position = ship_at
+1 -1
View File
@@ -157,7 +157,7 @@ func _run(tick: int) -> void:
return return
_drop.ride(player, command, tick) _drop.ride(player, command, tick)
if player.drop_state == Drop.ABOARD and _drop.is_over(tick + 1): 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 return
var water: float = _water_at(player.position) var water: float = _water_at(player.position)
Movement.step(player, command, _ground, water) Movement.step(player, command, _ground, water)
+9 -2
View File
@@ -20,7 +20,12 @@ const RECORD_SIZE: int = 8 + PlayerCommand.ENCODED_SIZE
const MAX_RAW_BYTES: int = 64 * 1024 * 1024 const MAX_RAW_BYTES: int = 64 * 1024 * 1024
const RULE_KEYS: Array[String] = [ const RULE_KEYS: Array[String] = [
"max_players", "min_players", "team_size", "lobby_ticks", "countdown_ticks", "results_ticks", "fill_with_bots", "max_players", "min_players", "team_size", "lobby_ticks", "countdown_ticks", "results_ticks", "fill_with_bots",
"last_team_wins", "starting_kit",
] ]
## Rules added after logs were first written (A12): a log without them takes the default.
const OPTIONAL_RULE_KEYS: Array[String] = ["last_team_wins", "starting_kit"]
## Rules that are booleans.
const BOOL_RULE_KEYS: Array[String] = ["fill_with_bots", "last_team_wins", "starting_kit"]
var session_seed: int = 0 var session_seed: int = 0
## Human participants, who join with handles 1 and up before the first tick. ## Human participants, who join with handles 1 and up before the first tick.
@@ -139,10 +144,12 @@ static func from_bytes(bytes: PackedByteArray) -> CommandLog:
for key: String in RULE_KEYS: for key: String in RULE_KEYS:
# A hand-edited or damaged file could hold any JSON here; int() of an array or # A hand-edited or damaged file could hold any JSON here; int() of an array or
# a dictionary is an error, so only numbers and booleans are read (H5). # a dictionary is an error, so only numbers and booleans are read (H5).
if not rule_values.has(key) and OPTIONAL_RULE_KEYS.has(key):
continue
if not rule_values.has(key) or not _is_number(rule_values[key]): if not rule_values.has(key) or not _is_number(rule_values[key]):
return null return null
if key == "fill_with_bots": if BOOL_RULE_KEYS.has(key):
result.rules.fill_with_bots = bool(rule_values[key]) result.rules.set(key, bool(rule_values[key]))
else: else:
result.rules.set(key, int(rule_values[key])) result.rules.set(key, int(rule_values[key]))
result.rules.max_players = clampi(result.rules.max_players, 1, Tuning.SOLO_PLAYERS) result.rules.max_players = clampi(result.rules.max_players, 1, Tuning.SOLO_PLAYERS)
+1 -1
View File
@@ -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): for handle: int in range(1, human_players + 1):
match_flow.join(handle) match_flow.join(handle)
if rules.lobby_ticks == 0 and rules.countdown_ticks == 0: 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() _advance()
+1 -1
View File
@@ -14,7 +14,7 @@ extends RefCounted
enum Result { enum Result {
OK, OK,
## Dead, swimming, aboard the barge or falling. ## Dead, swimming, aboard the ship or falling.
NOT_ALLOWED, NOT_ALLOWED,
## Unknown piece kind or material. ## Unknown piece kind or material.
BAD_REQUEST, BAD_REQUEST,
+181 -45
View File
@@ -1,78 +1,128 @@
## The start of a match: a sky barge drifts across the island on a seeded straight route, ## The start of a match (#72): a packet ship sails a seeded straight line past the
## carrying every player. Each one leaps when they choose, falls, opens a wing-sail ## island, offshore, carrying every player. Each one fires themselves inland by lifeline
## (by hand, or automatically near the ground) and steers down. Anyone still aboard ## mortar when they choose: the look direction sets the heading, and how high they aim
## when the barge reaches the end of its route is thrown off. ## 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 ## The route is drawn from the "drop" stream: a heading, and the side of the island the
## middle that the route passes through, so it always crosses land. Movement handles ## ship passes on. It passes as close in as it can while keeping SHIP_COAST_CLEARANCE
## falling and gliding; this owns the barge, boarding and leaping. ## 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 class_name Drop
extends RefCounted 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 NONE: int = 0
const ABOARD: int = 1 const ABOARD: int = 1
const FREEFALL: int = 2 const FREEFALL: int = 2
const GLIDING: int = 3 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 start: Vector3 = Vector3.ZERO
var finish: 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 var duration_ticks: int = 0
## Simulation tick the drop began on. ## Simulation tick the drop began on.
var began_tick: int = 0 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 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: static func plan(island_ground: SimGround, rng: SimRng, tick: int) -> Drop:
var drop: Drop = Drop.new() var drop: Drop = Drop.new()
var stream: RandomNumberGenerator = rng.stream("drop") var stream: RandomNumberGenerator = rng.stream("drop")
var size: float = Tuning.WORLD_SIZE_METRES var size: float = Tuning.WORLD_SIZE_METRES
var centre: Vector2 = Vector2(size, size) * 0.5 var centre: Vector2 = Vector2(size, size) * 0.5
var heading: float = stream.randf() * TAU var margin: float = Tuning.SHIP_ROUTE_MARGIN
var jitter_angle: float = stream.randf() * TAU var best_a: Vector2 = Vector2.ZERO
var jitter: float = sqrt(stream.randf()) * Tuning.BARGE_CENTRE_JITTER var best_b: Vector2 = Vector2.ZERO
var through: Vector2 = centre + Vector2(cos(jitter_angle), sin(jitter_angle)) * jitter var found: bool = false
# Pull the crossing point onto land if the jitter put it over water. for _try: int in Tuning.SHIP_ROUTE_TRIES:
var tries: int = 0 var heading: float = stream.randf() * TAU
while island_ground.terrain_height(through.x, through.y) <= Tuning.ISLAND_BEACH_TOP and tries < 16: var side: float = 1.0 if stream.randf() < 0.5 else -1.0
through = through.lerp(centre, 0.5) var direction: Vector2 = Vector2(cos(heading), sin(heading))
tries += 1 # Away from the island, on the chosen side.
var direction: Vector2 = Vector2(cos(heading), sin(heading)) var outward: Vector2 = Vector2(-direction.y, direction.x) * side
var margin: float = Tuning.BARGE_ROUTE_MARGIN var offset: float = Tuning.SHIP_OFFSET_MIN
var back: float = _distance_to_edge(through, -direction, margin, size) while offset <= Tuning.SHIP_OFFSET_MAX:
var ahead: float = _distance_to_edge(through, direction, margin, size) var through: Vector2 = centre + outward * offset
var a: Vector2 = through - direction * back var a: Vector2 = through - direction * _distance_to_edge(through, -direction, margin, size)
var b: Vector2 = through + direction * ahead var b: Vector2 = through + direction * _distance_to_edge(through, direction, margin, size)
drop.start = Vector3(a.x, Tuning.BARGE_ALTITUDE, a.y) if a.distance_to(b) < Tuning.SHIP_MIN_ROUTE_METRES:
drop.finish = Vector3(b.x, Tuning.BARGE_ALTITUDE, b.y) break
drop.duration_ticks = maxi(ceili(a.distance_to(b) / Tuning.BARGE_SPEED * Tuning.TICK_RATE_HZ), 1) 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 drop.began_tick = tick
return drop 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: func progress(tick: int) -> float:
return clampf(float(tick - began_tick) / duration_ticks, 0.0, 1.0) 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)) return start.lerp(finish, progress(tick))
func barge_velocity() -> Vector3: func ship_velocity() -> Vector3:
return (finish - start) / (float(duration_ticks) / Tuning.TICK_RATE_HZ) 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: func is_over(tick: int) -> bool:
return tick - began_tick >= duration_ticks 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: func route_samples(step: float) -> PackedVector2Array:
var points: PackedVector2Array = PackedVector2Array() var points: PackedVector2Array = PackedVector2Array()
var a: Vector2 = Vector2(start.x, start.z) var a: Vector2 = Vector2(start.x, start.z)
@@ -83,7 +133,7 @@ func route_samples(step: float) -> PackedVector2Array:
return points 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: static func board(player: SimEntity, at: Vector3) -> void:
player.drop_state = ABOARD player.drop_state = ABOARD
player.position = at player.position = at
@@ -92,25 +142,111 @@ static func board(player: SimEntity, at: Vector3) -> void:
player.swimming = false player.swimming = false
## Throws a player off the barge into freefall, keeping some of the barge's speed. # The lifeline mortar
func leap(player: SimEntity, tick: int) -> void:
## 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.drop_state = FREEFALL
player.position = barge_position(tick) player.position = ship_position(tick)
var carried: Vector3 = barge_velocity() * Tuning.LEAP_CARRY player.velocity = launch_velocity(yaw_radians, charge)
player.velocity = Vector3(carried.x, 0.0, carried.z)
player.on_ground = false player.on_ground = false
## A tick aboard the barge: jump leaps off, anything else rides along. The server and a ## How far over level ground a shot with `charge` carries while the player keeps
## client predicting its own player both come through here. ## 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: func ride(player: SimEntity, command: PlayerCommand, tick: int) -> void:
if command != null: if command != null:
player.yaw = command.yaw player.yaw = command.yaw
player.pitch = command.pitch player.pitch = command.pitch
if command.is_pressed(PlayerCommand.BUTTON_JUMP): if command.is_pressed(PlayerCommand.BUTTON_JUMP):
leap(player, tick) fire(player, tick, command.yaw_radians(), charge_for_pitch(command.pitch_radians()))
return 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]. ## Distance from `from` along unit `direction` to the square [margin, size - margin].
+14 -3
View File
@@ -125,7 +125,7 @@ func in_match() -> bool:
## Adds a participant. Returns false if the handle is already here or the lobby is ## 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. ## full. During a match they wait for the next one.
func join(handle: int, bot: bool = false) -> bool: 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: if in_match() or phase == RESULTS:
return false return false
if participants.has(handle) or watchers.has(handle) or participants.size() >= rules.max_players: 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 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: func _start() -> void:
if rules.fill_with_bots: if rules.fill_with_bots:
while participants.size() < rules.max_players: while participants.size() < rules.max_players:
@@ -254,6 +254,8 @@ func _start() -> void:
handle_of[entity_id] = handle handle_of[entity_id] = handle
team_of[handle] = index / size team_of[handle] = index / size
sim.set_team(entity_id, index / size) sim.set_team(entity_id, index / size)
if rules.starting_kit:
_give_kit(sim.entities.find(entity_id))
stats[handle] = {"eliminations": 0, "damage_dealt": 0, "damage_taken": 0} stats[handle] = {"eliminations": 0, "damage_dealt": 0, "damage_taken": 0}
_match_size = participants.size() _match_size = participants.size()
_roster = participants.duplicate() _roster = participants.duplicate()
@@ -266,6 +268,13 @@ func _start() -> void:
_check_finished() _check_finished()
## Tuning.TUTORIAL_KIT: a weapon with a full magazine and spare ammunition.
static func _give_kit(player: SimEntity) -> void:
var weapon: int = ItemCatalog.code_of(String(Tuning.TUTORIAL_KIT["weapon"]))
Inventory.give(player, weapon, 1)
Inventory.give(player, ItemCatalog.code_of(String(Tuning.TUTORIAL_KIT["ammo"])), int(Tuning.TUTORIAL_KIT["spare"]))
## Adds up damage between opponents and remembers each victim's last weapon. ## Adds up damage between opponents and remembers each victim's last weapon.
func _collect_damage() -> void: func _collect_damage() -> void:
for event: Dictionary in sim.events: for event: Dictionary in sim.events:
@@ -358,7 +367,9 @@ func _check_finished() -> void:
for handle: int in living: for handle: int in living:
teams[team_of[handle]] = true teams[team_of[handle]] = true
var timed_out: bool = sim.tide != null and sim.tide.stage_at(sim.tick) == Tide.OVER var timed_out: bool = sim.tide != null and sim.tide.stage_at(sim.tick) == Tide.OVER
if teams.size() > 1 and not timed_out: # Without last_team_wins (the tutorial), one team standing plays on.
var enough: int = 1 if rules.last_team_wins else 0
if teams.size() > enough and not timed_out:
return return
winners.clear() winners.clear()
if teams.size() >= 1: if teams.size() >= 1:
+17
View File
@@ -16,6 +16,11 @@ var countdown_ticks: int = roundi(Tuning.MATCH_COUNTDOWN_SECONDS * Tuning.TICK_R
var results_ticks: int = roundi(Tuning.MATCH_RESULTS_SECONDS * Tuning.TICK_RATE_HZ) var results_ticks: int = roundi(Tuning.MATCH_RESULTS_SECONDS * Tuning.TICK_RATE_HZ)
## Fill empty places with bots when the match starts. ## Fill empty places with bots when the match starts.
var fill_with_bots: bool = true var fill_with_bots: bool = true
## The match ends when one team is left standing. The tutorial (A12) turns this off,
## so a player alone on the island plays on until the tide ends it.
var last_team_wins: bool = true
## Every player starts with Tuning.TUTORIAL_KIT in hand (A12).
var starting_kit: bool = false
## Rules for a server that skips the lobby: the match starts on the first tick. ## Rules for a server that skips the lobby: the match starts on the first tick.
@@ -24,3 +29,15 @@ static func immediate() -> MatchRules:
rules.lobby_ticks = 0 rules.lobby_ticks = 0
rules.countdown_ticks = 0 rules.countdown_ticks = 0
return rules return rules
## 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()
rules.max_players = 1
rules.min_players = 1
rules.fill_with_bots = false
rules.last_team_wins = false
rules.starting_kit = true
return rules
+16 -12
View File
@@ -28,10 +28,10 @@ static func step(player: SimEntity, command: PlayerCommand, ground: SimGround, s
wish = wish.limit_length(Tuning.DOWNED_CRAWL_SPEED) wish = wish.limit_length(Tuning.DOWNED_CRAWL_SPEED)
if player.drop_state == Drop.ABOARD: if player.drop_state == Drop.ABOARD:
# Riders move with the barge; Simulation places them. # Riders move with the ship; Simulation places them.
return return
if player.drop_state != Drop.NONE: if player.drop_state != Drop.NONE:
_fall_from_barge(player, command, ground, sea_level) _fall_from_ship(player, command, ground, sea_level)
return return
if player.swimming: if player.swimming:
@@ -268,15 +268,18 @@ static func _swim(player: SimEntity, command: PlayerCommand, ground: SimGround,
player.on_ground = false player.on_ground = false
## One tick of the drop after leaping: freefall, then the wing-sail. Players steer with ## One tick of the drop after the mortar fires: the climb, freefall, then the gull-kite.
## the move keys relative to where they look; jump opens the sail, and it opens by itself ## While the shot is still climbing nothing steers it and the kite can't open. Then
## WING_AUTO_DEPLOY_HEIGHT above the ground or water. Near the bottom the sail folds and ## players steer with the move keys relative to where they look; jump opens the kite,
## ordinary falling (or the water) takes over, slow enough to do no damage. ## and it opens by itself KITE_AUTO_DEPLOY_HEIGHT above the ground or water. Near the
static func _fall_from_barge(player: SimEntity, command: PlayerCommand, ground: SimGround, sea_level: float) -> void: ## 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) 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) 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 player.drop_state = Drop.GLIDING
var gliding: bool = 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)) 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) wish = (right * input.x + forward * input.y) * (Tuning.GLIDE_SPEED if gliding else Tuning.FREEFALL_STEER_SPEED)
var velocity: Vector3 = player.velocity var velocity: Vector3 = player.velocity
var flat: Vector3 = Vector3(velocity.x, 0.0, velocity.z).move_toward(wish, Tuning.DROP_STEER_ACCEL * DT) if not climbing:
velocity.x = flat.x var flat: Vector3 = Vector3(velocity.x, 0.0, velocity.z).move_toward(wish, Tuning.DROP_STEER_ACCEL * DT)
velocity.z = flat.z velocity.x = flat.x
velocity.z = flat.z
if gliding: if gliding:
velocity.y = move_toward(velocity.y, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * DT) velocity.y = move_toward(velocity.y, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * DT)
else: else:
+6 -6
View File
@@ -35,7 +35,7 @@ var tide: Tide = null
var flood: Flood = null var flood: Flood = null
## Every built piece. Their boxes are part of `ground`. ## Every built piece. Their boxes are part of `ground`.
var structures: StructureSet = StructureSet.new() 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 var drop: Drop = null
## Floor loot, sea chests and crate contents. Empty until place_loot(). ## Floor loot, sea chests and crate contents. Empty until place_loot().
@@ -103,7 +103,7 @@ func add_player() -> int:
Water.reset(player) Water.reset(player)
Inventory.reset(player) Inventory.reset(player)
if drop != null and not drop.finished: 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) _players.append(player.id)
_pending[player.id] = {} _pending[player.id] = {}
return player.id return player.id
@@ -174,11 +174,11 @@ func submit_command(player_id: int, command: PlayerCommand) -> bool:
return true 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: func start_drop() -> void:
drop = Drop.plan(ground, rng, tick) drop = Drop.plan(ground, rng, tick)
for player_id: int in _players: 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. ## 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() _spill_broken_crates()
_check_eliminations() _check_eliminations()
if drop != null and not drop.finished and drop.is_over(tick + 1): 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: for player_id: int in _players:
var player: SimEntity = entities.find(player_id) var player: SimEntity = entities.find(player_id)
if player.drop_state == Drop.ABOARD: if player.drop_state == Drop.ABOARD:
drop.leap(player, tick + 1) drop.fire_at_end(player, tick + 1)
drop.finished = true drop.finished = true
tick += 1 tick += 1
+43 -17
View File
@@ -56,6 +56,9 @@ const NET_CORRECTION_SNAP_METRES: float = 3.0
const SOLO_PLAYERS: int = 24 const SOLO_PLAYERS: int = 24
const DUO_TEAMS: int = 12 const DUO_TEAMS: int = 12
const DUO_TEAM_SIZE: int = 2 const DUO_TEAM_SIZE: int = 2
## The tutorial (A12) starts its player with this weapon, its magazine full, and this
## much spare ammunition of its kind, to learn aiming and reloading on.
const TUTORIAL_KIT: Dictionary = {"weapon": "dock_carbine", "ammo": "cartridges", "spare": 60}
const REVIVE_SECONDS: float = 6.0 const REVIVE_SECONDS: float = 6.0
# Duos: downed, revive and bleed-out (M7). See Simulation. # Duos: downed, revive and bleed-out (M7). See Simulation.
@@ -142,29 +145,49 @@ const SWIM_SPRINT_STAMINA_COST: int = 3
const STAMINA_RECOVERY_RATE: int = 3 const STAMINA_RECOVERY_RATE: int = 3
const BREATH_RECOVERY_RATE: int = 4 const BREATH_RECOVERY_RATE: int = 4
# The drop, in metres and seconds. The sky barge crosses the island on a straight # The drop (#72), in metres and seconds. The packet ship sails a straight seeded line
# seeded route through a point within BARGE_CENTRE_JITTER of the middle. # past the island, offshore, and players fire themselves inland by lifeline mortar.
const BARGE_ALTITUDE: float = 150.0 ## The deck the players ride on, above the starting sea level.
const BARGE_SPEED: float = 24.0 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. ## The route starts and ends this far inside the world's edge.
const BARGE_ROUTE_MARGIN: float = 40.0 const SHIP_ROUTE_MARGIN: float = 40.0
const BARGE_CENTRE_JITTER: float = 140.0 ## The route keeps this much open water between itself and the coast. The planner tries
## Every route crosses at least this much dry land. ## routes from SHIP_OFFSET_MIN to SHIP_OFFSET_MAX from the middle of the world, in
const BARGE_MIN_LAND_METRES: float = 250.0 ## SHIP_OFFSET_STEP steps, and takes the first that is clear, for up to SHIP_ROUTE_TRIES
## Fraction of the barge's speed a leaping player keeps. ## headings. Sea counts as open where the bottom is SHIP_DRAUGHT under the water.
const LEAP_CARRY: float = 0.4 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 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 FREEFALL_STEER_SPEED: float = 9.0
const GLIDE_SPEED: float = 13.0 const GLIDE_SPEED: float = 13.0
## How fast horizontal speed changes while steering a fall, in metres per second squared. ## How fast horizontal speed changes while steering a fall, in metres per second squared.
const DROP_STEER_ACCEL: float = 20.0 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_FALL_SPEED: float = 5.5
const GLIDE_BRAKE: float = 60.0 const GLIDE_BRAKE: float = 60.0
## The sail opens by itself this high above the ground or water. ## The kite opens by itself this high above the ground or water.
const WING_AUTO_DEPLOY_HEIGHT: float = 40.0 const KITE_AUTO_DEPLOY_HEIGHT: float = 40.0
## Within this height of the ground or water, the sail folds and the player drops the rest. ## Within this height of the ground or water, the kite folds and the player drops the rest.
const DROP_LAND_HANDOFF: float = 1.0 const DROP_LAND_HANDOFF: float = 1.0
# The island. Worldgen fills the whole world square; the island is about a kilometre # The island. Worldgen fills the whole world square; the island is about a kilometre
@@ -316,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. ## 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_SECONDS: float = 6.0
const BOT_RETREAT_METRES: float = 30.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. ## the fewest other bots' landings within BOT_LANDING_SPREAD_METRES.
const BOT_LANDING_CHOICES: int = 8 const BOT_LANDING_CHOICES: int = 8
const BOT_LANDING_SPREAD_METRES: float = 60.0 const BOT_LANDING_SPREAD_METRES: float = 60.0
@@ -605,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. # Balance targets (H3), judged by `make balance` over bot-only matches; see docs/BALANCE.md.
## The pass needs at least this many matches. ## The pass needs at least this many matches.
const BALANCE_MIN_MATCHES: int = 200 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. ## many minutes.
const BALANCE_MEDIAN_MINUTES_MIN: float = 12.0 const BALANCE_MEDIAN_MINUTES_MIN: float = 12.0
const BALANCE_MEDIAN_MINUTES_MAX: float = 18.0 const BALANCE_MEDIAN_MINUTES_MAX: float = 18.0
+111 -7
View File
@@ -1,22 +1,24 @@
## The game's menus (A10), in the paper-and-ink motifs of docs/STYLE.md: the main menu, ## The game's menus (A10), in the paper-and-ink motifs of docs/STYLE.md: the welcome
## practice against bots, joining a server (with the LAN and list-server browser), ## that offers the tutorial on the first launch (A12), the main menu, practice against bots, joining a server (with the LAN and list-server browser),
## settings (controls, mouse, graphics, audio, display), the pause menu and the results. ## settings (controls, mouse, gamepad, graphics, audio, display, accessibility), the pause menu and the results.
## ##
## Menus only edit `settings` and say what the player asked for through signals; the ## Menus only edit `settings` and say what the player asked for through signals; the
## program (Main) starts and leaves matches. Every screen can be driven from the ## program (Main) starts and leaves matches. Every screen can be driven from the
## keyboard: each grabs focus on its first control when shown, and Escape goes back. ## keyboard or a gamepad: each grabs focus on its first control when shown, the arrows
## or the D-pad move it, and Escape, or East or Start on the pad, goes back (A13).
## show_screen() and the buttons' `pressed` signals are what the UI test drives. ## show_screen() and the buttons' `pressed` signals are what the UI test drives.
class_name Menus class_name Menus
extends Control extends Control
signal practice_requested(bots: int, difficulty: int, team_size: int) signal practice_requested(bots: int, difficulty: int, team_size: int)
signal tutorial_requested
signal join_requested(host: String, port: int, player_name: String) signal join_requested(host: String, port: int, player_name: String)
signal resume_requested signal resume_requested
signal leave_requested signal leave_requested
signal quit_requested signal quit_requested
signal settings_changed signal settings_changed
const SCREENS: Array[String] = ["main", "practice", "join", "settings", "pause", "results"] const SCREENS: Array[String] = ["welcome", "main", "practice", "join", "settings", "pause", "results"]
const PANEL_WIDTH: float = 560.0 const PANEL_WIDTH: float = 560.0
const FONT_TITLE: int = 40 const FONT_TITLE: int = 40
const FONT_HEADING: int = 24 const FONT_HEADING: int = 24
@@ -61,6 +63,12 @@ var _volumes: Dictionary = {}
var _window_mode: OptionButton var _window_mode: OptionButton
var _vsync: CheckButton var _vsync: CheckButton
var _max_fps: OptionButton var _max_fps: OptionButton
var _pad_speed: HSlider
var _aim_assist: CheckButton
var _vision: OptionButton
var _ui_scale: OptionButton
var _captions: CheckButton
var _reduce_motion: CheckButton
## Results. ## Results.
var _results_title: Label var _results_title: Label
var _results_body: Label var _results_body: Label
@@ -78,6 +86,7 @@ var over_match: bool = false:
func _init() -> void: func _init() -> void:
name = "Menus" name = "Menus"
PadInput.install_menu_actions()
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
theme = MenuTheme.make() theme = MenuTheme.make()
backdrop = MenuBackdrop.new() backdrop = MenuBackdrop.new()
@@ -89,6 +98,7 @@ func _init() -> void:
shade.mouse_filter = Control.MOUSE_FILTER_IGNORE shade.mouse_filter = Control.MOUSE_FILTER_IGNORE
shade.visible = false shade.visible = false
add_child(shade) add_child(shade)
_build_welcome()
_build_main() _build_main()
_build_practice() _build_practice()
_build_join() _build_join()
@@ -206,7 +216,11 @@ func _unhandled_input(event: InputEvent) -> void:
return return
if not listening_for.is_empty(): if not listening_for.is_empty():
var code: int = KeyBindings.code_of_event(event) var code: int = KeyBindings.code_of_event(event)
if code == KEY_ESCAPE: var pad: InputEventJoypadButton = event as InputEventJoypadButton
if pad != null and pad.pressed and (pad.button_index == JOY_BUTTON_B or pad.button_index == JOY_BUTTON_START):
back()
get_viewport().set_input_as_handled()
elif code == KEY_ESCAPE:
back() back()
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
elif code != 0: elif code != 0:
@@ -337,6 +351,7 @@ func _build_main() -> void:
notice.add_theme_color_override("font_color", Palette.OCHRE_RED) notice.add_theme_color_override("font_color", Palette.OCHRE_RED)
column.add_child(notice) column.add_child(notice)
_button(column, "Practice against bots", func() -> void: show_screen("practice")) _button(column, "Practice against bots", func() -> void: show_screen("practice"))
_button(column, "Tutorial", _start_tutorial)
_button(column, "Join a server", func() -> void: show_screen("join")) _button(column, "Join a server", func() -> void: show_screen("join"))
_button(column, "Settings", func() -> void: show_screen("settings")) _button(column, "Settings", func() -> void: show_screen("settings"))
_button(column, "Quit", func() -> void: quit_requested.emit()) _button(column, "Quit", func() -> void: quit_requested.emit())
@@ -349,6 +364,28 @@ func _build_main() -> void:
column.add_child(build) column.add_child(build)
## The first launch (A12): the tutorial, or straight on. Either answer is remembered,
## and the tutorial stays on the main menu.
func _build_welcome() -> void:
var column: VBoxContainer = _panel("welcome", "Welcome aboard")
var note: Label = _note(column)
note.text = "New to Tidewall? A short tutorial on an island of your own shows you how to drop, gather, build, fight and keep ahead of the tide. It takes a few minutes, and you can leave it whenever you like from the pause menu."
_button(column, "Start the tutorial", _start_tutorial)
_button(column, "Not now", func() -> void:
settings.tutorial_offered = true
save_settings()
show_screen("main", false))
var later: Label = _note(column)
later.text = "The tutorial is always on the main menu."
later.modulate.a = 0.7
func _start_tutorial() -> void:
settings.tutorial_offered = true
save_settings()
tutorial_requested.emit()
func _build_practice() -> void: func _build_practice() -> void:
var column: VBoxContainer = _panel("practice", "Practice") var column: VBoxContainer = _panel("practice", "Practice")
_bots = SpinBox.new() _bots = SpinBox.new()
@@ -472,6 +509,7 @@ func _build_settings() -> void:
var controls_scroll: ScrollContainer = ScrollContainer.new() var controls_scroll: ScrollContainer = ScrollContainer.new()
controls_scroll.name = "Controls" controls_scroll.name = "Controls"
controls_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED controls_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
controls_scroll.follow_focus = true
_tabs.add_child(controls_scroll) _tabs.add_child(controls_scroll)
var controls: VBoxContainer = VBoxContainer.new() var controls: VBoxContainer = VBoxContainer.new()
controls.size_flags_horizontal = Control.SIZE_EXPAND_FILL controls.size_flags_horizontal = Control.SIZE_EXPAND_FILL
@@ -502,6 +540,38 @@ func _build_settings() -> void:
_invert.toggled.connect(func(on: bool) -> void: settings.mouse.invert_y = on) _invert.toggled.connect(func(on: bool) -> void: settings.mouse.invert_y = on)
_row(mouse, "Invert up and down", _invert) _row(mouse, "Invert up and down", _invert)
var pad_scroll: ScrollContainer = ScrollContainer.new()
pad_scroll.name = "Gamepad"
pad_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
pad_scroll.follow_focus = true
_tabs.add_child(pad_scroll)
var pad_tab: VBoxContainer = VBoxContainer.new()
pad_tab.size_flags_horizontal = Control.SIZE_EXPAND_FILL
pad_tab.add_theme_constant_override("separation", 10)
pad_scroll.add_child(pad_tab)
_pad_speed = _slider(InputSettings.MIN_PAD_SENSITIVITY, InputSettings.MAX_PAD_SENSITIVITY, 0.05)
_pad_speed.value_changed.connect(func(value: float) -> void: settings.mouse.pad_sensitivity = value)
_slider_row(pad_tab, "Stick look speed", _pad_speed)
_aim_assist = CheckButton.new()
_aim_assist.toggled.connect(func(on: bool) -> void: settings.mouse.aim_assist = on)
_row(pad_tab, "Aim assist", _aim_assist)
var assist_note: Label = _note(pad_tab)
assist_note.text = "Aim assist slows the stick across an opponent in plain sight and, while aiming, eases towards them. It never acts on the mouse. Speed while aiming and Invert (Mouse tab) apply to the stick too."
# The layout in two columns of what and which.
var layout: GridContainer = GridContainer.new()
layout.columns = 4
layout.add_theme_constant_override("h_separation", 14)
layout.add_theme_constant_override("v_separation", 2)
pad_tab.add_child(layout)
for pair: Array in PadInput.LAYOUT:
for index: int in 2:
var cell: Label = Label.new()
cell.text = String(pair[index])
cell.add_theme_font_size_override("font_size", FONT_SMALL)
if index == 1:
cell.add_theme_color_override("font_color", Palette.GILT_DEEP)
layout.add_child(cell)
var graphics: VBoxContainer = _tab("Graphics") var graphics: VBoxContainer = _tab("Graphics")
_quality = OptionButton.new() _quality = OptionButton.new()
for index: int in GameSettings.QUALITY_NAMES.size(): for index: int in GameSettings.QUALITY_NAMES.size():
@@ -535,6 +605,34 @@ func _build_settings() -> void:
_max_fps.item_selected.connect(func(index: int) -> void: settings.max_fps = GameSettings.FRAME_CAPS[index]) _max_fps.item_selected.connect(func(index: int) -> void: settings.max_fps = GameSettings.FRAME_CAPS[index])
_row(display, "Frame limit", _max_fps) _row(display, "Frame limit", _max_fps)
var access: VBoxContainer = _tab("Access")
_vision = OptionButton.new()
for index: int in Palette.VISION_NAMES.size():
_vision.add_item(Palette.VISION_NAMES[index], index)
_vision.item_selected.connect(func(index: int) -> void:
settings.vision = index
save_settings())
_row(access, "Colour vision", _vision)
_ui_scale = OptionButton.new()
for index: int in GameSettings.UI_SCALES.size():
_ui_scale.add_item("%d%%" % roundi(GameSettings.UI_SCALES[index] * 100.0), index)
_ui_scale.item_selected.connect(func(index: int) -> void:
settings.ui_scale = GameSettings.UI_SCALES[index]
save_settings())
_row(access, "Interface size", _ui_scale)
_captions = CheckButton.new()
_captions.toggled.connect(func(on: bool) -> void:
settings.captions = on
save_settings())
_row(access, "Captions for sounds", _captions)
_reduce_motion = CheckButton.new()
_reduce_motion.toggled.connect(func(on: bool) -> void:
settings.reduce_motion = on
save_settings())
_row(access, "Reduce motion", _reduce_motion)
var access_note: Label = _note(access)
access_note.text = "Colour vision changes the build preview, danger marks and your own marks to colours told apart with that kind of colour blindness. Captions name the sounds that matter (the tide, gunfire, footsteps, building) and which way they came from. Reduce motion makes the zoom when aiming smaller and slower and the flash when you're hurt gentler."
_binding_note = _note(column) _binding_note = _note(column)
_binding_note.text = "Choose an action to change its key." _binding_note.text = "Choose an action to change its key."
_tabs.tab_changed.connect(func(tab: int) -> void: _binding_note.visible = tab == 0) _tabs.tab_changed.connect(func(tab: int) -> void: _binding_note.visible = tab == 0)
@@ -601,7 +699,13 @@ func _refresh_controls() -> void:
_window_mode.selected = settings.window_mode _window_mode.selected = settings.window_mode
_vsync.set_pressed_no_signal(settings.vsync) _vsync.set_pressed_no_signal(settings.vsync)
_max_fps.selected = maxi(GameSettings.FRAME_CAPS.find(settings.max_fps), 0) _max_fps.selected = maxi(GameSettings.FRAME_CAPS.find(settings.max_fps), 0)
for slider: HSlider in [_sensitivity, _aim_scale, _volumes["master"], _volumes["music"], _volumes["effects"]]: _pad_speed.set_value_no_signal(settings.mouse.pad_sensitivity)
_aim_assist.set_pressed_no_signal(settings.mouse.aim_assist)
_vision.selected = settings.vision
_ui_scale.selected = maxi(GameSettings.UI_SCALES.find(settings.ui_scale), 0)
_captions.set_pressed_no_signal(settings.captions)
_reduce_motion.set_pressed_no_signal(settings.reduce_motion)
for slider: HSlider in [_sensitivity, _aim_scale, _pad_speed, _volumes["master"], _volumes["music"], _volumes["effects"]]:
(slider.get_meta("readout") as Callable).call(slider.value) (slider.get_meta("readout") as Callable).call(slider.value)
_refresh_bindings() _refresh_bindings()
+201
View File
@@ -0,0 +1,201 @@
extends TestCase
## A12: the tutorial. A match alone that only the tide ends, with a weapon to learn on;
## steps that judge what the player did from the client's own view; instructions that
## name the player's own keys; a scripted player that finishes it; and the menus that
## offer it on the first launch and keep it on the main menu.
const PATH: String = "user://test_tutorial_settings.cfg"
const DT: float = 1.0 / Tuning.TICK_RATE_HZ
func after_each() -> void:
super.after_each()
DirAccess.remove_absolute(ProjectSettings.globalize_path(PATH))
func test_a_tutorial_match_alone_plays_on_and_starts_with_the_kit() -> void:
var loop: ServerLoop = ServerLoop.new(5, 1, 0, MatchRules.tutorial())
var flow: Match = loop.match_flow
for _tick: int in 3:
loop.run_tick()
assert_true(flow.in_match(), "one player alone isn't the last one standing in the tutorial")
var me: SimEntity = flow.sim.entities.find(int(flow.entity_of[flow.participants[0]]))
var weapon: int = ItemCatalog.code_of(String(Tuning.TUTORIAL_KIT["weapon"]))
assert_eq(Inventory.count_of(me, weapon), 1, "carries the kit's weapon")
assert_true(me.slot_rounds[0] > 0, "loaded")
assert_eq(Inventory.count_of(me, ItemCatalog.code_of(String(Tuning.TUTORIAL_KIT["ammo"]))), int(Tuning.TUTORIAL_KIT["spare"]))
for _tick: int in 20 * Tuning.TICK_RATE_HZ:
loop.run_tick()
assert_true(flow.in_match(), "still playing twenty seconds on")
func test_ordinary_rules_still_end_a_match_with_one_team_left() -> void:
var rules: MatchRules = MatchRules.immediate()
rules.max_players = 1
rules.min_players = 1
rules.fill_with_bots = false
var loop: ServerLoop = ServerLoop.new(5, 1, 0, rules)
for _tick: int in 3:
loop.run_tick()
assert_eq(loop.match_flow.phase, Match.RESULTS, "alone under the usual rules is a win at once")
assert_eq(loop.match_flow.winners.size(), 1)
func test_the_tutorial_ends_when_its_player_falls() -> void:
var loop: ServerLoop = ServerLoop.new(5, 1, 0, MatchRules.tutorial())
var flow: Match = loop.match_flow
for _tick: int in 3:
loop.run_tick()
assert_true(flow.in_match())
flow.leave(int(flow.participants[0]))
loop.run_tick()
assert_false(flow.in_match(), "nobody left standing ends it")
func test_instructions_name_the_players_own_keys() -> void:
var tutorial: Tutorial = Tutorial.new()
assert_true(tutorial.instruction().contains("[Space]"), tutorial.instruction())
var keys: KeyBindings = KeyBindings.new()
assert_eq(keys.bind("jump", KEY_J), "")
tutorial.bindings = keys
assert_true(tutorial.instruction().contains("[J]"), "rebound jump shows: " + tutorial.instruction())
for step: int in Tutorial.STEP_NAMES.size():
tutorial.step = step
assert_false(tutorial.instruction().is_empty(), "step %s says what to do" % Tutorial.STEP_NAMES[step])
assert_false(tutorial.instruction().contains("%"), "no unfilled format in %s" % Tutorial.STEP_NAMES[step])
assert_eq(tutorial.counter(), "Tutorial complete")
func test_the_scripted_player_finishes_the_tutorial_through_the_client() -> void:
var result: Dictionary = preload("res://tools/tutorial_check.gd").play(3, 300.0)
assert_true(bool(result["finished"]), "finished: %s" % result)
for step: String in ["leap", "glide", "move", "harvest", "build", "fire", "tide"]:
assert_true(float(result["steps"][step]) > 0.0, "%s took some time: %s" % [step, result])
func test_steps_wait_for_the_player_to_act() -> void:
var session: ClientSession = ClientSession.new()
session.play_tutorial(3)
# 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())
assert_eq(session.tutorial.step, Tutorial.LEAP)
assert_eq(session.game.prediction.player.drop_state, Drop.ABOARD)
session.free()
func test_settings_remember_the_offer_and_the_finish() -> void:
var settings: GameSettings = GameSettings.new()
assert_false(settings.tutorial_offered)
assert_false(settings.tutorial_done)
settings.tutorial_offered = true
settings.tutorial_done = true
assert_eq(settings.save(PATH), OK)
var loaded: GameSettings = GameSettings.load_from(PATH)
assert_true(loaded.tutorial_offered)
assert_true(loaded.tutorial_done)
func test_the_first_launch_offers_it_and_not_now_is_remembered() -> void:
var tree: SceneTree = Engine.get_main_loop() as SceneTree
var shell: AppShell = AppShell.new(GameSettings.new(), PATH)
shell.grab_mouse = false
tree.root.add_child(shell)
assert_eq(shell.menus.current, "welcome")
(shell.menus.buttons_of("welcome")["Not now"] as Button).pressed.emit()
assert_eq(shell.menus.current, "main")
assert_null(shell.session)
assert_true(GameSettings.load_from(PATH).tutorial_offered, "saved")
shell.free()
var again: AppShell = AppShell.new(GameSettings.load_from(PATH), PATH)
again.grab_mouse = false
tree.root.add_child(again)
assert_eq(again.menus.current, "main", "not offered twice")
again.free()
func test_the_tutorial_starts_from_the_welcome_and_the_main_menu() -> void:
var tree: SceneTree = Engine.get_main_loop() as SceneTree
for pair: Array in [["welcome", "Start the tutorial"], ["main", "Tutorial"]]:
var settings: GameSettings = GameSettings.new()
settings.tutorial_offered = pair[0] == "main"
var shell: AppShell = AppShell.new(settings, PATH)
shell.grab_mouse = false
tree.root.add_child(shell)
assert_eq(shell.menus.current, pair[0])
var buttons: Dictionary = shell.menus.buttons_of(pair[0])
assert_true(buttons.has(pair[1]), "%s has '%s'" % pair)
(buttons[pair[1]] as Button).pressed.emit()
assert_not_null(shell.session, "a tutorial began from %s" % pair[0])
assert_not_null(shell.session.tutorial)
assert_not_null(shell.session.local, "offline")
assert_true(settings.tutorial_offered)
assert_false(shell.menus.visible)
shell.leave()
assert_eq(shell.menus.current, "main", "Leave skips it, back to the main menu")
shell.free()
func test_finishing_is_saved() -> void:
var tree: SceneTree = Engine.get_main_loop() as SceneTree
var settings: GameSettings = GameSettings.new()
settings.tutorial_offered = true
var shell: AppShell = AppShell.new(settings, PATH)
shell.grab_mouse = false
tree.root.add_child(shell)
shell.start_tutorial()
shell.session.tutorial.step = Tutorial.DONE
shell.watch_tutorial()
assert_true(GameSettings.load_from(PATH).tutorial_done)
shell.free()
func test_the_card_shows_the_step_once_playing() -> void:
var card: TutorialCard = TutorialCard.new()
(Engine.get_main_loop() as SceneTree).root.add_child(card)
var tutorial: Tutorial = Tutorial.new()
card.show_tutorial(tutorial, false)
assert_false(card.visible, "hidden before the match")
tutorial.step = Tutorial.BUILD
card.show_tutorial(tutorial, true)
assert_true(card.visible)
assert_true(card.size.y > 60.0, "sized to its words")
card.free()
func test_the_command_line_asks_for_it() -> void:
var config: ClientConfig = ClientConfig.parse(PackedStringArray(["--tutorial", "--autoplay", "--seed=4"]))
assert_true(config.is_valid(), str(config.errors))
assert_true(config.tutorial and config.asked and config.autoplay)
assert_false(ClientConfig.parse(PackedStringArray(["--tutorial", "--connect=192.0.2.7"])).is_valid())
assert_false(ClientConfig.parse(PackedStringArray(["--tutorial", "--duos"])).is_valid())
assert_eq(ClientConfig.game_args(PackedStringArray(), PackedStringArray(["--tutorial"])), PackedStringArray(["--tutorial"]))
func test_command_logs_keep_the_new_rules_and_read_old_ones() -> void:
var log: CommandLog = CommandLog.new(7, 1, MatchRules.tutorial())
var header: Dictionary = log.header()
assert_eq(header["rules"]["last_team_wins"], false)
assert_eq(header["rules"]["starting_kit"], true)
var back: CommandLog = CommandLog.from_bytes(log.to_bytes())
assert_not_null(back)
assert_false(back.rules.last_team_wins)
assert_true(back.rules.starting_kit)
# A log written before A12 has neither rule, and reads with the defaults.
var old: Dictionary = header.duplicate(true)
old["rules"].erase("last_team_wins")
old["rules"].erase("starting_kit")
var head: PackedByteArray = JSON.stringify(old).to_utf8_buffer()
var out: StreamPeerBuffer = StreamPeerBuffer.new()
out.big_endian = false
out.put_data(CommandLog.MAGIC.to_ascii_buffer())
out.put_u32(head.size())
out.put_data(head)
out.put_u32(0)
var earlier: CommandLog = CommandLog.from_bytes(out.data_array)
assert_not_null(earlier, "an older log still reads")
assert_true(earlier.rules.last_team_wins)
assert_false(earlier.rules.starting_kit)
+1
View File
@@ -0,0 +1 @@
uid://s4xeekurih46
+1 -1
View File
@@ -88,7 +88,7 @@ static func format(a: Dictionary) -> String:
var m: Dictionary = a["minutes"] var m: Dictionary = a["minutes"]
lines.append("Tidewall balance report: %d bot-only matches, %d players each" % [a["matches"], Tuning.SOLO_PLAYERS]) lines.append("Tidewall balance report: %d bot-only matches, %d players each" % [a["matches"], Tuning.SOLO_PLAYERS])
lines.append("") 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(" 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"]]) 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 = [] var curve: PackedStringArray = []
+1 -1
View File
@@ -15,7 +15,7 @@ static func tick_limit() -> int:
## "eliminations": {difficulty name: count}, "weapon_kills": {item id: count}, ## "eliminations": {difficulty name: count}, "weapon_kills": {item id: count},
## "death_seconds": [seconds into the match of each fall], "shots", "slow_ticks", ## "death_seconds": [seconds into the match of each fall], "shots", "slow_ticks",
## "timing", "state_hash", "building": {"build": group, "control": group}}. Seconds ## "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". ## holds their "bots", "places" and "wins".
## ##
## With `team_size` 2 the match is duos (M7), and the result also has "downs", ## With `team_size` 2 the match is duos (M7), and the result also has "downs",
+6 -5
View File
@@ -12,14 +12,15 @@ func test_a_scripted_seat_sends_commands_like_anyone_else() -> void:
assert_eq(loop.bots.size(), 1) assert_eq(loop.bots.size(), 1)
for _index: int in Tuning.TICK_RATE_HZ * 24: for _index: int in Tuning.TICK_RATE_HZ * 24:
loop.run_tick() 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: func test_harvests_driftwood_and_builds_with_it() -> void:
# Seed 29 is the match `make match` plays: the player lands, finds a weapon, cuts # 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 2 until # driftwood and puts up a breakwater and a wall within a minute. (It was seed 29 from
# H3 changed where bots land; there the scripted player now falls in a landing fight.) # H3 until the packet ship (#72) changed where everyone lands; on 29 the scripted
var loop: ServerLoop = ServerLoop.new(29, 1, 23) # player now falls in a landing fight.)
var loop: ServerLoop = ServerLoop.new(2, 1, 23)
loop.play_humans_by_script() loop.play_humans_by_script()
var player: ScriptedPlayer = loop.scripted[0] var player: ScriptedPlayer = loop.scripted[0]
var placed: int = 0 var placed: int = 0
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/camera_scene.gd" id="1"]
[node name="CaptureCameraAim" type="Node3D"]
script = ExtResource("1")
yaw_degrees = 20.0
aiming = true
reduce_motion = true
+3
View File
@@ -6,6 +6,8 @@ extends "res://test/capture/smoke_scene.gd"
@export var yaw_degrees: float = 0.0 @export var yaw_degrees: float = 0.0
@export var pitch_degrees: float = -8.0 @export var pitch_degrees: float = -8.0
@export var aiming: bool = false @export var aiming: bool = false
## A13: the calmer aim zoom of the reduce-motion setting.
@export var reduce_motion: bool = false
func _add_camera() -> void: func _add_camera() -> void:
@@ -19,6 +21,7 @@ func _add_camera() -> void:
camera.yaw = deg_to_rad(yaw_degrees) camera.yaw = deg_to_rad(yaw_degrees)
camera.pitch = deg_to_rad(pitch_degrees) camera.pitch = deg_to_rad(pitch_degrees)
camera.aiming = aiming camera.aiming = aiming
camera.rig.reduce_motion = reduce_motion
if aiming: if aiming:
camera.rig.aim_blend = 1.0 camera.rig.aim_blend = 1.0
add_child(camera) add_child(camera)
+8
View File
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/client_scene.gd" id="1"]
[node name="CaptureClient" type="Node3D"]
script = ExtResource("1")
stage = "build"
vision = 1
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/client_scene.gd" id="1"]
[node name="CaptureClient" type="Node3D"]
script = ExtResource("1")
stage = "build_refused"
vision = 1
+8
View File
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/client_scene.gd" id="1"]
[node name="CaptureClient" type="Node3D"]
script = ExtResource("1")
stage = "hud"
captions = true
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/client_scene.gd" id="1"]
[node name="CaptureClient" type="Node3D"]
script = ExtResource("1")
stage = "hud"
captions = true
ui_scale = 1.3
+27 -4
View File
@@ -3,7 +3,7 @@
## by its autoplay script. The picture is the client's own: its copy of the world, its ## 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. ## 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 ## 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 ## 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 ## ground inside, below the sea, stays dry on the client too (issue N11). build and
@@ -21,9 +21,14 @@ const DT: float = 1.0 / Tuning.TICK_RATE_HZ
const HOST: String = "127.0.0.1" const HOST: String = "127.0.0.1"
const LIMIT_ROUNDS: int = 200 * Tuning.TICK_RATE_HZ 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 match_seed: int = 2
@export var bots: int = 23 @export var bots: int = 23
## A13: a colour-vision set (Palette.VISION_*), captions for the sounds of the last
## second before the picture, and the interface size.
@export var vision: int = 0
@export var captions: bool = false
@export var ui_scale: float = 1.0
var _loop: ServerLoop var _loop: ServerLoop
var _net: NetServer var _net: NetServer
@@ -32,6 +37,8 @@ var _session: ClientSession
func _ready() -> void: func _ready() -> void:
Palette.vision = vision
get_tree().root.content_scale_factor = ui_scale
var rules: MatchRules = MatchRules.new() var rules: MatchRules = MatchRules.new()
rules.max_players = bots + 1 rules.max_players = bots + 1
rules.lobby_ticks = 6 rules.lobby_ticks = 6
@@ -68,7 +75,7 @@ func _ready() -> void:
var reached: bool = false var reached: bool = false
if _session.game.playing(): if _session.game.playing():
match stage: match stage:
"barge": "ship":
reached = me.drop_state == Drop.ABOARD and _session.game.prediction.next_tick > 3 * Tuning.TICK_RATE_HZ reached = me.drop_state == Drop.ABOARD and _session.game.prediction.next_tick > 3 * Tuning.TICK_RATE_HZ
"glide": "glide":
reached = me.drop_state == Drop.GLIDING reached = me.drop_state == Drop.GLIDING
@@ -78,7 +85,7 @@ func _ready() -> void:
since = 0 since = 0
elif since >= 0: elif since >= 0:
since += 1 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 break
if since < 0: if since < 0:
push_error("client capture: never reached stage '%s'" % stage) push_error("client capture: never reached stage '%s'" % stage)
@@ -104,6 +111,22 @@ func _ready() -> void:
return return
basin_text += downed_text basin_text += downed_text
_session.hud.fade_feed = false _session.hud.fade_feed = false
if captions:
# A second of play with its sound, which is what the captions hear.
_session.settings.captions = true
# Play on until something worth a caption is heard (bots' gunfire carries far),
# for up to 20 seconds.
for _frame: int in 20 * Tuning.TICK_RATE_HZ:
if _session.captions.lines().size() >= 2:
break
_game.poll()
_loop.run_tick()
_game.after_tick()
_session.pump(DT)
_session.sound.update(_session.game, _session.mirror.own_id, _session.view.camera.global_position, DT)
_session._hear_captions(DT)
if _session.captions.lines().is_empty():
push_error("client capture: nothing was captioned")
_session.hud.show_state(_session.hud_state()) _session.hud.show_state(_session.hud_state())
_session.view.settle() _session.view.settle()
var others: int = 0 var others: int = 0
@@ -4,4 +4,4 @@
[node name="CaptureClient" type="Node3D"] [node name="CaptureClient" type="Node3D"]
script = ExtResource("1") script = ExtResource("1")
stage = "barge" stage = "ship"
+2 -2
View File
@@ -3,7 +3,7 @@
## animation, seen from in front and to their right: ## animation, seen from in front and to their right:
## ##
## - states: idle, walk, run, crouched, creeping, in the air, skydiving, gliding, ## - 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.) ## placement would pull it out of the row.)
## - actions: carrying a longgun, a revolver and a tonic, firing each kind, a boathook ## - actions: carrying a longgun, a revolver and a tonic, firing each kind, a boathook
## swing, a keg thrown, building, reloading, drinking and a flinch. ## 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: func _pose(player: SimEntity, row: Array) -> void:
var figure: FigureRig = view.entities.figure_of(player.id) 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.position = player.position
figure.drive(player, 0.0) figure.drive(player, 0.0)
figure.drive(player, 1.0) figure.drive(player, 1.0)
+7
View File
@@ -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"
+28 -6
View File
@@ -3,7 +3,7 @@
## prints what it shows as a caption (Godot's default font; this is a test caption, ## prints what it shows as a caption (Godot's default font; this is a test caption,
## not the game's HUD). ## 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. ## end, from where the lobby saw it), results.
extends Node3D extends Node3D
@@ -31,8 +31,11 @@ func _ready() -> void:
match stage: match stage:
"lobby": "lobby":
pass pass
"barge": "ship":
_replay.run_until(func() -> bool: return flow.in_match() and flow.sim.tick >= 2 * TICKS) _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": "glide":
_replay.run_until(func() -> bool: return _player() != null and _player().drop_state == Drop.GLIDING) _replay.run_until(func() -> bool: return _player() != null and _player().drop_state == Drop.GLIDING)
_run_ticks(TICKS) _run_ticks(TICKS)
@@ -67,11 +70,19 @@ func _ready() -> void:
if stage == "lobby" or stage == "tide": if stage == "lobby" or stage == "tide":
_view.overview() _view.overview()
who = "the island" 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 along: Vector3 = (sim.drop.finish - sim.drop.start).normalized()
var at: Vector3 = sim.drop.barge_position(sim.tick) var at: Vector3 = sim.drop.ship_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)) var centre: Vector3 = Vector3(Tuning.WORLD_SIZE_METRES * 0.5, 0.0, Tuning.WORLD_SIZE_METRES * 0.5)
who = "the barge" 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: elif watched != 0:
var entity: SimEntity = sim.entities.find(flow.entity_of[watched]) var entity: SimEntity = sim.entities.find(flow.entity_of[watched])
var airborne: bool = entity.drop_state != Drop.NONE 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()])) _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: func _player() -> SimEntity:
var flow: Match = _replay.flow var flow: Match = _replay.flow
if not flow.entity_of.has(PLAYER): if not flow.entity_of.has(PLAYER):
@@ -4,4 +4,4 @@
[node name="CaptureMatch" type="Node3D"] [node name="CaptureMatch" type="Node3D"]
script = ExtResource("1") script = ExtResource("1")
stage = "barge" stage = "ship"
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/menu_scene.gd" id="1"]
[node name="CaptureMenu" type="Control"]
script = ExtResource("1")
screen = "main"
over_match = false
ui_scale = 1.3
+3
View File
@@ -8,9 +8,12 @@ extends Control
@export var screen: String = "main" @export var screen: String = "main"
@export var over_match: bool = false @export var over_match: bool = false
@export var settings_tab: int = 0 @export var settings_tab: int = 0
## A13: the interface size (GameSettings.UI_SCALES).
@export var ui_scale: float = 1.0
func _ready() -> void: func _ready() -> void:
get_tree().root.content_scale_factor = ui_scale
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
if over_match: if over_match:
var stand_in: MenuBackdrop = MenuBackdrop.new() var stand_in: MenuBackdrop = MenuBackdrop.new()
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/menu_scene.gd" id="1"]
[node name="CaptureMenu" type="Control"]
script = ExtResource("1")
screen = "settings"
over_match = false
settings_tab = 6
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/menu_scene.gd" id="1"]
[node name="CaptureMenu" type="Control"]
script = ExtResource("1")
screen = "settings"
over_match = false
settings_tab = 2
+10
View File
@@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/menu_scene.gd" id="1"]
[node name="CaptureMenu" type="Control"]
script = ExtResource("1")
screen = "settings"
over_match = false
settings_tab = 6
ui_scale = 1.3
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/menu_scene.gd" id="1"]
[node name="CaptureMenu" type="Control"]
script = ExtResource("1")
screen = "welcome"
over_match = false
settings_tab = 0
+7
View File
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/tutorial_scene.gd" id="1"]
[node name="CaptureTutorial" type="Node3D"]
script = ExtResource("1")
step = "build"
+7
View File
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/tutorial_scene.gd" id="1"]
[node name="CaptureTutorial" type="Node3D"]
script = ExtResource("1")
step = "move"
+50
View File
@@ -0,0 +1,50 @@
## Capture scenario for the tutorial (A12): the real ClientSession playing the tutorial
## offline, driven by its scripted player (TutorialPilot) until `step` begins, then held
## there so the HUD's tutorial card shows that step's instruction and progress.
##
## Stages: move (just landed), build (build mode on, the ghost showing) and tide (the
## last step, with the tide post and the line to beat).
extends Node3D
const DT: float = 1.0 / Tuning.TICK_RATE_HZ
const LIMIT_FRAMES: int = 300 * Tuning.TICK_RATE_HZ
@export var step: String = "move"
@export var match_seed: int = 3
var _session: ClientSession
func _ready() -> void:
_session = ClientSession.new()
_session.input.autoplay = true
_session.play_tutorial(match_seed)
add_child(_session)
_session.set_process(false)
var wanted: int = Tutorial.STEP_NAMES.find(step)
var frames: int = 0
while frames < LIMIT_FRAMES and _session.tutorial.step < wanted:
_session.pump(DT)
frames += 1
if _session.tutorial.step != wanted:
push_error("tutorial capture: never reached step '%s' (stopped at '%s')" % [step, _session.tutorial.step_name()])
return
# A moment into the step: long enough for build mode to come on, too short for the
# script to finish it.
for _frame: int in 6:
_session.pump(DT)
if _session.tutorial.step != wanted:
push_error("tutorial capture: step '%s' was over before the picture" % step)
return
_session.input.map_open = false
_session.input.buttons = 0
_session.hud.show_state(_session.hud_state())
_session.view.settle()
_session._show_charts(DT)
_session.tutorial_card.show_tutorial(_session.tutorial, true)
func _process(_delta: float) -> void:
# The session is held still; only the card is laid out again as its labels settle.
if _session != null and _session.tutorial_card != null:
_session.tutorial_card.show_tutorial(_session.tutorial, true)
+1
View File
@@ -0,0 +1 @@
uid://cx5rndc8jqd8d
+7
View File
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/tutorial_scene.gd" id="1"]
[node name="CaptureTutorial" type="Node3D"]
script = ExtResource("1")
step = "tide"
+9 -9
View File
@@ -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. ## in the air above the sea, with a row of chests on a plank stand, shut and opened.
extends Node3D extends Node3D
@@ -8,11 +8,11 @@ func _ready() -> void:
world.environment = Look.environment() world.environment = Look.environment()
add_child(world) add_child(world)
add_child(Look.sun(200.0)) add_child(Look.sun(200.0))
var barge: MeshInstance3D = MeshInstance3D.new() var ship: MeshInstance3D = MeshInstance3D.new()
barge.mesh = VesselModels.barge() ship.mesh = VesselModels.ship()
barge.position = Vector3(0.0, 0.0, 0.0) ship.position = Vector3(0.0, 0.0, 0.0)
barge.rotation.y = 0.5 ship.rotation.y = 0.5
add_child(barge) add_child(ship)
var multimesh: MultiMesh = MultiMesh.new() var multimesh: MultiMesh = MultiMesh.new()
multimesh.transform_format = MultiMesh.TRANSFORM_3D multimesh.transform_format = MultiMesh.TRANSFORM_3D
multimesh.use_colors = true 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) multimesh.set_instance_color(index, EntityView.CHEST_OPEN if index == 2 else EntityView.CHEST_SHUT)
var chests: MultiMeshInstance3D = MultiMeshInstance3D.new() var chests: MultiMeshInstance3D = MultiMeshInstance3D.new()
chests.multimesh = multimesh chests.multimesh = multimesh
chests.position = Vector3(9.0, 0.0, 6.0) chests.position = Vector3(13.0, 0.0, 11.0)
add_child(chests) add_child(chests)
var camera: Camera3D = Camera3D.new() var camera: Camera3D = Camera3D.new()
camera.fov = 60.0 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) 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() camera.make_current()
Look.add_print_pass(camera) Look.add_print_pass(camera)
+93
View File
@@ -0,0 +1,93 @@
extends TestCase
## A13: aim assist slows the stick across an opponent in sight and, while aiming,
## eases towards them; never through cover, never for the mouse, and only when on.
const EYE: Vector3 = Vector3(100.0, 10.0, 100.0)
## An opponent `metres` ahead (yaw 0 looks along +z), `degrees` to the left.
static func ahead(metres: float, degrees: float) -> Vector3:
var angle: float = deg_to_rad(degrees)
return EYE + Vector3(sin(angle), 0.0, cos(angle)) * metres
func test_only_opponents_near_the_look_and_in_range_count() -> void:
var targets: Array[Vector3] = [ahead(30.0, 20.0), ahead(30.0, 3.0), ahead(200.0, 0.5)]
var found: Dictionary = AimAssist.nearest(EYE, 0.0, 0.0, targets)
assert_false(found.is_empty())
assert_eq(found["point"], targets[1], "the one 3 degrees off, not the far or wide ones")
var none: Array[Vector3] = [ahead(30.0, 20.0)]
assert_true(AimAssist.nearest(EYE, 0.0, 0.0, none).is_empty())
func test_cover_hides_an_opponent() -> void:
var targets: Array[Vector3] = [ahead(30.0, 2.0)]
var walled: Callable = func(_from: Vector3, _to: Vector3) -> bool: return false
assert_true(AimAssist.nearest(EYE, 0.0, 0.0, targets, walled).is_empty())
func test_friction_is_strongest_at_the_centre() -> void:
assert_eq(AimAssist.friction({}), 1.0)
var centre: float = AimAssist.friction(AimAssist.nearest(EYE, 0.0, 0.0, [ahead(30.0, 0.0)] as Array[Vector3]))
var edge: float = AimAssist.friction(AimAssist.nearest(EYE, 0.0, 0.0, [ahead(30.0, 5.0)] as Array[Vector3]))
assert_near(centre, AimAssist.FRICTION, 0.01)
assert_true(edge > centre and edge < 1.0)
func test_pull_turns_towards_and_never_past() -> void:
var target: Vector3 = ahead(30.0, 2.0)
var found: Dictionary = AimAssist.nearest(EYE, 0.0, 0.0, [target] as Array[Vector3])
var step: Vector2 = AimAssist.pull(EYE, 0.0, 0.0, found, 0.1)
assert_true(step.x > 0.0, "turns left, towards it")
assert_true(step.x <= AimAssist.PULL_RADIANS_PER_SECOND * 0.1 + 0.0001, "no faster than the limit")
var yaw: float = 0.0
for _frame: int in 200:
found = AimAssist.nearest(EYE, yaw, 0.0, [target] as Array[Vector3])
yaw = AimAssist.pull(EYE, yaw, 0.0, found, 0.05).x
assert_true(yaw <= deg_to_rad(2.0) + 0.0001, "never past the opponent: %f" % rad_to_deg(yaw))
func test_through_client_input_only_for_the_pad_and_only_when_on() -> void:
var targets: Array[Vector3] = [ahead(30.0, 3.0)]
# The pad, aiming and moving the stick a little: the look is drawn left.
var input: ClientInput = _aiming_pad(targets)
input.handle(TestPad.axis(JOY_AXIS_RIGHT_Y, 0.4), false)
for _frame: int in 30:
input.poll(1.0 / 60.0)
var assisted: float = angle_difference(0.0, input.yaw)
assert_true(assisted > 0.002, "pulled towards the opponent: %f" % assisted)
# The same with assist off: no sideways pull at all.
input = _aiming_pad(targets)
input.settings.aim_assist = false
input.handle(TestPad.axis(JOY_AXIS_RIGHT_Y, 0.4), false)
for _frame: int in 30:
input.poll(1.0 / 60.0)
assert_near(angle_difference(0.0, input.yaw), 0.0, 0.00001, "off means off")
# The mouse with the pad set aside: no pull either.
input = _aiming_pad(targets)
var key: InputEventKey = InputEventKey.new()
key.physical_keycode = KEY_W
key.pressed = true
input.handle(key, true)
var motion: InputEventMouseMotion = InputEventMouseMotion.new()
motion.relative = Vector2(0.0, -4.0)
input.handle(motion, true)
input.poll(1.0 / 60.0)
assert_near(angle_difference(0.0, input.yaw), 0.0, 0.00001, "never for the mouse")
func _aiming_pad(targets: Array[Vector3]) -> ClientInput:
var input: ClientInput = ClientInput.new()
input.eye = EYE
input.targets = targets
input.handle(TestPad.axis(JOY_AXIS_TRIGGER_LEFT, 1.0), false)
return input
class TestPad:
static func axis(which: JoyAxis, value: float) -> InputEventJoypadMotion:
var event: InputEventJoypadMotion = InputEventJoypadMotion.new()
event.axis = which
event.axis_value = value
return event
+1
View File
@@ -0,0 +1 @@
uid://btsy5xwlv3q3e
+77
View File
@@ -0,0 +1,77 @@
extends TestCase
## A13: captions name the sounds that matter, say which way they came from, don't
## stack repeats, leave out the player's own sounds, and fade.
const EYE: Vector3 = Vector3(50.0, 5.0, 50.0)
static func cue(sound: String, at: Variant = null) -> Dictionary:
return {"sound": sound, "category": "x", "spatial": at != null, "at": at if at != null else Vector3.ZERO, "volume_db": 0.0, "pitch": 1.0}
func test_sides_follow_the_look() -> void:
# Yaw 0 looks along +z; growing yaw turns left, towards +x.
assert_eq(Captions.side_of(EYE, 0.0, EYE + Vector3(0.0, 0.0, 10.0)), "ahead")
assert_eq(Captions.side_of(EYE, 0.0, EYE + Vector3(0.0, 0.0, -10.0)), "behind")
assert_eq(Captions.side_of(EYE, 0.0, EYE + Vector3(10.0, 0.0, 0.0)), "left")
assert_eq(Captions.side_of(EYE, 0.0, EYE + Vector3(-10.0, 0.0, 0.0)), "right")
assert_eq(Captions.side_of(EYE, PI * 0.5, EYE + Vector3(10.0, 0.0, 0.0)), "ahead", "turned to face +x")
func test_key_sounds_have_words_and_the_rest_none() -> void:
for sound: String in ["foghorn", "bell", "surge", "lighthouse", "hurt", "keg_blast", "step_sand_1", "shot_dock_carbine", "break_stone", "build_driftwood"]:
assert_ne(Captions.words_for(sound), "", sound)
for sound: String in ["amb_surf", "ui_click", "music_drone", "land"]:
assert_eq(Captions.words_for(sound), "", sound)
func test_a_frame_of_cues_becomes_lines() -> void:
var captions: Captions = Captions.new()
var cues: Array[Dictionary] = [cue("foghorn"), cue("shot_harpoon_gun", EYE + Vector3(-30.0, 0.0, 0.0)), cue("amb_wind")]
captions.hear(cues, EYE, 0.0, EYE, 0.016)
assert_eq(captions.lines(), ["Foghorn: the sea is rising", "Gunfire, right"] as Array[String])
func test_repeats_refresh_and_the_newest_is_last() -> void:
var captions: Captions = Captions.new()
var behind: Vector3 = EYE + Vector3(0.0, 0.0, -8.0)
captions.hear([cue("step_grass_1", behind)] as Array[Dictionary], EYE, 0.0, EYE, 0.016)
captions.hear([cue("bell")] as Array[Dictionary], EYE, 0.0, EYE, 0.016)
captions.hear([cue("step_grass_2", behind)] as Array[Dictionary], EYE, 0.0, EYE, 0.016)
assert_eq(captions.lines(), ["Ship's bell", "Footsteps, behind"] as Array[String])
func test_the_players_own_and_far_steps_are_left_out() -> void:
var captions: Captions = Captions.new()
var cues: Array[Dictionary] = [
cue("step_rock_1", EYE + Vector3(0.5, 0.0, 0.0)),
cue("shot_dock_carbine", EYE + Vector3(0.0, 1.2, 0.3)),
cue("step_rock_2", EYE + Vector3(0.0, 0.0, 40.0)),
]
captions.hear(cues, EYE, 0.0, EYE, 0.016)
assert_eq(captions.lines().size(), 0, "%s" % [captions.lines()])
func test_lines_fade_and_never_pile_up() -> void:
var captions: Captions = Captions.new()
var cues: Array[Dictionary] = [cue("foghorn"), cue("bell"), cue("surge"), cue("hurt"), cue("keg_blast", EYE + Vector3(0.0, 0.0, 20.0))]
captions.hear(cues, EYE, 0.0, Vector3.INF, 0.016)
assert_eq(captions.lines().size(), Captions.MAX_LINES)
assert_eq(captions.lines()[Captions.MAX_LINES - 1], "Powder keg blast, ahead")
var none: Array[Dictionary] = []
captions.hear(none, EYE, 0.0, Vector3.INF, Captions.SECONDS + 0.1)
assert_eq(captions.lines().size(), 0)
func test_the_hud_shows_them() -> void:
var hud: Hud = Hud.new()
var state: HudState = HudState.new()
state.captions = ["Gunfire, left"] as Array[String]
hud.show_state(state)
var found: bool = false
for label: Node in hud.find_children("*", "Label", true, false):
if (label as Label).text == "[ Gunfire, left ]":
found = true
assert_true(found, "a caption line on the HUD")
hud.free()
+1
View File
@@ -0,0 +1 @@
uid://bakugnl3g23rk
+53 -6
View File
@@ -40,25 +40,25 @@ func test_offline_play_goes_through_the_same_client_against_a_local_server() ->
assert_null(session.link) assert_null(session.link)
assert_null(session.game.net, "no socket: the packets are handed across") assert_null(session.game.net, "no socket: the packets are handed across")
var server: ServerLoop = session.local.loop var server: ServerLoop = session.local.loop
var seen_barge: bool = false var seen_ship: bool = false
var most_figures: int = 0 var most_figures: int = 0
var landed_frame: int = -1 var landed_frame: int = -1
for frame: int in 60 * 150: for frame: int in 60 * 150:
session.pump(FRAME) session.pump(FRAME)
if session.view != null: if session.view != null:
most_figures = maxi(most_figures, session.view.entities.figure_count()) most_figures = maxi(most_figures, session.view.entities.figure_count())
if session.view.entities.barge().visible and session.mirror.own_id != 0: if session.view.entities.ship().visible and session.mirror.own_id != 0:
if not seen_barge: if not seen_ship:
seen_barge = true seen_ship = true
var figure: Node3D = session.view.entities.figure_of(session.mirror.own_id) var figure: Node3D = session.view.entities.figure_of(session.mirror.own_id)
assert_not_null(figure, "the client's own player is drawn") 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") 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: if landed_frame < 0 and session.game.playing() and _own().drop_state == Drop.NONE:
landed_frame = frame landed_frame = frame
if landed_frame >= 0 and frame > landed_frame + 60 * 8: if landed_frame >= 0 and frame > landed_frame + 60 * 8:
break break
assert_true(seen_barge) assert_true(seen_ship)
assert_true(landed_frame > 0, "the scripted player leapt and came down") assert_true(landed_frame > 0, "the scripted player leapt and came down")
assert_eq(session.phases[0], Match.DROP) assert_eq(session.phases[0], Match.DROP)
assert_eq(most_figures, 4, "all four players were drawn at once") assert_eq(most_figures, 4, "all four players were drawn at once")
@@ -269,3 +269,50 @@ func test_browse_options() -> void:
assert_eq(ClientConfig.parse(PackedStringArray(["--browse"])).lan_port, ServerConfig.DEFAULT_PORT) assert_eq(ClientConfig.parse(PackedStringArray(["--browse"])).lan_port, ServerConfig.DEFAULT_PORT)
assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--lan-target=somewhere"])).is_valid()) assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--lan-target=somewhere"])).is_valid())
assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--connect=192.0.2.7"])).is_valid()) assert_false(ClientConfig.parse(PackedStringArray(["--browse", "--connect=192.0.2.7"])).is_valid())
static func _pad_button(index: JoyButton, pressed: bool) -> InputEventJoypadButton:
var event: InputEventJoypadButton = InputEventJoypadButton.new()
event.button_index = index
event.pressed = pressed
return event
static func _pad_axis(which: JoyAxis, value: float) -> InputEventJoypadMotion:
var event: InputEventJoypadMotion = InputEventJoypadMotion.new()
event.axis = which
event.axis_value = value
return event
func test_a_gamepad_plays_through_the_session() -> void:
# A13: the script lands the player; then a simulated pad takes over.
session.play_offline(4, 3)
for frame: int in 60 * 150:
session.pump(FRAME)
if session.game.playing() and _own().drop_state == Drop.NONE and _own().on_ground:
break
assert_true(session.game.playing() and _own().drop_state == Drop.NONE, "landed")
session.input.autoplay = false
session.input.yaw = 0.0
var start: Vector3 = _own().position
session.input.handle(_pad_axis(JOY_AXIS_LEFT_Y, -1.0), false)
for frame: int in 60 * 2:
session.pump(FRAME)
var walked: float = Vector2(_own().position.x - start.x, _own().position.z - start.z).length()
assert_true(walked > 3.0, "the left stick walked the player %.1f m" % walked)
assert_false(session.input.targets.is_empty(), "aim assist sees the bots as opponents")
session.input.handle(_pad_axis(JOY_AXIS_LEFT_Y, 0.0), false)
session.input.handle(_pad_button(JOY_BUTTON_RIGHT_SHOULDER, true), false)
session.input.handle(_pad_button(JOY_BUTTON_RIGHT_SHOULDER, false), false)
for frame: int in 10:
session.pump(FRAME)
assert_eq(_own().selected, 1, "the right bumper picked the first slot")
# Start asks for the pause menu, as Escape does.
var asked: Array[bool] = [false]
session.pause_requested.connect(func() -> void: asked[0] = true)
var tree: SceneTree = Engine.get_main_loop() as SceneTree
tree.root.add_child(session)
session._unhandled_input(_pad_button(JOY_BUTTON_START, true))
assert_true(asked[0], "Start asked for the pause menu")
tree.root.remove_child(session)
+2 -2
View File
@@ -157,7 +157,7 @@ func test_glide_shows_the_sail_and_hides_the_held_item() -> void:
player.drop_state = Drop.GLIDING player.drop_state = Drop.GLIDING
player.on_ground = false player.on_ground = false
figure.drive(player, 0.0) figure.drive(player, 0.0)
assert_true(figure.sail().visible) assert_true(figure.kite().visible)
assert_false(figure.hand().visible) assert_false(figure.hand().visible)
@@ -273,7 +273,7 @@ func _bounds() -> AABB:
var first: bool = true var first: bool = true
for node: Node in figure.find_children("*", "MeshInstance3D", true, false): for node: Node in figure.find_children("*", "MeshInstance3D", true, false):
var part: MeshInstance3D = node 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 continue
var box: AABB = figure.relative(part) * part.mesh.get_aabb() var box: AABB = figure.relative(part) * part.mesh.get_aabb()
out = box if first else out.merge(box) out = box if first else out.merge(box)
+67
View File
@@ -209,3 +209,70 @@ func test_renderer_fallback_notice() -> void:
assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-method", "gl_compatibility"])), "", "the player chose OpenGL") assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-method", "gl_compatibility"])), "", "the player chose OpenGL")
assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-driver=opengl3"])), "", "the player chose OpenGL") assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-driver=opengl3"])), "", "the player chose OpenGL")
assert_eq(RendererCheck.fallback_notice(), "", "nothing to say headless") assert_eq(RendererCheck.fallback_notice(), "", "nothing to say headless")
func test_gamepad_and_accessibility_round_trip_and_fall_back() -> void:
var settings: GameSettings = GameSettings.new()
assert_true(settings.mouse.aim_assist, "aim assist starts on")
assert_false(settings.captions)
assert_false(settings.reduce_motion)
settings.mouse.pad_sensitivity = 1.75
settings.mouse.aim_assist = false
settings.vision = Palette.VISION_RED_GREEN
settings.ui_scale = 1.15
settings.captions = true
settings.reduce_motion = true
assert_eq(settings.save(PATH), OK)
var loaded: GameSettings = GameSettings.load_from(PATH)
assert_near(loaded.mouse.pad_sensitivity, 1.75, 0.0001)
assert_false(loaded.mouse.aim_assist)
assert_eq(loaded.vision, Palette.VISION_RED_GREEN)
assert_eq(loaded.ui_scale, 1.15)
assert_true(loaded.captions)
assert_true(loaded.reduce_motion)
var config: ConfigFile = ConfigFile.new()
config.set_value("access", "vision", 42)
config.set_value("access", "ui_scale", 7.0)
config.set_value("access", "captions", "yes")
config.set_value("input", "pad_sensitivity", 99.0)
config.set_value("input", "aim_assist", 3)
config.save(PATH)
loaded = GameSettings.load_from(PATH)
assert_eq(loaded.vision, Palette.VISION_NAMES.size() - 1, "clamped")
assert_eq(loaded.ui_scale, 1.0, "a scale not offered is the default")
assert_false(loaded.captions)
assert_near(loaded.mouse.pad_sensitivity, InputSettings.MAX_PAD_SENSITIVITY, 0.0001)
assert_true(loaded.mouse.aim_assist)
func test_applying_sets_the_colour_vision_and_interface_size() -> void:
var tree: SceneTree = Engine.get_main_loop() as SceneTree
var settings: GameSettings = GameSettings.new()
settings.vision = Palette.VISION_BLUE_YELLOW
settings.ui_scale = 1.3
settings.apply_to_program(tree)
assert_eq(Palette.vision, Palette.VISION_BLUE_YELLOW)
assert_near(tree.root.content_scale_factor, 1.3, 0.0001)
GameSettings.new().apply_to_program(tree)
assert_eq(Palette.vision, Palette.VISION_STANDARD)
assert_near(tree.root.content_scale_factor, 1.0, 0.0001)
func test_reduce_motion_calms_the_aim_zoom() -> void:
var rig: CameraRig = CameraRig.new()
rig.update_aim(true, 0.1)
var quick: float = rig.aim_blend
rig.aim_blend = 1.0
var full_zoom: float = rig.fov()
var calm: CameraRig = CameraRig.new()
calm.reduce_motion = true
calm.update_aim(true, 0.1)
assert_true(calm.aim_blend < quick, "eases in more slowly")
calm.aim_blend = 1.0
assert_true(calm.fov() > full_zoom + 10.0, "zooms in less: %.0f against %.0f" % [calm.fov(), full_zoom])
var view: MatchView = MatchView.new()
var settings: GameSettings = GameSettings.new()
settings.reduce_motion = true
view.apply_settings(settings)
assert_true(view.rig.reduce_motion)
view.free()
+22
View File
@@ -214,3 +214,25 @@ func test_a_down_in_duos_travels_in_the_feed_and_reads_as_a_down() -> void:
assert_eq(lines[0]["text"], "You knocked Thole down") assert_eq(lines[0]["text"], "You knocked Thole down")
assert_eq(lines[1]["text"], "Brine is down") assert_eq(lines[1]["text"], "Brine is down")
assert_eq(HudState.feed_lines(told["entries"], -3)[0]["text"], "Ada knocked you down") assert_eq(HudState.feed_lines(told["entries"], -3)[0]["text"], "Ada knocked you down")
func test_the_bottom_row_never_overlaps_at_any_interface_size() -> void:
# A13: the interface size makes the canvas narrower; the hotbar must stay clear of
# the vitals and the materials, and inside the screen.
for scale: float in GameSettings.UI_SCALES:
var hud: Hud = Hud.new()
var canvas: Vector2 = Vector2(1280.0, 720.0) / scale
hud.size = canvas
var state: HudState = HudState.new()
state.playing = true
for index: int in 6:
state.slots.append({"id": "", "name": "Slot", "count": 0, "rounds": 0, "reserve": 0, "magazine": 0, "tier": -1, "selected": index == 0, "empty": true})
hud.show_state(state)
var bar: Rect2 = hud.hotbar_rect()
assert_true(bar.position.x >= hud.vitals_rect().end.x + 1.0, "at %d%% the hotbar starts after the vitals: %s" % [roundi(scale * 100.0), bar])
var materials_left: float = canvas.x - Hud.MARGIN - hud.materials_rect().size.x
assert_true(bar.end.x <= materials_left - 1.0, "at %d%% the hotbar ends before the materials (%.0f, %.0f)" % [roundi(scale * 100.0), bar.end.x, materials_left])
assert_true(bar.size.x >= 6.0 * Hud.SLOT_MIN_WIDTH, "slots no narrower than the least")
if is_equal_approx(scale, 1.0):
assert_near(bar.get_center().x, canvas.x * 0.5, 1.0, "centred at 100%")
hud.free()

Some files were not shown because too many files have changed in this diff Show More