Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
557a3e1f11 | ||
|
|
aa797580a7 | ||
|
|
4357861bd4 | ||
|
|
8142e39ab3 | ||
|
|
dbe1ef923a | ||
|
|
b604ced923 | ||
|
|
4ea170175d | ||
|
|
2167900e45 | ||
|
|
324bf84dd5 | ||
|
|
eb239c5424 | ||
|
|
4177bfff76 | ||
|
|
8710c099b3 | ||
|
|
358234d246 |
@@ -32,22 +32,27 @@ continuity.
|
||||
| `tools/capture.sh <scene-or-scenario> <out.png>` | Renders the real client offscreen in a throwaway `tidewall-capture-*` Docker container (Xvfb, Mesa software rendering) and saves a PNG. Fails on a blank frame or a renderer fallback. |
|
||||
| `tools/godot.sh --script res://tools/island_map.gd -- --seed=N --out=res://captures/island.png` | Draws a top-down map of a seed's island, with a contour at each tide level. |
|
||||
| `make bot-matches` | Plays 20 bot-only matches (about ten minutes, under `nice`) and checks every one has a winner, under a tenth of deaths are drownings, and easy bots win less than an even share and take the fewest eliminations. `BOT_MATCH_SEEDS=5 BOT_MATCH_FIRST=40` changes the seeds; under 20 matches the difficulty checks are skipped. |
|
||||
| `make duo-matches` | M7: plays 10 bot-only duos matches (12 teams of two, under `nice`, about 5 min) and checks each is won by one team, bots go down and revive each other, no hit between teammates did damage, and the worst p99 tick is within budget. `DUO_MATCH_SEEDS`, `DUO_MATCH_FIRST` change the seeds. |
|
||||
| `make bot-builds` | M6: plays 40 bot-only matches (about 12 minutes, under `nice`) in which every other bot gathers and builds, and compares them with the rest. Builders must build in over a third of the fights they begin with the materials for a wall, lose fewer of the fights they build in than of the rest, and place no worse on average; every match's p99 tick must be within budget. `BOT_BUILDS_SEEDS=5 BOT_BUILDS_FIRST=40` changes the seeds; under 20 matches only completion and timing are judged. Lines in `build/bot_builds/matches.jsonl`. See docs/BALANCE.md. |
|
||||
| `make balance` | H3: plays 200 bot-only matches in four processes under `nice` (about 15 min) and writes `build/balance/report.txt`: match length, players standing over time, causes of death, eliminations by weapon and by difficulty. Fails if the median match is outside 12 to 18 minutes or a weapon takes over 35% of eliminations (`BALANCE_*` in tuning). `BALANCE_MATCHES`, `BALANCE_FIRST`, `BALANCE_JOBS` scale it. See docs/BALANCE.md. |
|
||||
| `make match` | Plays one whole offline match, lobby to results: a scripted player and 23 bots on a local server (about 25 s). Saves the command log to `build/match/match.tclog`, replays it and checks the replay ends on the same state hash. `MATCH_SEED=N` changes the seed; the default, 29, is one where the scripted player also builds. |
|
||||
| `make match` | Plays one whole offline match, lobby to results: a scripted player and 23 bots on a local server (about 25 s). Saves the command log to `build/match/match.tclog`, replays it and checks the replay ends on the same state hash. `MATCH_SEED=N` changes the seed; the default, 2, is one where the scripted player also builds. |
|
||||
| `make match-captures` | Renders eight stages of that match from its command log (`captures/match_<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. |
|
||||
| `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). |
|
||||
| `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. |
|
||||
| `make discovery-check` | Starts a list server and a game server as processes and checks `--browse` finds the game both on the LAN (loopback) and through the list (about 15 s). |
|
||||
| `make fuzz` | Feeds 1,000,000 malformed messages (`FUZZ_MESSAGES=N`, `FUZZ_SEED=N`) to every network parser and fails on any engine error or memory growth (about 40 s). |
|
||||
| `make client-captures` | Renders what a network client sees on the barge, gliding and landed, the build ghost allowed and refused, and a breakwater basin kept dry by the tide (`captures/client_<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 menu-captures` | Renders every menu screen: main, practice, join (with a made-up server list), settings (controls and mouse tabs), pause and results over a match (`captures/menu_*.png`, about 5 min). Needs Docker. Look at them. |
|
||||
| `make chart-captures` | Renders the chart and minimap of seed 2 with the first tide forecast, and again once it has risen (`captures/chart_*.png`, about 2 min). Needs Docker. Look at them. |
|
||||
| `make poi-captures` | Renders each kind of point of interest (`captures/poi_*.png`, about 3 min). Needs Docker. Look at them. |
|
||||
| `make build-captures` | Renders the fort and the wall test card: a row per material, a column per state (half built, intact, worn, battered), and a battered ramp (`captures/build_*.png`), and the barge and sea chests (`captures/vessels.png`), about 2 min. Needs Docker. Look at them. |
|
||||
| `make build-captures` | Renders the fort and the wall test card: a row per material, a column per state (half built, intact, worn, battered), and a battered ramp (`captures/build_*.png`), and the packet ship and sea chests (`captures/vessels.png`), about 2 min. Needs Docker. Look at them. |
|
||||
| `tools/capture.sh canopy captures/canopy.png` | H11: the shoulder camera on a player against a pine, with canopies in the way hidden (`canopy_before` puts them back). |
|
||||
| `make style-captures` | Renders a hamlet and a dock with and without the woodcut print pass (`captures/style_*.png`). Needs Docker. |
|
||||
| `make stability` | H4: one dedicated server plays 50 bot matches back to back, unthrottled, under `nice` (about 13 min), sampling its resident memory. Fails on a crash, hang, engine or script error, a match without a winner, or memory growing more than 256 KiB (static) or 1 MiB (resident) a match after the first five. `STABILITY_MATCHES`, `STABILITY_SEED`, `STABILITY_DIR` scale it. Report in `build/stability/report.txt`. |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Tidewall build entry points. Everything runs headless with the repo-local engine.
|
||||
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 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).
|
||||
audio: import
|
||||
@@ -116,6 +116,19 @@ balance: import
|
||||
bot-matches: import
|
||||
@tools/bot_matches.sh
|
||||
|
||||
## M7: plays 10 bot-only duos matches (12 teams of two, under nice) and checks each is
|
||||
## won by one team, bots go down and revive each other, teammates never hurt each other
|
||||
## and the ticks keep within budget. DUO_MATCH_SEEDS and DUO_MATCH_FIRST change the seeds.
|
||||
duo-matches: import
|
||||
@tools/duo_matches.sh
|
||||
|
||||
## M6: plays 40 bot-only matches in which every other bot gathers and builds (about 12
|
||||
## minutes, under nice) and checks the builders build in over a third of the fights they
|
||||
## can afford to, lose fewer of the fights they build in than of the rest, and place no
|
||||
## worse than the others. BOT_BUILDS_SEEDS and BOT_BUILDS_FIRST change the seeds.
|
||||
bot-builds: import
|
||||
@tools/bot_builds.sh
|
||||
|
||||
## Plays one whole offline match, lobby to results, with a scripted player and 23 bots,
|
||||
## then replays its command log and checks the replay ends in the same state.
|
||||
## MATCH_SEED picks the seed.
|
||||
@@ -126,6 +139,16 @@ match: import
|
||||
match-captures: import
|
||||
@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
|
||||
## it gets from the lobby into the match. About a minute, in real time.
|
||||
client-check: import
|
||||
@@ -141,19 +164,26 @@ fuzz: import
|
||||
discovery-check: import
|
||||
@tools/discovery_check.sh
|
||||
|
||||
## Renders what a network client sees on the barge, gliding and landed. Needs Docker.
|
||||
## Renders what a network client sees on the ship, gliding and landed. Needs Docker.
|
||||
client-captures: import
|
||||
@for stage in barge glide landed basin build build_refused hud hud_build; do tools/capture.sh client_$$stage captures/client_$$stage.png; done
|
||||
@for stage in ship glide landed basin build build_refused hud hud_build; do tools/capture.sh client_$$stage captures/client_$$stage.png; done
|
||||
|
||||
## A9: the HUD at 1280x720 and at 3840x2160 (captures/hud_*.png). Needs Docker.
|
||||
hud-captures: import
|
||||
@CAPTURE_SIZE=1280x720 tools/capture.sh client_hud captures/hud_720.png
|
||||
@CAPTURE_SIZE=1280x720 tools/capture.sh client_hud_build captures/hud_build_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
|
||||
|
||||
## 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.
|
||||
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
|
||||
## (captures/chart_*.png, about 2 min). Needs Docker. Look at them.
|
||||
|
||||
@@ -27,12 +27,12 @@ All of this is checked headless or with **software rendering in a container**. N
|
||||
## Known limitations
|
||||
|
||||
- **Untested on real hardware.** No real GPU, Wayland session or hybrid-graphics machine has run it yet ([docs/PLAY.md](docs/PLAY.md#tested-configurations)).
|
||||
- **Solo only.** Duos and reviving ([#30](https://gitea.eom.dev/claude/tidewall/issues/30)) aren't in this release.
|
||||
- **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 don't build** ([#29](https://gitea.eom.dev/claude/tidewall/issues/29)), and most of them fall early in a match ([#74](https://gitea.eom.dev/claude/tidewall/issues/74)).
|
||||
- **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)).
|
||||
- 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.
|
||||
- **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.
|
||||
- Under OpenGL with shadows on, ground and rocks look paler than under Vulkan ([#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)).
|
||||
- The name is a working name until it has been cleared.
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
0.92,
|
||||
0.0
|
||||
],
|
||||
"kite": [
|
||||
0.0,
|
||||
1.46,
|
||||
-0.2
|
||||
],
|
||||
"knee_l": [
|
||||
0.11,
|
||||
0.49,
|
||||
@@ -52,11 +57,6 @@
|
||||
1.5,
|
||||
0.0
|
||||
],
|
||||
"sail": [
|
||||
0.0,
|
||||
1.46,
|
||||
-0.2
|
||||
],
|
||||
"shoulder_l": [
|
||||
0.225,
|
||||
1.42,
|
||||
@@ -86,12 +86,12 @@
|
||||
"joint": "neck",
|
||||
"parent": "waist"
|
||||
},
|
||||
"pelvis": {
|
||||
"joint": "hips",
|
||||
"kite": {
|
||||
"joint": "kite",
|
||||
"parent": null
|
||||
},
|
||||
"sail": {
|
||||
"joint": "sail",
|
||||
"pelvis": {
|
||||
"joint": "hips",
|
||||
"parent": null
|
||||
},
|
||||
"shin_l": {
|
||||
@@ -123,5 +123,5 @@
|
||||
"parent": "waist"
|
||||
}
|
||||
},
|
||||
"triangles_before_bevel": 1484
|
||||
"triangles_before_bevel": 1640
|
||||
}
|
||||
|
||||
@@ -31,6 +31,16 @@ Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl SALT
|
||||
Ns 39.999996
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.787412 0.787412 0.710566
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl TAR
|
||||
Ns 39.999996
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
+20
-11
@@ -172,7 +172,7 @@ sources tracked per second). A source is an IPv4 address, or an IPv6 address's w
|
||||
**Lobby, backfill and late arrivals.** People who connect during the lobby or the
|
||||
countdown take places (`Match.join()`); bots are only added when the match starts,
|
||||
into whatever places are still empty, so people joining and leaving in the lobby
|
||||
never displace or strand a bot. Someone who connects after the barge leaves, or
|
||||
never displace or strand a bot. Someone who connects after the ship sails, or
|
||||
during results, becomes a watcher (`Match.watch()`): they spectate a living player
|
||||
(the winner during results) through the same snapshots an eliminated player gets,
|
||||
and take a place ahead of any bots when the next lobby opens. The server still turns
|
||||
@@ -300,8 +300,8 @@ What isn't sent: props, chests' places and their contents, which the client roll
|
||||
itself from the seed, as it does the island; and a piece's health, which follows from
|
||||
how far its building had got, the ticks since, and the damage it has taken. So a
|
||||
piece being built costs nothing on the wire. A scripted match of 12,198 ticks with 24
|
||||
players made 121 messages, 2.3 KB in all. Bots don't build yet, so a match of people
|
||||
building will make far more: a new piece is about 16 bytes to each client.
|
||||
players made 121 messages, 2.3 KB in all. That was before bots built (M6); a match with
|
||||
building makes more: a new piece is about 16 bytes to each client.
|
||||
|
||||
`ClientWorld` applies them to the client's world. `NetWorld.world_hash()` covers
|
||||
everything replicated this way, and a client that has applied every message up to a
|
||||
@@ -360,7 +360,7 @@ trips, 41 of 41 shots hit; with the lag ignored, 0 of 41. At 500 ms, past the ca
|
||||
`ClientGame` (`src/net/`) is a client's side of a match. It works on packets, so it
|
||||
runs the same over a `NetClient` or a test's simulated link. From the seed in the
|
||||
MATCH notice it generates the island itself (a `Simulation` it never steps) and plans
|
||||
the same barge route, so it can run the server's movement code on the server's ground.
|
||||
the same ship route, so it can run the server's movement code on the server's ground.
|
||||
|
||||
**The command clock.** A command must reach the server before the tick it names, so
|
||||
the client's tick runs ahead of the server's by the trip there plus a margin. Nobody
|
||||
@@ -482,7 +482,7 @@ weights from the island's elevation bands, with rock on steep ground.
|
||||
|
||||
`MatchView` (`src/client/`) is the client's picture of one match: sky, sun, terrain,
|
||||
sea, points of interest, props, built pieces and `EntityView`, which draws players, the
|
||||
barge, items and chests. All of it reads one `Simulation` and never writes to it, and a
|
||||
ship, items and chests. All of it reads one `Simulation` and never writes to it, and a
|
||||
new match gets a new view. The camera sits on a player's shoulder through `CameraRig`.
|
||||
`EffectsView` (`src/client/effects/`, A7) draws the match's visual effects from the
|
||||
server's FX records and from changes it sees in the world (pieces gone, players in the
|
||||
@@ -490,7 +490,7 @@ water, surges). Its particles are simulated on the CPU in packed arrays and draw
|
||||
two MultiMeshes (blended and added) of camera-facing quads, sized per instance by a
|
||||
small shader, with tracers as a third; everything is allocated once at the preset's
|
||||
budget, so a big fight costs a fixed three draw calls and never adds nodes or grows buffers.
|
||||
The figure (`FigureRig`), items (`ItemModels`) and barge and chests (`VesselModels`) are
|
||||
The figure (`FigureRig`), items (`ItemModels`) and ship and chests (`VesselModels`) are
|
||||
the generated art described in assets/PROVENANCE.md; `test_world_art` fails on any
|
||||
primitive stand-in mesh.
|
||||
|
||||
@@ -499,7 +499,7 @@ In play, the simulation it reads is the client's own copy of the world: the
|
||||
`ClientWorld` keeps its pieces, props, chests and tide in line with the server, and
|
||||
`ClientMirror` (`src/net/`) writes the rest of the picture into it every frame: each
|
||||
entity the server has told this client about, where it is being drawn now (everyone
|
||||
else from the recent past, the client's own player where it was predicted), the barge,
|
||||
else from the recent past, the client's own player where it was predicted), the ship,
|
||||
the clock and the sea level. So the same views draw a networked match, a local
|
||||
server's simulation in a test, or a replay in a capture, and there is one set of
|
||||
drawing code. Captures and tests still point a `MatchView` straight at a server's
|
||||
@@ -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
|
||||
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.
|
||||
There are no menus yet (N6, A10) and no HUD (A9): one line of text says when the
|
||||
client is connecting, in the lobby or watching.
|
||||
With a window and no mode, `AppShell` opens the menus (A10) and the HUD (A9) draws
|
||||
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
|
||||
|
||||
@@ -550,7 +559,7 @@ budget:
|
||||
The max includes one long tick per match: unthrottled, the 15 s results screen passes
|
||||
in a fraction of a second, so the main thread waits for the worker still building the
|
||||
next island. At the real 30 Hz the worker finishes long before the lobby opens.
|
||||
- **Client:** the match `make match` saved, rendered at the whole island, the barge (24
|
||||
- **Client:** the match `make match` saved, rendered at the whole island, the ship (24
|
||||
figures together, the worst case for draw calls), landed, a build and the final
|
||||
players, and a crowded pine forest. Each capture reports its frame's draw calls,
|
||||
primitives, objects, nodes and memory (`tools/capture.gd`'s `render` field).
|
||||
@@ -622,7 +631,7 @@ model and tier. The hotbar shows the icons.
|
||||
## Player figure (A2)
|
||||
|
||||
`tools/models/figure.py` builds the islander in headless Blender as twelve rigid
|
||||
parts (pelvis, torso, head, upper arms, forearms, thighs, shins and the wing-sail),
|
||||
parts (pelvis, torso, head, upper arms, forearms, thighs, shins and the gull-kite),
|
||||
each an OBJ whose origin is the joint it turns about, plus `figure.json` with the
|
||||
joints and hand points (`make art` rebuilds these and the items). OBJ has no
|
||||
skeleton, so the figure is jointed rather than skinned.
|
||||
|
||||
@@ -6,7 +6,7 @@ is sampled, recorded, downloaded or taken from a third party. How each kind of a
|
||||
made is described in [assets/PROVENANCE.md](../assets/PROVENANCE.md); the licence is
|
||||
CC BY-SA 4.0 ([LICENSE-ASSETS](../LICENSE-ASSETS)).
|
||||
|
||||
Code-built art (terrain, sea, points of interest, props, build pieces, the barge, sea
|
||||
Code-built art (terrain, sea, points of interest, props, build pieces, the ship, sea
|
||||
chests and effects) isn't a file here: it's drawn by the scripts under `src/client/`.
|
||||
|
||||
This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and
|
||||
@@ -104,10 +104,10 @@ This file is written by `tools/godot.sh --script res://tools/provenance.gd`, and
|
||||
| `assets/models/figure/forearm_r.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/head.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/head.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/kite.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/kite.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/pelvis.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/pelvis.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/sail.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/sail.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/shin_l.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/shin_l.obj` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
| `assets/models/figure/shin_r.mtl` | `tools/models/figure.py` | A part of the player figure (OBJ and MTL) or its joint data (JSON), built from primitives in headless Blender. |
|
||||
|
||||
@@ -112,6 +112,52 @@ Every match ended with one player standing before the tide's clock ran out. Matc
|
||||
when the rising water brings the last few together: half of them end between 11 and 14
|
||||
minutes, from phase 4's rise to phase 6's hold.
|
||||
|
||||
## Bots that build (M6, 2026-11-15)
|
||||
|
||||
`make bot-builds` (`tools/bot_builds.sh`) plays bot-only matches in which every other
|
||||
bot gathers and builds and the rest don't, so the two groups meet the same islands,
|
||||
opponents and difficulty mix. Each bot counts its fights (a stretch with an opponent in
|
||||
which shots or swings were traded), whether it began them with the materials for a
|
||||
wall, whether it placed a piece in them, and whether it fell.
|
||||
|
||||
What bots build: a wall toward a shooter who catches them reloading, from ambush or
|
||||
worn down; a wall to heal behind instead of running when badly hurt; ramps up to
|
||||
someone on a cliff or a steep rise; and, late in the match, a ring of breakwaters round
|
||||
their cell when the tide would catch them or at the last stand.
|
||||
|
||||
The first batches had builders gathering up to 120 of a material whenever a prop was
|
||||
in reach. Over 40 matches (seeds 501 to 540) they won 15 to the control group's 25 and,
|
||||
on seeds 521 to 540, lost 70% of their fights to the control group's 63%. Fights they
|
||||
built in went better, so the cost was in gathering: standing at a prop facing away
|
||||
from trouble, and time not spent looting. Gathering now waits until 10 s after the
|
||||
last sight of an opponent or hit taken, not when hurt, and stops at 60 (120 in the last
|
||||
three tide phases, for a ring).
|
||||
|
||||
With that, over seeds 501 to 540:
|
||||
|
||||
| | builders | control |
|
||||
|---|---|---|
|
||||
| fights | 584 | 594 |
|
||||
| fights lost | 65.8% | 65.7% |
|
||||
| mean place | 12.1 | 12.8 |
|
||||
| wins | 20 | 20 |
|
||||
|
||||
- Builders began 23% of their fights with the materials for a wall, and built in 53% of
|
||||
those, 12% of all their fights. Most fights are in the landing rush, before anyone has
|
||||
gathered anything.
|
||||
- In the fights they built in they lost 58% (41 of 71); in the rest, 67%.
|
||||
- They place better on average, by 0.2 to 1.0 places in every 20-match batch measured.
|
||||
- They don't yet win fights or matches more often overall. Building helps a bot in the
|
||||
fights it builds in. The time spent gathering, and fewer than a quarter of fights
|
||||
begun with materials, leave the totals level.
|
||||
- Breakwater rings are rare: few matches last to the last stand, and few bots by then
|
||||
have 120 of one material. Tests cover the ring itself.
|
||||
- The worst p99 tick in any of these matches was 3.4 ms, inside the 12 ms budget.
|
||||
|
||||
`make bot-builds` checks what held: builders build in over a third of the fights they
|
||||
can afford to, lose fewer of the fights they build in than of the rest, and place no
|
||||
worse than the control group.
|
||||
|
||||
## Known and left open
|
||||
|
||||
- **The landing is still bloody.** About three quarters of a bot lobby falls in the first
|
||||
|
||||
+401
@@ -1465,3 +1465,404 @@ container. That doesn't fit the end of this run.
|
||||
4. Write release notes saying what isn't done and that nothing was tested on real GPU
|
||||
hardware.
|
||||
5. If the soak fails (H13), don't cut the release: report it.
|
||||
|
||||
## 2026-11-14 (evening): R5 release gates, v1.0.0 tagged, release drafted
|
||||
|
||||
**Version 1.0.0 (f776d59).** `application/config/version`, the install commands in
|
||||
PLAY.md and SERVER.md, and the README status now say 1.0.0. Also in the README:
|
||||
- The effects limitation is gone, since A7 shipped.
|
||||
- The Later issues for keg-throwing bots (#83) and list servers in the Join menu (#82)
|
||||
are linked.
|
||||
|
||||
**First gate run on f776d59:**
|
||||
- `make check` passed (696 tests).
|
||||
- `make match` passed.
|
||||
- `make soak` failed. Every client process "logged its memory at 1 match starts". Hashes
|
||||
(2,438 compared, 0 differing), tick timing and server memory all passed.
|
||||
|
||||
**H17 (#86), filed and fixed in f5227b7.**
|
||||
- **Cause:** match 0 of the seed-7 soak was decided during the drop. The 24 clients
|
||||
fought as they landed, with 23 eliminations in 39 s, so the match never reached
|
||||
play. That's allowed by design. `test_match` already ends a match in the drop.
|
||||
- **The gap:** `soak_clients.gd` sampled memory only on entering play, so that match
|
||||
gave no sample.
|
||||
- **Fix:** such a match is now sampled at its results. `samples_memory_in()` is
|
||||
unit-tested, and the memory line says where the sample came from. Earlier soaks
|
||||
passed because their first match reached play.
|
||||
|
||||
**Gates rerun from scratch on f5227b7, all passing:**
|
||||
- `make check`: 698 tests.
|
||||
- `make match`: the replay hash matched.
|
||||
- `make soak`: 2,458 hashes compared, 0 differing; p99 tick 6.7 ms; client growth
|
||||
0.65 MB, server 0.39 MB.
|
||||
- `make dist-check` and `make deb-check` passed. The packages' `VERSION` says
|
||||
f5227b731d2e.
|
||||
|
||||
**Tag `v1.0.0`** (annotated, on f5227b7) is pushed.
|
||||
|
||||
**The Gitea release is a draft:**
|
||||
- It has the release notes and both `.sha256` files.
|
||||
- The Gitea tools only take uploads as base64 inside the call, which doesn't work for
|
||||
a 30 MB tarball and a 22 MB .deb, and I didn't take a token from any config to
|
||||
upload another way.
|
||||
- The binaries are kept in the git-ignored `build/release-v1.0.0/`, which `make dist`
|
||||
doesn't touch.
|
||||
- R5 (#64) is labelled `needs-eric`. Eric attaches the two files and publishes (now or
|
||||
after his playtest). Then a run downloads them anonymously, checks the checksums and
|
||||
runs them in a clean container before closing R5.
|
||||
|
||||
**H13 (#80):** two more soaks with no mismatch, about 9,000 comparisons since its
|
||||
diagnostics went in.
|
||||
|
||||
**Pace (18:40 ET Saturday):**
|
||||
- The release is gated, tagged and drafted, 37 hours before Monday 08:00.
|
||||
- Waiting on Eric:
|
||||
- R5: attaching the binaries.
|
||||
- R6: the playtest.
|
||||
- R7: the name and the public server.
|
||||
- #72: the launch fiction.
|
||||
|
||||
**Next run:**
|
||||
1. If the release has its binaries, download them from the release, verify them and
|
||||
run them in a clean `tidewall-` container. If all is well, close R5 and the v1.0
|
||||
milestone.
|
||||
2. Otherwise, take the deferred work, bugs first: H13 (#80), then H14 (#81). After that,
|
||||
M6 and M7 (bots that build, duos), which carry no priority label.
|
||||
- A change to the game after v1.0.0 would need its own point release. Keep `main`
|
||||
releasable.
|
||||
|
||||
## 2026-11-14 (night): H14, no sun shadows under OpenGL
|
||||
|
||||
The v1.0.0 release is still a draft with no binaries, so R5 waits on Eric. This run
|
||||
took the deferred bugs, starting with H14 (#81).
|
||||
|
||||
**H14 (#81): the cause.**
|
||||
- A small scene (flat ground, a boulder, a post, Look's environment and sun) shows the
|
||||
same paleness with plain `StandardMaterial3D`. So it isn't our terrain shader.
|
||||
- I switched each part of the environment off in turn: fog, grading, glow, ambient,
|
||||
tonemapper, `use_hdr_2d` and render scale. None of them removes it.
|
||||
- With linear tonemapping and no fog or grading, every sunlit pixel under the
|
||||
Compatibility renderer equals srgb(ambient) + srgb(sun) to within one level in 255,
|
||||
in all three channels and at half sun energy too. Forward+ gives srgb(ambient + sun).
|
||||
Compatibility draws a shadowed directional light in its own pass and adds it after
|
||||
the frame is in sRGB. That's engine behaviour, and no project setting changes it.
|
||||
|
||||
**The fix.**
|
||||
- `Look.sun_shadows_supported()` is false under `gl_compatibility`.
|
||||
- `Look.sun()` and `MatchView.apply_settings()` leave the sun's shadows off there, on
|
||||
every preset. The presets' other settings still apply.
|
||||
- A test covers it. PLAY.md and the README explain it.
|
||||
- New capture scenarios: `sun_probe`, and `sun_shadow_probe`, which forces the shadows
|
||||
on. They're for rechecking after an engine upgrade.
|
||||
|
||||
**Captures (software rendering), looked at:**
|
||||
- `sun_probe`: luminance mean 0.622 under Compatibility against 0.603 under Forward+,
|
||||
the usual renderer difference. The colours match; only the shadows are missing.
|
||||
- `sun_shadow_probe` under Compatibility still shows the pale ground (0.743), as
|
||||
expected.
|
||||
- `quality_{low,medium,high}` under Compatibility now agree with each other (means
|
||||
0.239, 0.241, 0.240 on a seed-2 log).
|
||||
- The landed view in today's logs is inside a building, not out on the hillside the
|
||||
issue was filed from. Indoors, Forward+ High is darker from the roof's shadow,
|
||||
which OpenGL now doesn't draw, just like Low.
|
||||
|
||||
This changes the game after the v1.0.0 tag, so it belongs in a 1.0.1 if Eric wants
|
||||
OpenGL players to have it before the next release.
|
||||
|
||||
## 2026-11-15 (small hours): M6, bots that build
|
||||
|
||||
The v1.0.0 release is still a draft with no binaries, so R5 waits on Eric. H13 (#80)
|
||||
hasn't come back, so this run took the deferred M6 (#29). Its commit, eb239c5, is on
|
||||
`main` after the v1.0.0 tag: the 1.0.0 packages have bots that don't build.
|
||||
|
||||
**What bots build.** Every piece goes through the same build command, and the same
|
||||
`Building.check`, as a player's. The bot checks a stand-in posed where it stands, so it
|
||||
only presses build when the server would accept.
|
||||
- **Gathering:** armed and with nothing more pressing, a bot works props with the
|
||||
boathook, up to 60 of a material (120 late in the match).
|
||||
- **Cover:** a wall toward a shooter who catches it reloading, from ambush or worn down.
|
||||
- **Wall and heal:** a badly hurt bot that would break off heals behind a wall instead.
|
||||
- **Ramps:** a staircase up a cliff, each ramp from the top of the last.
|
||||
- **Breakwater rings:** for a bot the tide would catch late in the match, and at the
|
||||
last stand.
|
||||
|
||||
**Measuring it.** `make bot-builds` is new. Every other bot builds, and the rest are a
|
||||
control group.
|
||||
- **First version:** gathering whenever a prop was in reach. Builders won 15 matches to
|
||||
25 over 40, and on one seed set lost more fights. The fights they built in went
|
||||
better, so the cost was gathering: time taken from looting, and standing at a prop
|
||||
facing away from trouble.
|
||||
- **Now:** gathering waits 10 s after the last sight of an opponent or hit taken, not
|
||||
when hurt, and stops at 60.
|
||||
- **Final 40 matches:**
|
||||
- builders lost 58% of the fights they built in, against 67% of the rest;
|
||||
- their mean place was 12.1, against the control's 12.8;
|
||||
- overall fight losses (65.8% and 65.7%) and wins (20 each) came out level.
|
||||
- **The gate changed from my first draft.** I'd first required builders to build in a
|
||||
fifth of all fights. They had the materials in only 23% of fights; most fights are in
|
||||
the landing. So the gate is now "over a third of the fights they can afford to"
|
||||
(53% measured). Overall wins aren't gated, because they came out level; that's said
|
||||
in the tool, BALANCE.md, #29 and #74.
|
||||
|
||||
**Gates on eb239c5:**
|
||||
- `make check`: 261 scripts, 710 tests, smoke ok.
|
||||
- `make match`: ok.
|
||||
- `make bot-matches`: 20 with a winner, 3.9% drowned.
|
||||
- `make balance`: 200 matches, median 13.3 min, sea deaths 3.6%.
|
||||
- `make bot-builds`: 40 matches, ok.
|
||||
- Worst p99 tick 3.4 ms.
|
||||
|
||||
**Notes:**
|
||||
- Free memory was around 2 GB all run, so batches ran one process at a time, except
|
||||
balance with 3 jobs.
|
||||
- Eric's own terminal sessions running Tidewall on his display were open. I left them
|
||||
alone. He may have been playtesting; R6 is his.
|
||||
|
||||
**Next run:**
|
||||
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.
|
||||
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.
|
||||
|
||||
+34
-12
@@ -47,7 +47,7 @@ The server runs matches back to back, in [`src/sim/match.gd`](../src/sim/match.g
|
||||
1. **Lobby.** Players join. Once `MATCH_MIN_PLAYERS` are in, it waits
|
||||
`MATCH_LOBBY_SECONDS` for more, or counts down at once when full.
|
||||
2. **Countdown.** `MATCH_COUNTDOWN_SECONDS`. If too many leave, it goes back to the lobby.
|
||||
3. **Drop.** Bots fill the empty places, everyone boards the barge and loot is placed.
|
||||
3. **Drop.** Bots fill the empty places, everyone boards the packet ship and loot is placed.
|
||||
4. **Play.** Ends when at most one team has anyone standing.
|
||||
5. **Results.** Finishing places and the winners stay up for `MATCH_RESULTS_SECONDS`,
|
||||
then bots leave and the server goes back to the lobby with a new island.
|
||||
@@ -60,9 +60,24 @@ from it, so a whole session can be replayed from one seed.
|
||||
Bots fill empty slots. They pick a landing spot, loot, fight, bandage themselves and keep
|
||||
ahead of the tide, knowing only what a player would. They come in three difficulties,
|
||||
easy, normal and hard, which differ in reaction time, sight range and aim; a server
|
||||
mixes them unless told otherwise. Bots don't build yet, don't break crates, and don't
|
||||
mixes them unless told otherwise. Bots build too: once armed, they gather with the
|
||||
boathook (crates included) when nothing more pressing is going on. In a fight they put
|
||||
up a wall when shot from ambush, while reloading or when worn down, wall themselves off
|
||||
to heal instead of running when badly hurt, and build ramps up to someone on a cliff
|
||||
or a steep rise. At the last stand they ring their spot with breakwaters. They don't
|
||||
use powder kegs or the line thrower. Offline play is a local server filled with bots,
|
||||
the same game code as online play. A downed duo partner can be revived, within `REVIVE_SECONDS`.
|
||||
In duos (M7) bots never target their teammate, crawl toward it when downed, and go to a
|
||||
downed teammate within `BOT_REVIVE_METRES` to revive it when they aren't in a fight.
|
||||
|
||||
**Duos rules (M7).** Teams are set by `Match` and held on each player
|
||||
(`SimEntity.team`), so the simulation enforces them: `Weapons.damage_player` refuses
|
||||
damage between teammates from every weapon, the boathook and blasts. A player whose
|
||||
health runs out with a teammate standing goes down (`DOWNED_HEALTH`, bleeding one point
|
||||
every `DOWNED_BLEED_INTERVAL_TICKS`, crawling at `DOWNED_CRAWL_SPEED`); a standing
|
||||
teammate within `REVIVE_RANGE` holding interact for `REVIVE_SECONDS` brings them back
|
||||
with `REVIVE_HEALTH`. Downed players are eliminated when their health runs out again or
|
||||
when no teammate is left standing, credited to whoever downed them.
|
||||
|
||||
## The island
|
||||
|
||||
@@ -129,14 +144,21 @@ seed, so only damage is match state.
|
||||
### The drop
|
||||
|
||||
Every match starts with the drop, simulated in [`src/sim/drop.gd`](../src/sim/drop.gd).
|
||||
A carrier crosses the island at `BARGE_ALTITUDE` on a straight route drawn from the seed.
|
||||
The route passes within `BARGE_CENTRE_JITTER` of the middle and always crosses at least
|
||||
`BARGE_MIN_LAND_METRES` of dry land. Players ride it until they press jump, then fall,
|
||||
steering at `FREEFALL_STEER_SPEED`, up to `FREEFALL_MAX_SPEED`. Jump opens the sail, and
|
||||
it opens by itself `WING_AUTO_DEPLOY_HEIGHT` above the ground or water. Under the sail
|
||||
they sink at `GLIDE_FALL_SPEED` and steer at `GLIDE_SPEED`, and touch down without damage.
|
||||
Anyone still aboard at the end of the route is thrown off. The carrier's name and look,
|
||||
sky barge or the packet ship and mortar of the core loop above, are open in #72.
|
||||
A packet ship sails past the island on a straight route drawn from the seed, its deck
|
||||
`SHIP_DECK_HEIGHT` above the sea. The route runs as close in as it can while keeping
|
||||
`SHIP_COAST_CLEARANCE` of open water between itself and any land, so it never crosses
|
||||
the island. Players ride it until they press jump, which fires them inland by lifeline
|
||||
mortar along the way they face. How high they aim sets the charge: from
|
||||
`MORTAR_PITCH_LOW_DEGREES` (or lower) to `MORTAR_PITCH_HIGH_DEGREES` (or higher) the shot's
|
||||
speed over the ground runs from `MORTAR_MIN_SPEED` to `MORTAR_MAX_SPEED`, and every shot
|
||||
climbs at `MORTAR_RISE_SPEED`. Nothing steers the climb. Over the top of the arc they
|
||||
fall, steering at `FREEFALL_STEER_SPEED`, up to `FREEFALL_MAX_SPEED`. Jump opens the
|
||||
gull-kite, and it opens by itself `KITE_AUTO_DEPLOY_HEIGHT` above the ground or water.
|
||||
Under the kite they sink at `GLIDE_FALL_SPEED` and steer at `GLIDE_SPEED`, and touch down
|
||||
without damage. A full charge with the kite opened at the top carries about a kilometre,
|
||||
further than any land lies from any route (`test_drop` checks 60 seeds). Anyone still
|
||||
aboard at the end of the route is fired towards the middle of the island. Eric chose
|
||||
this launch in #72 over the sky barge first built for W7.
|
||||
|
||||
## Tide phases
|
||||
|
||||
@@ -316,7 +338,7 @@ each weapon's headshot multiplier.
|
||||
The balance targets are checked by `make balance` over at least `BALANCE_MIN_MATCHES`
|
||||
bot-only matches of `SOLO_PLAYERS` players (H3):
|
||||
|
||||
- the median match, from the barge leaving to the last player standing, lasts between
|
||||
- the median match, from the ship sailing to the last player standing, lasts between
|
||||
`BALANCE_MEDIAN_MINUTES_MIN` and `BALANCE_MEDIAN_MINUTES_MAX` minutes;
|
||||
- no one weapon takes more than `BALANCE_MAX_WEAPON_SHARE` of the eliminations made with
|
||||
weapons, the boathook included.
|
||||
@@ -333,7 +355,7 @@ Keys are matched by position. Defaults for keyboard and mouse:
|
||||
| Action | Default |
|
||||
|---|---|
|
||||
| Move | W A S D |
|
||||
| Jump; leap from the barge; open the wing-sail | Space |
|
||||
| Jump; fire the mortar from the ship; open the gull-kite | Space |
|
||||
| Crouch; dive when swimming | Left Ctrl |
|
||||
| Sprint | Left Shift |
|
||||
| Use, fire, harvest or place | Left mouse |
|
||||
|
||||
+96
-13
@@ -1,7 +1,7 @@
|
||||
# Playing Tidewall on Linux
|
||||
|
||||
Tidewall is a free and open-source build-and-survive battle royale. Up to 24 players
|
||||
and bots leap from a sky barge onto a generated island, scavenge, fight and build,
|
||||
and bots fire themselves from a packet ship onto a generated island, scavenge, fight and build,
|
||||
while the sea rises in phases and swallows the low ground. The last one standing wins.
|
||||
|
||||
To run a server, see [SERVER.md](SERVER.md).
|
||||
@@ -35,17 +35,26 @@ Replace `1.0.0` with the version you downloaded.
|
||||
|
||||
## 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.
|
||||
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
|
||||
an address (`host` or `host:port`; the default port is 24650) for any other server.
|
||||
- **Settings** has Controls, Mouse, Graphics, Display and Audio tabs.
|
||||
|
||||
You can also start straight into a match from a terminal:
|
||||
|
||||
./tidewall --tutorial # the tutorial
|
||||
./tidewall --offline # practice against 23 bots
|
||||
./tidewall --offline --bots=5 --seed=42 # fewer bots, a chosen island
|
||||
./tidewall --offline --duos # duos, with the first bot as your crewmate
|
||||
./tidewall --connect=192.0.2.7:24650 --name=Mara
|
||||
./tidewall --headless --browse # print the LAN's servers, then quit
|
||||
./tidewall --headless --browse --list=lists.example.org:24660 # and a list server's
|
||||
@@ -54,16 +63,30 @@ On a server, matches run back to back: a short lobby, a countdown, the drop, the
|
||||
and the results, then a new island. If you join during a match you wait in the lobby
|
||||
for the next one. Leaving during a match counts as being eliminated where you stood.
|
||||
|
||||
### Duos
|
||||
|
||||
In duos you play in a crew of two, on a server started with `--team-size=2` or in
|
||||
practice. Crewmates can't hurt each other, with any weapon or keg.
|
||||
|
||||
- When your health runs out while your crewmate is still standing, you go **down**
|
||||
instead of out. You crawl, slowly, and can't fire, build, loot or use anything. Your
|
||||
health becomes 60 to bleed, one point every half second, and hits still take it.
|
||||
- Your crewmate hauls you up by standing beside you (within 2 m) and holding **Pick
|
||||
up** (E) for 6 seconds without a break. You get up with 30 health.
|
||||
- You're out when you bleed out, when you're finished off, or when your crewmate goes
|
||||
down or out too: a crew with nobody standing is eliminated, and both share its place.
|
||||
- Drowning still takes a downed player, and faster than bleeding.
|
||||
|
||||
## Controls
|
||||
|
||||
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.
|
||||
|
||||
| Action | Default |
|
||||
|---|---|
|
||||
| Move | W A S D |
|
||||
| Jump; on the barge, leap; in the air, open the wing-sail | Space |
|
||||
| Jump; on the ship, fire the mortar; in the air, open the gull-kite | Space |
|
||||
| Crouch; in water, dive | Left Ctrl |
|
||||
| Sprint | Left Shift |
|
||||
| Use, fire, harvest or place | Left mouse |
|
||||
@@ -78,14 +101,69 @@ position, so they sit in the same place on any keyboard layout.
|
||||
| In build mode: next material | Tab |
|
||||
| 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
|
||||
|
||||
1. **The drop.** Everyone rides a sky barge across the island. Press jump to leap,
|
||||
steer with the move keys while you fall, and press jump again to open the wing-sail.
|
||||
It opens by itself near the ground. Anyone still aboard at the end of the route is
|
||||
thrown off.
|
||||
1. **The drop.** Everyone rides a packet ship that sails past the island, offshore.
|
||||
Face where you want to land and press jump to fire yourself inland by lifeline
|
||||
mortar: aim level for the shore, and look higher to carry further, up to the far
|
||||
side of the island. The climb can't be steered. Over the top of the arc, steer with
|
||||
the move keys and press jump again to open the gull-kite; it opens by itself near the
|
||||
ground. Anyone still aboard at the end of the route is fired towards the middle.
|
||||
2. **Scavenge.** Fishing hamlets, docks, salt works, quarries, lighthouses and hilltop
|
||||
shrines hold weapons, ammunition and supplies, on the floor and in sea chests (E opens one).
|
||||
Washed-up crates on the beaches spill loot when broken.
|
||||
@@ -134,7 +212,7 @@ Settings → Graphics → Quality.
|
||||
|
||||
| Preset | Sun shadows | Shadow cascades | 3D resolution | Anti-aliasing | Effect particles |
|
||||
|---|---|---|---|---|---|
|
||||
| Low | Off | n/a | 75% of the window | FXAA | 256 at once |
|
||||
| Low | Off (and off on every preset under OpenGL) | n/a | 75% of the window | FXAA | 256 at once |
|
||||
| Medium | Up to 200 m | 2 | 100% | FXAA | 512 |
|
||||
| High (default) | Up to 400 m | 4 | 100% | MSAA 2x | 1,024 |
|
||||
|
||||
@@ -154,8 +232,13 @@ Tidewall is made for Godot's **Forward+** renderer on **Vulkan**. If Vulkan can'
|
||||
(no Vulkan driver, or a GPU too old for it), the game falls back to **OpenGL**
|
||||
(Godot's Compatibility renderer) rather than crashing. The main menu then says so in
|
||||
red under the motto. Everything works there, but the light, fog and sea look a little
|
||||
different. Known difference: with shadows on (Medium, High) the ground and rocks come
|
||||
out paler under OpenGL than under Vulkan (issue #81).
|
||||
different. **Under OpenGL the sun casts no shadows, on every preset** (the presets'
|
||||
other settings still apply). Godot's Compatibility renderer draws a shadowed sun in
|
||||
a pass of its own and adds it to the picture after the picture is already converted
|
||||
for the screen (sRGB), so sunlit ground and rocks came out pale and washed out
|
||||
(issue #81). No setting in the engine avoids that, so the game turns those shadows
|
||||
off rather than show wrong colours. The `sun_probe` and `sun_shadow_probe` capture
|
||||
scenarios show the difference, to recheck after an engine upgrade.
|
||||
|
||||
To choose a renderer yourself:
|
||||
|
||||
@@ -187,7 +270,7 @@ is checked in the hands-on playtest (R6), and this table will be updated from it
|
||||
| Configuration | Renderer | How it was tested | Result |
|
||||
|---|---|---|---|
|
||||
| Debian 13, Xvfb (X11), Mesa Lavapipe | Forward+ / Vulkan | Software only: every capture, all three presets (`quality_*` captures) | Draws correctly |
|
||||
| Debian 13, Xvfb (X11), Mesa llvmpipe | Compatibility / OpenGL | Software only: all three presets | Draws correctly. Paler ground with shadows on (see above) |
|
||||
| Debian 13, Xvfb (X11), Mesa llvmpipe | Compatibility / OpenGL | Software only: all three presets | Draws correctly, with no sun shadows (see above) |
|
||||
| Debian 13, Xvfb (X11), no Vulkan driver | Falls back to OpenGL | Software only: `CAPTURE_RENDERER=no_vulkan` capture of the main menu | Falls back and shows the notice |
|
||||
| Release package outside the repo, headless | None (server and autoplay client) | `make dist-check` | Plays a full match; the game joins its server |
|
||||
| Wayland (native or XWayland) | Any | **Not tested** | Unknown |
|
||||
|
||||
@@ -49,6 +49,7 @@ server with exit code 2 instead of running the wrong match.
|
||||
| `port=N` | 24650 | UDP port for players. LAN discovery uses this port plus one. |
|
||||
| `bots=N` | 0 | Any number above 0 fills each match's empty places with bots. |
|
||||
| `bot-difficulty=` | `mixed` | `easy`, `normal`, `hard` or `mixed`. |
|
||||
| `team-size=N` | 1 | 1 for solo, 2 for duos: players pair up in the order they join (bots fill in after), can't hurt their teammate, and go down instead of out while their teammate stands. |
|
||||
| `name=NAME` | `Tidewall server` | The name shown in server lists. |
|
||||
| `list=HOST[:PORT]` | none | Register with a list server, so people off your LAN can find you. Can be given more than once. |
|
||||
| `no-lan` | off | Don't answer LAN discovery. |
|
||||
|
||||
+25
-3
@@ -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 |
|
||||
| `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
|
||||
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
|
||||
@@ -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 are knocked out so the dark backing shows, and the rest are split
|
||||
and charred. `make build-captures` renders the test card (`captures/build_states.png`).
|
||||
- **The barge and sea chests** (`VesselModels`): a lofted tarred hull with an ochre
|
||||
rubbing strake under a gored canvas envelope, striped tanned and banded ochre; sea
|
||||
chests painted sea-green with tarred bands, a salt-white border and a gilt hasp.
|
||||
- **The packet ship and sea chests** (`VesselModels`): a two-masted packet with a lofted
|
||||
tarred hull, an ochre rubbing strake, a salt-white boot-top at the waterline, tanned
|
||||
square sails with an ochre band, a bowsprit, and a squat tarred lifeline mortar with
|
||||
gilt bands on a timber bed; sea chests painted sea-green with tarred bands, a salt-white border and a gilt hasp.
|
||||
- **Terrain** (`terrain.gdshader`): sand with shingle, marsh, grass in tussocks and
|
||||
wind-dried patches, rock with lichen blotches, pale summits. Fine detail fades out
|
||||
past about 150 m so it doesn't shimmer.
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ found and fixed:
|
||||
|---|---|---|---|
|
||||
| Menus | `menu_main`, `menu_practice`, `menu_join`, `menu_settings`, `menu_settings_mouse`, `menu_pause`, `menu_results` | Paper panels over the sea and tide post; every label readable; the version line; focus outline on the first button; nothing clipped. | Pass |
|
||||
| Lobby | `match_lobby` | The whole island from the air, sea round it with no square edge. | Pass after H16 |
|
||||
| The drop | `match_barge`, `client_barge`, `match_glide`, `client_glide`, `vessels` | The sky barge and its 24 passengers; the wing-sail held overhead; the island below. | Pass |
|
||||
| The drop | `match_ship`, `client_ship`, `match_glide`, `client_glide`, `vessels` | The packet ship and its 24 passengers offshore; the gull-kite held overhead; the island below. | Pass |
|
||||
| Landing | `match_landed`, `client_landed`, `quality_low`, `quality_medium`, `quality_high` | The player on the shoulder camera, a sea chest, a building's inside. The three presets differ in shadow and detail, not in what's there. | Pass |
|
||||
| Biomes | `props_beach`, `props_forest`, `props_highland`, `props_overview`, `props_crate`, `props_felled`, `terrain`, `terrain_lod`, `sea_shore_calm` | Sand with wet patches and beached boats, pine forest, highland stone and boulders, the marsh flats at low tide. | Pass |
|
||||
| Points of interest | `poi_hamlet`, `poi_dock`, `poi_lighthouse`, `poi_quarry`, `poi_salt_works`, `poi_shrine`, `style_*` | Each reads as its place; the woodcut print pass (outlines, hatching) on, and off in the `_plain` captures. | Pass |
|
||||
@@ -39,7 +39,7 @@ found and fixed:
|
||||
| Players and items | `figure_states`, `figure_actions`, `figure_close`, `items_held`, `items_shoulder`, `items_ground`, `items_tiers`, `items_kegs` | Coats in every colour, every pose, items in hand and on the ground, tier marks. | Pass |
|
||||
| Combat | `effects_fight`, `effects_blast`, `effects_work`, `effects_stress` | Muzzle flash at the muzzle, the hit marker round the reticle, the keg blast and collapse dust, tracers in the stress scene. | Pass |
|
||||
| HUD | `client_hud`, `hud_2160` (`CAPTURE_SIZE=3840x2160`) | Tide plaque, health and armour, the six slots, materials, the feed and count, crisp at 4K. | Pass |
|
||||
| Chart | `chart_first`, `chart_later` | Place names, the barge's line, the next tide's land hatched, the minimap. | Pass |
|
||||
| Chart | `chart_first`, `chart_later` | Place names, the ship's line, the next tide's land hatched, the minimap. | Pass |
|
||||
| Each tide phase | `sea_tide_0` … `sea_tide_7`, `water_flood`, `water_shore` | The sea rising phase by phase to nothing left; the storm building to a gale with rain; flooding following the terrain. | Pass |
|
||||
| The gale and under water | `sea_shore_gale`, `sea_underwater`, `match_final` | Rain, dark sea and whitecaps; the murk and the bright ceiling only when the camera is under the sea. | Pass after H15 |
|
||||
| Results | `match_tide`, `match_results` | The drowned island from the lobby's viewpoint; the last players on the highest ground. | Pass after H15 |
|
||||
|
||||
@@ -26,6 +26,10 @@ UDP port (default 24650). LAN discovery answers on the port plus one.
|
||||
.BI \-\-bots= n
|
||||
Fill each match's empty places with bots.
|
||||
.TP
|
||||
.BI \-\-team\-size= n
|
||||
1 for solo (the default), 2 for duos: pairs who can't hurt each other and go
|
||||
down instead of out while their teammate stands.
|
||||
.TP
|
||||
.BI \-\-name= name
|
||||
The name shown in server lists.
|
||||
.TP
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH TIDEWALL 6 "2026-11-14" "Tidewall" "Games"
|
||||
.TH TIDEWALL 6 "2026-11-15" "Tidewall" "Games"
|
||||
.SH NAME
|
||||
tidewall \- build-and-survive battle royale on a drowning island
|
||||
.SH SYNOPSIS
|
||||
@@ -8,11 +8,16 @@ tidewall \- build-and-survive battle royale on a drowning island
|
||||
.RI [ "game options" ]
|
||||
.SH DESCRIPTION
|
||||
.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
|
||||
and swallows the low ground; gather salvage, build, and be the last one
|
||||
standing.
|
||||
.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
|
||||
.BR \-\- ;
|
||||
any other option goes to the Godot engine.
|
||||
@@ -30,10 +35,17 @@ The name to play under.
|
||||
.TP
|
||||
.B \-\-offline
|
||||
Start a practice match against bots at once.
|
||||
.TP
|
||||
.B \-\-duos
|
||||
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
|
||||
.TP
|
||||
.I ~/.local/share/godot/app_userdata/Tidewall/
|
||||
Settings and key bindings.
|
||||
Settings, key bindings and accessibility options.
|
||||
.SH SEE ALSO
|
||||
.BR tidewall\-server (6)
|
||||
.PP
|
||||
|
||||
+24
-5
@@ -1,5 +1,5 @@
|
||||
## 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
|
||||
## and goes back to the main menu; when a match the player was in ends, the results
|
||||
## screen shows where they placed.
|
||||
@@ -42,6 +42,7 @@ func _init(with: GameSettings = null, path: String = GameSettings.DEFAULT_PATH)
|
||||
menus.use_settings(settings, path)
|
||||
layer.add_child(menus)
|
||||
menus.practice_requested.connect(start_practice)
|
||||
menus.tutorial_requested.connect(start_tutorial)
|
||||
menus.join_requested.connect(join)
|
||||
menus.resume_requested.connect(resume)
|
||||
menus.leave_requested.connect(leave)
|
||||
@@ -59,17 +60,26 @@ func _init(with: GameSettings = null, path: String = GameSettings.DEFAULT_PATH)
|
||||
func _ready() -> void:
|
||||
settings.apply_to_program(get_tree())
|
||||
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.
|
||||
func start_practice(bots: int, difficulty: int) -> void:
|
||||
## Starts an offline match against bots, solo or in duos (`team_size` 2, M7).
|
||||
func start_practice(bots: int, difficulty: int, team_size: int = 1) -> void:
|
||||
var match_seed: int = int(Time.get_unix_time_from_system() * 1000.0) & 0x7FFFFFFF
|
||||
var practice: ClientSession = ClientSession.new()
|
||||
practice.play_offline(match_seed, bots, null, difficulty)
|
||||
practice.play_offline(match_seed, bots, LocalServer.offline_rules(bots, team_size), difficulty)
|
||||
_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.
|
||||
func join(host: String, port: int, player_name: String) -> Error:
|
||||
var joining: ClientSession = ClientSession.new()
|
||||
@@ -137,6 +147,15 @@ func _begin(started: ClientSession) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if session != null:
|
||||
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
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
##
|
||||
## tidewall the main menu (with a window)
|
||||
## 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
|
||||
## options: --name=NAME --seed=N --bots=N (offline) --autoplay
|
||||
## options: --name=NAME --seed=N --bots=N (offline) --duos (offline) --autoplay
|
||||
## --client-seconds=N quit after N seconds, saying what happened
|
||||
## tidewall --browse [--list=HOST[:PORT]]... [--lan-target=ADDRESS]... [--lan-port=N]
|
||||
## print the servers found on the LAN and in list
|
||||
@@ -25,6 +27,10 @@ var player_name: String = DEFAULT_NAME
|
||||
var match_seed: int = 0
|
||||
var has_seed: bool = false
|
||||
var bots: int = DEFAULT_BOTS
|
||||
## Offline in duos (M7) with --duos: the player and the first bot are a team.
|
||||
var team_size: int = 1
|
||||
## The tutorial (A12) with --tutorial.
|
||||
var tutorial: bool = false
|
||||
var autoplay: bool = false
|
||||
## Quit after this many seconds; 0 runs until the window is closed.
|
||||
var seconds: float = 0.0
|
||||
@@ -43,7 +49,7 @@ var errors: Array[String] = []
|
||||
|
||||
## Every option parse() knows, by name.
|
||||
const OPTIONS: Array[String] = [
|
||||
"--offline", "--autoplay", "--browse", "--list", "--lan-port", "--lan-target",
|
||||
"--offline", "--tutorial", "--autoplay", "--duos", "--browse", "--list", "--lan-port", "--lan-target",
|
||||
"--connect", "--name", "--seed", "--bots", "--client-seconds",
|
||||
]
|
||||
|
||||
@@ -71,8 +77,13 @@ static func parse(args: PackedStringArray) -> ClientConfig:
|
||||
match parts[0]:
|
||||
"--offline":
|
||||
config.asked = true
|
||||
"--tutorial":
|
||||
config.asked = true
|
||||
config.tutorial = true
|
||||
"--autoplay":
|
||||
config.autoplay = true
|
||||
"--duos":
|
||||
config.team_size = Tuning.DUO_TEAM_SIZE
|
||||
"--browse":
|
||||
config.asked = true
|
||||
config.browse = true
|
||||
@@ -120,6 +131,10 @@ static func parse(args: PackedStringArray) -> ClientConfig:
|
||||
_:
|
||||
if arg.begins_with("--"):
|
||||
config.errors.append("unknown option '%s'" % arg)
|
||||
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")
|
||||
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():
|
||||
config.errors.append("--browse and --connect can't be used together")
|
||||
return config
|
||||
|
||||
@@ -46,6 +46,15 @@ var _status: Label = null
|
||||
var _fx_seen: int = 0
|
||||
## The hit marker and hurt flash (A7).
|
||||
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:
|
||||
@@ -66,12 +75,25 @@ func play_offline(match_seed: int, bots: int, rules: MatchRules = null, difficul
|
||||
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
|
||||
## match's view.
|
||||
func use_settings(with: GameSettings) -> void:
|
||||
settings = with
|
||||
input.settings = with.mouse
|
||||
input.bindings = with.bindings
|
||||
if tutorial != null:
|
||||
tutorial.bindings = with.bindings
|
||||
if view != null:
|
||||
view.apply_settings(with)
|
||||
|
||||
@@ -105,11 +127,14 @@ func status_text() -> String:
|
||||
func pump(delta: float) -> void:
|
||||
frames += 1
|
||||
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.buttons = 0
|
||||
input.pad.release()
|
||||
else:
|
||||
input.poll()
|
||||
_aim_targets()
|
||||
input.poll(delta)
|
||||
if link != null:
|
||||
game.poll()
|
||||
if local != null:
|
||||
@@ -119,6 +144,8 @@ func pump(delta: float) -> void:
|
||||
phases.append(game.match_phase)
|
||||
if game.playing():
|
||||
frames_playing += 1
|
||||
if tutorial != null:
|
||||
tutorial.update(game, input, delta)
|
||||
mirror.sync(game)
|
||||
_show(delta)
|
||||
|
||||
@@ -146,6 +173,10 @@ func _ready() -> void:
|
||||
chart.position = Vector2(-300.0, -300.0)
|
||||
chart.visible = false
|
||||
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:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
@@ -157,22 +188,37 @@ func _process(delta: float) -> void:
|
||||
sound.rain = view.weather.weather.rain()
|
||||
sound.gale = view.weather.weather.wind()
|
||||
sound.update(game, mirror.own_id, view.camera.global_position if view != null else Vector3.ZERO, delta)
|
||||
_hear_captions(delta)
|
||||
if _status != null:
|
||||
_status.text = status_text()
|
||||
if hud != null:
|
||||
var state: HudState = hud_state()
|
||||
feedback.update(state.health if state.playing else -1, delta)
|
||||
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)
|
||||
if tutorial_card != null:
|
||||
tutorial_card.show_tutorial(tutorial, game.playing())
|
||||
_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.
|
||||
func hud_state() -> HudState:
|
||||
var state: HudState = HudState.from_client(game, input, own_handle())
|
||||
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
|
||||
|
||||
|
||||
@@ -180,7 +226,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
var captured: bool = Input.mouse_mode == Input.MOUSE_MODE_CAPTURED
|
||||
var key: InputEventKey = event as InputEventKey
|
||||
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
|
||||
# mouse back when there is no menu.
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
@@ -196,7 +244,31 @@ func _exit_tree() -> void:
|
||||
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:
|
||||
if pilot != null:
|
||||
return pilot.command(tick, game)
|
||||
if input.autoplay and game.world != null:
|
||||
return input.autoplay_command(tick, game.prediction.player, game.world.ground)
|
||||
return input.command(tick)
|
||||
@@ -224,7 +296,7 @@ func _show(delta: float) -> void:
|
||||
if view == null:
|
||||
return
|
||||
view.entities.local_id = mirror.own_id if mirror.own_id != 0 else view.entities.local_id
|
||||
view.entities.barge_at = mirror.barge_at
|
||||
view.entities.ship_at = mirror.ship_at
|
||||
view.rig.update_aim(input.aiming() and mirror.own_id != 0, delta)
|
||||
view.sync()
|
||||
var fresh: int = mini(game.fx_received - _fx_seen, game.fx.size())
|
||||
|
||||
+10
-5
@@ -1,7 +1,7 @@
|
||||
## Application entry point. Picks the mode from the command line:
|
||||
##
|
||||
## 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 --browse list the servers it can find
|
||||
## tools/godot.sh -- --list-server a list server (see ListServerRunner)
|
||||
@@ -53,9 +53,11 @@ func _ready() -> void:
|
||||
return
|
||||
_session = ClientSession.new()
|
||||
_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
|
||||
_session.play_offline(match_seed, _config.bots)
|
||||
_session.play_offline(match_seed, _config.bots, LocalServer.offline_rules(_config.bots, _config.team_size))
|
||||
else:
|
||||
var error: Error = _session.connect_to(_config.host, _config.port, _config.player_name)
|
||||
if error != OK:
|
||||
@@ -122,12 +124,15 @@ func _process(delta: float) -> void:
|
||||
for phase: int in _session.phases:
|
||||
phases.append(Match.PHASE_NAMES[phase])
|
||||
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,
|
||||
"frames": _session.frames, "frames_playing": _session.frames_playing,
|
||||
"world_messages": _session.game.replica.applied, "bad_packets": _session.game.bad_packets,
|
||||
"corrections": _session.game.prediction.mispredictions,
|
||||
}))
|
||||
}
|
||||
if _session.tutorial != null:
|
||||
report["tutorial"] = _session.tutorial.step_name()
|
||||
print(JSON.stringify(report))
|
||||
_session.leave()
|
||||
_session = null
|
||||
get_tree().quit(0 if joined else 1)
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://ohf3eudp270x
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbs8nxm0k8fed
|
||||
+584
-13
@@ -13,6 +13,14 @@
|
||||
## boathook if not; use a bandage or armor when nobody is in view; pick up
|
||||
## useful items and open chests; walk to the next loot marker; otherwise wander the safe
|
||||
## ground, which is where everyone ends up.
|
||||
##
|
||||
## Bots build too (M6). An armed bot with nothing more pressing, and nobody about,
|
||||
## gathers materials with the boathook. In a fight it puts a wall between itself and a
|
||||
## shooter who catches it reloading, from ambush or worn down; walls itself off to heal
|
||||
## instead of running when badly hurt; and builds ramps up to an opponent on a cliff or
|
||||
## a steep rise. Late in the match, when the tide would catch it or at the last stand,
|
||||
## it rings its cell with breakwaters. Every piece goes through the same build command
|
||||
## a player sends, after the same Building.check the server makes.
|
||||
class_name BotBrain
|
||||
extends RefCounted
|
||||
|
||||
@@ -30,7 +38,8 @@ var player_id: int = 0
|
||||
var difficulty: int = NORMAL
|
||||
var nav: NavBot
|
||||
## What the bot is doing, for logs and tests: "drop", "flee", "fight", "chase", "heal",
|
||||
## "loot", "hunt" or "idle".
|
||||
## "loot", "hunt", "hold", "idle", "retreat", "brawl", "gather", "cover", "ramp" or
|
||||
## "breakwater".
|
||||
var state: String = "idle"
|
||||
## The opponent the bot is fighting or looking for, or 0.
|
||||
var target_id: int = 0
|
||||
@@ -92,6 +101,56 @@ var _leave_tries: int = 0
|
||||
var _direct_best: float = INF
|
||||
var _direct_stalled: int = 0
|
||||
|
||||
## M6: whether this bot gathers and builds. A batch turns it off for a control group.
|
||||
var builds: bool = true
|
||||
## M6: what this bot built and how its fights went, for batch measurement. A fight is
|
||||
## a stretch with an opponent in which shots or swings were traded; it ends after
|
||||
## Tuning.BOT_FIGHT_GAP_SECONDS with nobody to fight, or with the bot's fall ("lost").
|
||||
var stats: Dictionary = {
|
||||
"pieces": 0, "walls": 0, "ramps": 0, "breakwaters": 0, "harvested": 0,
|
||||
"fights": 0, "fights_built": 0, "fights_lost": 0, "fights_built_lost": 0,
|
||||
"fights_stocked": 0, "fights_stocked_built": 0,
|
||||
}
|
||||
var _in_fight: bool = false
|
||||
var _fight_traded: bool = false
|
||||
var _fight_built: bool = false
|
||||
var _fight_stocked: bool = false
|
||||
var _fight_seen: int = 0
|
||||
var _stock_seen: int = 0
|
||||
## Gathering: the prop, when to give up on it, when each search radius was last tried
|
||||
## (near, far), props given up on, and this tick's swing.
|
||||
var _gather_prop: int = -1
|
||||
var _gather_deadline: int = 0
|
||||
var _gather_checked: PackedInt32Array = PackedInt32Array([-100000, -100000])
|
||||
var _gather_skipped: Dictionary = {}
|
||||
var _swing: bool = false
|
||||
var _swing_aim: Vector2 = Vector2.ZERO
|
||||
## Cover: until when the bot stays behind it, which way the wall goes, whether it's up,
|
||||
## when the cover began and when cover may be taken again.
|
||||
var _covering_until: int = -100000
|
||||
var _cover_yaw: float = 0.0
|
||||
var _cover_walls: int = 0
|
||||
var _cover_since: int = 0
|
||||
var _cover_ready: int = 0
|
||||
## Ramps placed this fight, until when the bot walks on up them, which way, and the
|
||||
## slot of the last one, so the next continues from its top.
|
||||
var _ramps: int = 0
|
||||
var _ramp_until: int = -100000
|
||||
var _ramp_direction: Vector2 = Vector2.ZERO
|
||||
var _ramp_last: Vector4i = Vector4i.ZERO
|
||||
## A ring of breakwaters: the cell it's round, its four slots, when it was begun (or
|
||||
## -1), and the highest forecast level it's worth staying in for.
|
||||
var _ring_cell: Vector2i = Vector2i.ZERO
|
||||
var _ring_slots: Array[Vector4i] = []
|
||||
var _ring_started: int = -1
|
||||
var _ring_level: float = 0.0
|
||||
## This tick's piece, if any: kind (-1 for none), facing yaw and material.
|
||||
var _piece_kind: int = -1
|
||||
var _piece_yaw: float = 0.0
|
||||
var _piece_material: int = 0
|
||||
## A stand-in for the bot, posed for Building.target() and Building.check().
|
||||
var _probe: SimEntity = SimEntity.new(0, SimEntity.ARCHETYPE_PLAYER)
|
||||
|
||||
|
||||
func _init(id: int, level: int = NORMAL) -> void:
|
||||
player_id = id
|
||||
@@ -114,9 +173,14 @@ func difficulty_name() -> String:
|
||||
func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
var me: SimEntity = sim.entities.find(player_id)
|
||||
if me == null or me.eliminated:
|
||||
if _in_fight:
|
||||
_end_fight(true)
|
||||
return PlayerCommand.from_input(sim.tick, Vector2.ZERO, 0.0, 0.0)
|
||||
if me.drop_state != Drop.NONE:
|
||||
return _drop(sim, grid, world)
|
||||
if me.downed:
|
||||
return _crawl(sim, world, me)
|
||||
_count_building(world, me)
|
||||
_sense(sim, world, me)
|
||||
_check_tide(sim, world, me)
|
||||
_update_aim_error(sim)
|
||||
@@ -128,17 +192,27 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
var buttons: int = 0
|
||||
_check_retreat(sim, world, me, target, armed)
|
||||
var retreating: bool = sim.tick < _retreat_until
|
||||
var fighting: bool = target != null and target_visible and armed and not me.swimming and not retreating
|
||||
if _fleeing or me.swimming:
|
||||
_covering_until = mini(_covering_until, sim.tick)
|
||||
var covering: bool = sim.tick < _covering_until
|
||||
if covering and target != null and target_visible and distance <= Tuning.BOT_BRAWL_METRES:
|
||||
# They came round the wall: fight.
|
||||
_covering_until = sim.tick
|
||||
covering = false
|
||||
var fighting: bool = target != null and target_visible and armed and not me.swimming and not retreating and not covering
|
||||
# Inside a hut or loft too: someone beating on you there gets a swing back. An
|
||||
# unarmed bot doesn't start a brawl; it keeps looking for a weapon (H3).
|
||||
var provoked: bool = target != null and target.id == _hit_by and sim.tick - _hit_tick <= roundi(Tuning.BOT_MEMORY_SECONDS * TICKS)
|
||||
var brawling: bool = (target != null and target_visible and not armed and not me.swimming
|
||||
and not _fleeing and not retreating and distance <= Tuning.BOT_BRAWL_METRES and provoked)
|
||||
and not _fleeing and not retreating and not covering and distance <= Tuning.BOT_BRAWL_METRES and provoked)
|
||||
var interact: bool = false
|
||||
var walk: bool = true
|
||||
var patient: SimEntity = _patient(sim, world, me) if not me.swimming else null
|
||||
var tending: bool = false
|
||||
|
||||
# Where to go.
|
||||
_direct_on = false
|
||||
_swing = false
|
||||
var urgent: bool = _fleeing or retreating or (target != null and armed)
|
||||
if _stage != OUTSIDE:
|
||||
# Inside a hut or up a loft: loot, or walk back out first if something's up.
|
||||
@@ -146,9 +220,15 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
_set_stage(sim, LEAVING, maxi(_route_index - 1, 0) if _stage == ENTERING else _route.size() - 2)
|
||||
state = "flee" if _fleeing else "loot"
|
||||
interact = _walk_route(sim, me)
|
||||
elif _in_ring(sim, me):
|
||||
state = "breakwater"
|
||||
_stop()
|
||||
elif _fleeing:
|
||||
state = "flee"
|
||||
_go(_flee_goal, 3.0)
|
||||
elif covering:
|
||||
state = "cover"
|
||||
_stop()
|
||||
elif retreating:
|
||||
state = "retreat"
|
||||
_go(_retreat_goal, 3.0)
|
||||
@@ -158,6 +238,14 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
elif brawling:
|
||||
state = "brawl"
|
||||
_stop()
|
||||
elif patient != null:
|
||||
# A teammate is down (M7): get to them and hold interact until they're up.
|
||||
state = "revive"
|
||||
if me.position.distance_to(patient.position) <= Tuning.REVIVE_RANGE * 0.75:
|
||||
_stop()
|
||||
tending = true
|
||||
else:
|
||||
_go(patient.position, Tuning.REVIVE_RANGE * 0.5)
|
||||
elif target != null and armed:
|
||||
state = "chase"
|
||||
_go(_last_seen, 3.0)
|
||||
@@ -170,10 +258,11 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
selection = heal_slot + 1
|
||||
buttons |= PlayerCommand.BUTTON_FIRE
|
||||
walk = _goal_set
|
||||
else:
|
||||
elif not (builds and armed and _gather(sim, world, me, false)):
|
||||
interact = _loot(sim, grid, world, me)
|
||||
if state != "loot":
|
||||
if state != "loot" and not (builds and armed and _gather(sim, world, me, true)):
|
||||
_hunt(sim, world)
|
||||
_plan_build(sim, grid, world, me, target, distance, fighting)
|
||||
|
||||
# Walking, from the path follower.
|
||||
var direction: Vector2 = Vector2.ZERO
|
||||
@@ -200,6 +289,12 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
buttons |= step.buttons & (PlayerCommand.BUTTON_SPRINT | PlayerCommand.BUTTON_JUMP)
|
||||
if state == "heal":
|
||||
buttons &= ~PlayerCommand.BUTTON_SPRINT
|
||||
if _swing:
|
||||
yaw = _swing_aim.x
|
||||
pitch = _swing_aim.y
|
||||
direction = Vector2.ZERO
|
||||
selection = Simulation.BOATHOOK_SLOT
|
||||
buttons |= PlayerCommand.BUTTON_FIRE
|
||||
|
||||
# Fighting: face the target and fire, whatever the feet are doing.
|
||||
if fighting or (target != null and target_visible and armed and not me.swimming and _fleeing):
|
||||
@@ -207,7 +302,7 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
var aim: Vector2 = _aim_at(me, target, def)
|
||||
yaw = aim.x
|
||||
pitch = aim.y
|
||||
if not _fleeing and _stage == OUTSIDE:
|
||||
if not _fleeing and _stage == OUTSIDE and state != "breakwater":
|
||||
direction = _combat_move(sim, grid, me, target, def)
|
||||
buttons &= ~PlayerCommand.BUTTON_SPRINT
|
||||
var in_range: bool = distance <= _fire_range(def)
|
||||
@@ -228,21 +323,127 @@ func think(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
var reach: float = Harvest.eye(me).distance_to(target.position + Vector3(0.0, Movement.body_height(target) * 0.62, 0.0))
|
||||
if reach <= Tuning.BOT_SWING_METRES and sim.tick - _acquired_tick >= _reaction_ticks:
|
||||
buttons |= PlayerCommand.BUTTON_FIRE
|
||||
elif covering:
|
||||
# Behind the wall: heal, or finish reloading.
|
||||
var heal_slot: int = _heal_slot(me)
|
||||
if heal_slot >= 0:
|
||||
selection = heal_slot + 1
|
||||
buttons |= PlayerCommand.BUTTON_FIRE
|
||||
elif me.reload_ticks > 0:
|
||||
# Stay behind it until the magazine's full.
|
||||
_covering_until = maxi(_covering_until, sim.tick + 2)
|
||||
elif armed:
|
||||
var def: ItemDef = ItemCatalog.get_def(me.slot_items[_weapon_slot])
|
||||
if me.slot_rounds[_weapon_slot] < def.magazine and me.ammo[Inventory.ammo_index(def.ammo_code)] > 0:
|
||||
buttons |= PlayerCommand.BUTTON_RELOAD
|
||||
elif sim.tick - _cover_since > roundi(Tuning.BOT_COVER_HOLD_SECONDS * TICKS):
|
||||
_covering_until = sim.tick
|
||||
elif sim.tick - _cover_since > roundi(Tuning.BOT_COVER_HOLD_SECONDS * TICKS):
|
||||
_covering_until = sim.tick
|
||||
elif armed and state != "heal" and me.reload_ticks == 0:
|
||||
# Nobody in view: top up the magazine.
|
||||
var def: ItemDef = ItemCatalog.get_def(me.slot_items[_weapon_slot])
|
||||
if me.slot_rounds[_weapon_slot] < def.magazine and me.ammo[Inventory.ammo_index(def.ammo_code)] > 0:
|
||||
buttons |= PlayerCommand.BUTTON_RELOAD
|
||||
|
||||
# Up a ramp toward someone above: keep walking, still shooting, until off the top of
|
||||
# the last one.
|
||||
var g: float = StructureSet.cell_size()
|
||||
var on_last: bool = (_ramps > 0 and Vector2i(floori(me.position.x / g), floori(me.position.z / g)) == Vector2i(_ramp_last.x, _ramp_last.z)
|
||||
and me.position.y > _ramp_last.y * Tuning.BUILD_LEVEL_METRES - 0.5)
|
||||
if on_last:
|
||||
_ramp_until = maxi(_ramp_until, sim.tick + TICKS / 2)
|
||||
if sim.tick < _ramp_until and target != null and not _fleeing and not covering and _stage == OUTSIDE:
|
||||
state = "ramp"
|
||||
direction = _ramp_direction
|
||||
|
||||
if interact and not _interact_last:
|
||||
buttons |= PlayerCommand.BUTTON_INTERACT
|
||||
_interact_last = true
|
||||
else:
|
||||
_interact_last = false
|
||||
var chosen_material: int = 0
|
||||
if _piece_kind >= 0:
|
||||
# This tick places a piece: build mode, facing where it goes, level.
|
||||
yaw = _piece_yaw
|
||||
pitch = 0.0
|
||||
var cleared: int = PlayerCommand.BUTTON_AIM | PlayerCommand.BUTTON_RELOAD | PlayerCommand.BUTTON_INTERACT | PlayerCommand.BUTTON_SPRINT
|
||||
buttons = (buttons & ~cleared) | PlayerCommand.BUTTON_BUILD | PlayerCommand.BUTTON_FIRE
|
||||
selection = _piece_kind
|
||||
chosen_material = _piece_material
|
||||
if _piece_kind != StructureSet.RAMP:
|
||||
direction = Vector2.ZERO
|
||||
if tending:
|
||||
var to_patient: Vector2 = Vector2(patient.position.x - me.position.x, patient.position.z - me.position.z)
|
||||
if to_patient.length() > 0.05:
|
||||
yaw = atan2(to_patient.x, to_patient.y)
|
||||
pitch = 0.0
|
||||
direction = Vector2.ZERO
|
||||
buttons = PlayerCommand.BUTTON_INTERACT
|
||||
chosen_material = 0
|
||||
_track_fight(sim, world, me, buttons)
|
||||
var forward: Vector2 = Vector2(sin(yaw), cos(yaw))
|
||||
var right: Vector2 = Vector2(-cos(yaw), sin(yaw))
|
||||
var move: Vector2 = Vector2(direction.dot(right), direction.dot(forward))
|
||||
return PlayerCommand.from_input(sim.tick, move, yaw, pitch, buttons, selection)
|
||||
return PlayerCommand.from_input(sim.tick, move, yaw, pitch, buttons, selection, chosen_material)
|
||||
|
||||
|
||||
# Duos (M7)
|
||||
|
||||
## The nearest standing teammate, or null.
|
||||
func _standing_teammate(sim: Simulation, world: BotWorld, me: SimEntity) -> SimEntity:
|
||||
if me == null or me.team < 0:
|
||||
return null
|
||||
var best: SimEntity = null
|
||||
var best_gap: float = INF
|
||||
for other_id: int in world.player_ids:
|
||||
var other: SimEntity = sim.entities.find(other_id)
|
||||
if not Simulation.is_standing(other) or not sim.are_teammates(me, other) or other.drop_state != Drop.NONE:
|
||||
continue
|
||||
var gap: float = me.position.distance_squared_to(other.position)
|
||||
if gap < best_gap:
|
||||
best = other
|
||||
best_gap = gap
|
||||
return best
|
||||
|
||||
|
||||
## The nearest downed teammate within Tuning.BOT_REVIVE_METRES, or null.
|
||||
func _patient(sim: Simulation, world: BotWorld, me: SimEntity) -> SimEntity:
|
||||
var best: SimEntity = null
|
||||
var best_gap: float = Tuning.BOT_REVIVE_METRES * Tuning.BOT_REVIVE_METRES
|
||||
for other_id: int in world.player_ids:
|
||||
var other: SimEntity = sim.entities.find(other_id)
|
||||
if other == null or not other.downed or other.eliminated or not sim.are_teammates(me, other):
|
||||
continue
|
||||
var gap: float = me.position.distance_squared_to(other.position)
|
||||
if gap <= best_gap:
|
||||
best = other
|
||||
best_gap = gap
|
||||
return best
|
||||
|
||||
|
||||
## Downed: crawl straight for the nearest standing teammate, and stop beside them.
|
||||
func _crawl(sim: Simulation, world: BotWorld, me: SimEntity) -> PlayerCommand:
|
||||
state = "downed"
|
||||
_stop()
|
||||
_forget_target()
|
||||
var yaw: float = float(me.yaw) / PlayerCommand.YAW_STEPS * TAU
|
||||
var move: Vector2 = Vector2.ZERO
|
||||
var nearest: SimEntity = null
|
||||
var nearest_gap: float = INF
|
||||
for other_id: int in world.player_ids:
|
||||
var other: SimEntity = sim.entities.find(other_id)
|
||||
if not Simulation.is_standing(other) or not sim.are_teammates(me, other):
|
||||
continue
|
||||
var gap: float = me.position.distance_squared_to(other.position)
|
||||
if gap < nearest_gap:
|
||||
nearest = other
|
||||
nearest_gap = gap
|
||||
if nearest != null and nearest_gap > Tuning.REVIVE_RANGE * Tuning.REVIVE_RANGE * 0.25:
|
||||
var to: Vector2 = Vector2(nearest.position.x - me.position.x, nearest.position.z - me.position.z)
|
||||
yaw = atan2(to.x, to.y)
|
||||
move = Vector2(0.0, 1.0)
|
||||
return PlayerCommand.from_input(sim.tick, move, yaw, 0.0)
|
||||
|
||||
|
||||
# Movement goals
|
||||
@@ -262,9 +463,17 @@ func _stop() -> void:
|
||||
|
||||
# The drop
|
||||
|
||||
## Rides the barge to within reach of a loot marker near its route, then glides to it.
|
||||
## Rides the ship until it is abeam of a loot marker within the mortar's reach, fires
|
||||
## itself at it and glides there.
|
||||
func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
state = "drop"
|
||||
var rider: SimEntity = sim.entities.find(player_id)
|
||||
if _landing < 0 and rider != null and rider.team >= 0 and world.team_landings.has(rider.team):
|
||||
# Duos (M7): land with the teammate who already chose.
|
||||
_landing = int(world.team_landings[rider.team])
|
||||
_marker = _landing
|
||||
_marker_since = sim.tick
|
||||
_go(world.markers[_landing], 2.0)
|
||||
if _landing < 0 and not world.markers.is_empty() and sim.drop != null:
|
||||
var rng: RandomNumberGenerator = nav.stream(sim)
|
||||
var a: Vector2 = Vector2(sim.drop.start.x, sim.drop.start.z)
|
||||
@@ -273,7 +482,7 @@ func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
for index: int in world.markers.size():
|
||||
var at: Vector2 = Vector2(world.markers[index].x, world.markers[index].z)
|
||||
var closest: Vector2 = Geometry2D.get_closest_point_to_segment(at, a, b)
|
||||
if at.distance_to(closest) <= 120.0 and world.markers[index].y > sim.sea_level + 1.0:
|
||||
if at.distance_to(closest) <= Tuning.BOT_LANDING_REACH_METRES and world.markers[index].y > sim.sea_level + 1.0:
|
||||
near.append(index)
|
||||
if near.is_empty():
|
||||
_landing = rng.randi_range(0, world.markers.size() - 1)
|
||||
@@ -290,6 +499,8 @@ func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
|
||||
best_crowd = crowd
|
||||
_landing = pick
|
||||
world.landings.append(world.markers[_landing])
|
||||
if rider != null and rider.team >= 0:
|
||||
world.team_landings[rider.team] = _landing
|
||||
_marker = _landing
|
||||
_marker_since = sim.tick
|
||||
_go(world.markers[_landing], 2.0)
|
||||
@@ -332,6 +543,18 @@ func _sense(sim: Simulation, world: BotWorld, me: SimEntity) -> void:
|
||||
elif tick - _last_seen_tick > roundi(Tuning.BOT_MEMORY_SECONDS * TICKS):
|
||||
_forget_target()
|
||||
target = null
|
||||
if target != null and target.downed and target_visible:
|
||||
# Duos (M7): a downed target can't shoot back, but its teammate can. Turn on the
|
||||
# teammate if they're in view; otherwise finish the job.
|
||||
for other_id: int in world.player_ids:
|
||||
var other: SimEntity = sim.entities.find(other_id)
|
||||
if Simulation.is_standing(other) and other.drop_state == Drop.NONE and sim.are_teammates(target, other) \
|
||||
and me.position.distance_to(other.position) <= minf(_sight, Tuning.BOT_ENGAGE_METRES) and _can_see(sim, world, me, other, false):
|
||||
target_id = other.id
|
||||
_acquired_tick = tick
|
||||
_last_seen = other.position
|
||||
_last_seen_tick = tick
|
||||
return
|
||||
if target != null and target_visible:
|
||||
return
|
||||
# Look for someone new, nearest first, with a few sight lines at most.
|
||||
@@ -340,7 +563,7 @@ func _sense(sim: Simulation, world: BotWorld, me: SimEntity) -> void:
|
||||
if other_id == player_id or other_id == target_id:
|
||||
continue
|
||||
var other: SimEntity = sim.entities.find(other_id)
|
||||
if other == null or other.eliminated or other.drop_state != Drop.NONE:
|
||||
if other == null or other.eliminated or other.drop_state != Drop.NONE or sim.are_teammates(me, other):
|
||||
continue
|
||||
# A bot picks out a new opponent only this close; one who shoots it first is
|
||||
# fought at any range it can see (H3).
|
||||
@@ -382,7 +605,7 @@ func _can_see(sim: Simulation, world: BotWorld, me: SimEntity, other: SimEntity,
|
||||
## BOT_RETREAT_SECONDS, then heals if it can. Any bot without a gun runs from one held
|
||||
## in view; a bot badly hurt with a way to heal breaks off too, except easy ones.
|
||||
func _check_retreat(sim: Simulation, world: BotWorld, me: SimEntity, target: SimEntity, armed: bool) -> void:
|
||||
if target == null or _fleeing or sim.tick < _retreat_until or me.swimming:
|
||||
if target == null or _fleeing or sim.tick < _retreat_until or sim.tick < _covering_until or me.swimming:
|
||||
return
|
||||
var outgunned: bool = not armed and target_visible and _holds_gun(target)
|
||||
var hurt: bool = _retreat_health > 0 and me.health + me.armor <= _retreat_health and _heal_slot(me) >= 0
|
||||
@@ -390,6 +613,10 @@ func _check_retreat(sim: Simulation, world: BotWorld, me: SimEntity, target: Sim
|
||||
return
|
||||
if sim.tick - _retreat_until < roundi(Tuning.BOT_RETREAT_SECONDS * TICKS):
|
||||
return
|
||||
if hurt and not outgunned and builds and sim.tick >= _cover_ready and _build_material(me, StructureSet.WALL) >= 0:
|
||||
# M6: wall off and heal where it stands instead of running across open ground.
|
||||
_take_cover(sim, me, target, Tuning.BOT_COVER_HEAL_SECONDS)
|
||||
return
|
||||
var away: Vector3 = me.position - target.position
|
||||
away.y = 0.0
|
||||
away = away.normalized() if away.length() > 0.1 else Vector3(1.0, 0.0, 0.0)
|
||||
@@ -847,10 +1074,18 @@ func _hunt(sim: Simulation, world: BotWorld) -> void:
|
||||
if arrived and not _holding:
|
||||
_holding = true
|
||||
_hunt_until = sim.tick + roundi(Tuning.BOT_HOLD_SECONDS * TICKS)
|
||||
var me: SimEntity = sim.entities.find(player_id)
|
||||
var mate: SimEntity = _standing_teammate(sim, world, me)
|
||||
var strayed: bool = mate != null and me.position.distance_to(mate.position) > Tuning.BOT_REGROUP_METRES
|
||||
if strayed and (_holding or _hunt_goal.distance_to(mate.position) > Tuning.BOT_REGROUP_METRES * 0.5):
|
||||
# Duos (M7): too far from the teammate to help them up; go back to them.
|
||||
_holding = false
|
||||
_hunt_until = sim.tick
|
||||
if (not _goal_set and not _holding) or sim.tick >= _hunt_until:
|
||||
var phase: int = sim.tide.phase_at(sim.tick) if sim.tide != null else 0
|
||||
var me: SimEntity = sim.entities.find(player_id)
|
||||
_hunt_goal = world.random_safe_near(nav.stream(sim), phase, me.position, Tuning.BOT_ROAM_METRES)
|
||||
var around: Vector3 = mate.position if strayed else me.position
|
||||
var radius: float = Tuning.BOT_REGROUP_METRES * 0.3 if strayed else Tuning.BOT_ROAM_METRES
|
||||
_hunt_goal = world.random_safe_near(nav.stream(sim), phase, around, radius)
|
||||
_hunt_until = sim.tick + 40 * TICKS
|
||||
_holding = false
|
||||
_go(_hunt_goal, 4.0)
|
||||
@@ -859,3 +1094,339 @@ func _hunt(sim: Simulation, world: BotWorld) -> void:
|
||||
_stop()
|
||||
else:
|
||||
_go(_hunt_goal, 4.0)
|
||||
|
||||
|
||||
# Building (M6)
|
||||
|
||||
## Counts what the bot placed and gathered since it last thought.
|
||||
func _count_building(world: BotWorld, me: SimEntity) -> void:
|
||||
for kind: int in world.placed.get(player_id, []):
|
||||
stats["pieces"] += 1
|
||||
match kind:
|
||||
StructureSet.WALL:
|
||||
stats["walls"] += 1
|
||||
StructureSet.RAMP:
|
||||
stats["ramps"] += 1
|
||||
StructureSet.BREAKWATER:
|
||||
stats["breakwaters"] += 1
|
||||
if _in_fight:
|
||||
_fight_built = true
|
||||
var stock: int = 0
|
||||
for amount: int in me.materials:
|
||||
stock += amount
|
||||
if stock > _stock_seen:
|
||||
stats["harvested"] += stock - _stock_seen
|
||||
_stock_seen = stock
|
||||
|
||||
|
||||
## Starts or ends the fight the bot is in, for the measurement.
|
||||
func _track_fight(sim: Simulation, world: BotWorld, me: SimEntity, buttons: int) -> void:
|
||||
var engaged: bool = target_id != 0 or state == "cover" or state == "retreat"
|
||||
if engaged:
|
||||
if not _in_fight:
|
||||
_in_fight = true
|
||||
_fight_traded = false
|
||||
_fight_built = false
|
||||
_fight_stocked = builds and _build_material(me, StructureSet.WALL) >= 0
|
||||
_ramps = 0
|
||||
_fight_seen = sim.tick
|
||||
var shooting: bool = (buttons & PlayerCommand.BUTTON_FIRE) != 0 and (state == "fight" or state == "brawl" or state == "ramp")
|
||||
if shooting or world.attackers.has(player_id):
|
||||
_fight_traded = true
|
||||
elif _in_fight and sim.tick - _fight_seen > roundi(Tuning.BOT_FIGHT_GAP_SECONDS * TICKS):
|
||||
_end_fight(false)
|
||||
|
||||
|
||||
func _end_fight(lost: bool) -> void:
|
||||
_in_fight = false
|
||||
if not _fight_traded:
|
||||
return
|
||||
stats["fights"] += 1
|
||||
if _fight_built:
|
||||
stats["fights_built"] += 1
|
||||
if _fight_stocked:
|
||||
stats["fights_stocked"] += 1
|
||||
if _fight_built:
|
||||
stats["fights_stocked_built"] += 1
|
||||
if lost:
|
||||
stats["fights_lost"] += 1
|
||||
if _fight_built:
|
||||
stats["fights_built_lost"] += 1
|
||||
|
||||
|
||||
## Goes behind a wall, toward `target`, for `seconds`.
|
||||
func _take_cover(sim: Simulation, me: SimEntity, target: SimEntity, seconds: float) -> void:
|
||||
_covering_until = sim.tick + roundi(seconds * TICKS)
|
||||
_cover_since = sim.tick
|
||||
_cover_yaw = atan2(target.position.x - me.position.x, target.position.z - me.position.z)
|
||||
_cover_walls = 0
|
||||
_cover_ready = sim.tick + roundi(Tuning.BOT_COVER_SECONDS * TICKS)
|
||||
|
||||
|
||||
## Chooses the piece, if any, this tick places. Sets `_piece_kind`.
|
||||
func _plan_build(sim: Simulation, grid: NavGrid, world: BotWorld, me: SimEntity, target: SimEntity, distance: float, fighting: bool) -> void:
|
||||
_piece_kind = -1
|
||||
if not builds or me.swimming or not me.on_ground or me.action_cooldown > 0 or _stage != OUTSIDE:
|
||||
return
|
||||
var stranded: bool = _stranded(sim, world, me)
|
||||
if _in_ring(sim, me) or stranded or _ring_due(sim, world, me):
|
||||
if not _in_ring(sim, me):
|
||||
_begin_ring(sim, me, stranded)
|
||||
for facing: int in 4:
|
||||
if _try_place(sim, me, StructureSet.BREAKWATER, facing * PI * 0.5):
|
||||
state = "breakwater"
|
||||
return
|
||||
if state == "cover":
|
||||
if _cover_walls == 0:
|
||||
if _try_place(sim, me, StructureSet.WALL, _cover_yaw):
|
||||
_cover_walls = 1
|
||||
elif sim.tick - _cover_since > TICKS / 2:
|
||||
# Nowhere to put a wall: give up on cover, and break off as before.
|
||||
_covering_until = sim.tick
|
||||
return
|
||||
if target == null:
|
||||
return
|
||||
var toward: float = atan2(target.position.x - me.position.x, target.position.z - me.position.z)
|
||||
var rise: float = target.position.y - me.position.y
|
||||
var across: float = Vector2(target.position.x - me.position.x, target.position.z - me.position.z).length()
|
||||
var climbing: bool = sim.tick < _ramp_until
|
||||
var ramp_wanted: bool = ((fighting or state == "chase" or state == "ramp") and _ramps < Tuning.BOT_RAMP_MAX
|
||||
and rise >= Tuning.BOT_RAMP_RISE_METRES and across <= Tuning.BOT_RAMP_REACH_METRES
|
||||
and (climbing or rise / maxf(across, 0.1) >= Tuning.BOT_RAMP_SLOPE or _steep_between(grid, me, target))
|
||||
and _build_material(me, StructureSet.RAMP) >= 0)
|
||||
# Shot at while reloading, from ambush or when worn down: a wall to shelter behind,
|
||||
# unless it's from up a cliff, where a wall would only block the way up.
|
||||
var shot_at: bool = _hit_by == target.id and sim.tick - _hit_tick <= TICKS / 2
|
||||
var exposed: bool = me.reload_ticks > 0 or sim.tick - _acquired_tick <= TICKS or me.health + me.armor <= Tuning.BOT_COVER_HEALTH
|
||||
if not ramp_wanted and (fighting or state == "chase") and shot_at and exposed and distance >= Tuning.BOT_COVER_MIN_METRES and sim.tick >= _cover_ready:
|
||||
if _try_place(sim, me, StructureSet.WALL, toward):
|
||||
_take_cover(sim, me, target, Tuning.BOT_COVER_HOLD_SECONDS)
|
||||
_cover_walls = 1
|
||||
state = "cover"
|
||||
return
|
||||
# Someone up a steep slope or a cliff: ramp up to them.
|
||||
if ramp_wanted:
|
||||
# On the way up, the next ramp goes on from the top of the last: one cell on,
|
||||
# one cell up. Until the bot is there, it keeps walking.
|
||||
var facing: int = _ramp_last.w if climbing else posmod(roundi(toward / (PI * 0.5)), 4)
|
||||
var yaw: float = facing * PI * 0.5
|
||||
if not climbing:
|
||||
# A ramp of its own already on the way (it broke off to take cover, say):
|
||||
# walk on up it.
|
||||
_probe.position = me.position
|
||||
_probe.yaw = posmod(roundi(yaw / TAU * PlayerCommand.YAW_STEPS), PlayerCommand.YAW_STEPS)
|
||||
_probe.pitch = 0
|
||||
var first: Building.Target = Building.target(_probe, StructureSet.RAMP)
|
||||
for dy: int in [-1, 0, 1]:
|
||||
var slot: Vector4i = Vector4i(first.slot.x, first.slot.y + dy, first.slot.z, first.slot.w)
|
||||
var piece: StructureSet.Piece = sim.structures.find(sim.structures.at_slot(slot))
|
||||
if piece != null and piece.kind == StructureSet.RAMP and piece.owner == player_id and piece.facing == facing:
|
||||
_ramp_last = Vector4i(slot.x, slot.y, slot.z, facing)
|
||||
var ahead: Vector2i = StructureSet.FACING_DIRECTIONS[facing]
|
||||
_ramp_direction = Vector2(ahead.x, ahead.y)
|
||||
_ramp_until = sim.tick + roundi(Tuning.BOT_RAMP_WALK_SECONDS * TICKS)
|
||||
return
|
||||
if climbing:
|
||||
_probe.position = me.position
|
||||
_probe.yaw = posmod(roundi(yaw / TAU * PlayerCommand.YAW_STEPS), PlayerCommand.YAW_STEPS)
|
||||
_probe.pitch = 0
|
||||
var next: Building.Target = Building.target(_probe, StructureSet.RAMP)
|
||||
var step: Vector2i = StructureSet.FACING_DIRECTIONS[facing]
|
||||
var level_step: int = roundi(StructureSet.cell_size() / Tuning.BUILD_LEVEL_METRES)
|
||||
if next.slot.x != _ramp_last.x + step.x or next.slot.z != _ramp_last.z + step.y or next.slot.y != _ramp_last.y + level_step:
|
||||
return
|
||||
if _try_place(sim, me, StructureSet.RAMP, yaw):
|
||||
var placed: Building.Target = Building.target(_probe, StructureSet.RAMP)
|
||||
_ramp_last = Vector4i(placed.slot.x, placed.slot.y, placed.slot.z, facing)
|
||||
var step: Vector2i = StructureSet.FACING_DIRECTIONS[facing]
|
||||
_ramp_direction = Vector2(step.x, step.y)
|
||||
_ramps += 1
|
||||
_ramp_until = sim.tick + roundi(Tuning.BOT_RAMP_WALK_SECONDS * TICKS)
|
||||
|
||||
|
||||
## True if the ground on the line to `target` is a cliff, or a solid that `target`
|
||||
## stands up on, somewhere a bot can't walk straight up.
|
||||
static func _steep_between(grid: NavGrid, me: SimEntity, target: SimEntity) -> bool:
|
||||
var from: Vector2 = Vector2(me.position.x, me.position.z)
|
||||
var to: Vector2 = Vector2(target.position.x, target.position.z)
|
||||
var samples: int = ceili(from.distance_to(to) / Tuning.BOT_NAV_CELL_METRES)
|
||||
for index: int in range(1, samples + 1):
|
||||
var at: Vector2 = from.lerp(to, float(index) / samples)
|
||||
var point: Vector2i = grid.point_of(Vector3(at.x, 0.0, at.y))
|
||||
var cell: int = grid.index_of(point)
|
||||
if grid.steep[cell] != 0:
|
||||
return true
|
||||
if grid.blocked[cell] > 0 and target.position.y > grid.heights[cell] + Tuning.BOT_RAMP_RISE_METRES * 0.5:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
## Starts a ring of breakwaters round the bot's cell. Stranded, it's worth staying in
|
||||
## while the coming level is within what a breakwater holds back; at the last stand,
|
||||
## whatever comes.
|
||||
func _begin_ring(sim: Simulation, me: SimEntity, stranded: bool) -> void:
|
||||
var g: float = StructureSet.cell_size()
|
||||
_ring_cell = Vector2i(floori(me.position.x / g), floori(me.position.z / g))
|
||||
_ring_started = sim.tick
|
||||
_ring_level = me.position.y + Tuning.BREAKWATER_MAX_HEAD - 1.0 if stranded else INF
|
||||
_ring_slots.clear()
|
||||
_probe.position = me.position
|
||||
_probe.pitch = 0
|
||||
for facing: int in 4:
|
||||
_probe.yaw = posmod(roundi(facing * 0.25 * PlayerCommand.YAW_STEPS), PlayerCommand.YAW_STEPS)
|
||||
_ring_slots.append(Building.target(_probe, StructureSet.BREAKWATER).slot)
|
||||
|
||||
|
||||
## True while the bot is in the cell it began ringing: for two seconds while the ring
|
||||
## goes up, then for as long as all four stand and the coming level is one it holds.
|
||||
func _in_ring(sim: Simulation, me: SimEntity) -> bool:
|
||||
if _ring_started < 0:
|
||||
return false
|
||||
var g: float = StructureSet.cell_size()
|
||||
if Vector2i(floori(me.position.x / g), floori(me.position.z / g)) != _ring_cell or me.swimming:
|
||||
_ring_started = -1
|
||||
return false
|
||||
if sim.tide != null and sim.tide.forecast_at(sim.tick) > _ring_level:
|
||||
_ring_started = -1
|
||||
return false
|
||||
if sim.tick - _ring_started < 2 * TICKS:
|
||||
return true
|
||||
for slot: Vector4i in _ring_slots:
|
||||
if not sim.structures.occupied(slot):
|
||||
_ring_started = -1
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
## True when the bot is running from the tide late in the match (the last
|
||||
## BOT_STRAND_PHASES phases) and can't make it: the sea will reach its feet before it
|
||||
## could walk to dry ground, though no higher than a breakwater holds back, and it can
|
||||
## afford a ring.
|
||||
func _stranded(sim: Simulation, world: BotWorld, me: SimEntity) -> bool:
|
||||
if not _fleeing or sim.tide == null or world.phase_count() == 0:
|
||||
return false
|
||||
var material: int = _build_material(me, StructureSet.BREAKWATER)
|
||||
if material < 0 or me.materials[material] < 4 * StructureSet.cost_of(StructureSet.BREAKWATER):
|
||||
return false
|
||||
if sim.tide.phase_at(sim.tick) < world.phase_count() - Tuning.BOT_STRAND_PHASES:
|
||||
return false
|
||||
var feet: float = me.position.y
|
||||
if sim.tide.forecast_at(sim.tick) > feet + Tuning.BREAKWATER_MAX_HEAD - 1.0:
|
||||
return false
|
||||
if sim.water_level_at(me.position) > feet - 0.3:
|
||||
return false
|
||||
var walk: float = Vector2(_flee_goal.x - me.position.x, _flee_goal.z - me.position.z).length() / Tuning.BOT_FLEE_SPEED
|
||||
for second: int in range(0, ceili(walk) + 1):
|
||||
if sim.tide.level_at(sim.tick + second * TICKS) >= feet - 0.3:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
## True at the last stand: the tide's phase leaves no dry ground, the bot is on the
|
||||
## last high point, and the rise has begun or is BOT_RING_SECONDS off.
|
||||
func _ring_due(sim: Simulation, world: BotWorld, me: SimEntity) -> bool:
|
||||
if sim.tide == null or world.phase_count() == 0:
|
||||
return false
|
||||
var phase: int = clampi(sim.tide.phase_at(sim.tick), 0, world.phase_count() - 1)
|
||||
if world.phase_cells[phase] != 0 or not world.is_safe(me.position, phase):
|
||||
return false
|
||||
return sim.tide.stage_at(sim.tick) != Tide.HOLD or sim.tide.ticks_until_rise(sim.tick) <= roundi(Tuning.BOT_RING_SECONDS * TICKS)
|
||||
|
||||
|
||||
## The material to build `kind` in: whichever the bot has most of, if that covers the
|
||||
## cost, or -1.
|
||||
static func _build_material(me: SimEntity, kind: int) -> int:
|
||||
var best: int = 0
|
||||
for code: int in Materials.NAMES.size():
|
||||
if me.materials[code] > me.materials[best]:
|
||||
best = code
|
||||
return best if me.materials[best] >= StructureSet.cost_of(kind) else -1
|
||||
|
||||
|
||||
## Sets this tick's piece to `kind`, facing `yaw`, if the server would accept it from
|
||||
## where the bot stands. Returns whether it did.
|
||||
func _try_place(sim: Simulation, me: SimEntity, kind: int, yaw: float) -> bool:
|
||||
var material: int = _build_material(me, kind)
|
||||
if material < 0:
|
||||
return false
|
||||
_probe.position = me.position
|
||||
_probe.yaw = posmod(roundi(yaw / TAU * PlayerCommand.YAW_STEPS), PlayerCommand.YAW_STEPS)
|
||||
_probe.pitch = 0
|
||||
_probe.health = me.health
|
||||
_probe.crouching = me.crouching
|
||||
_probe.swimming = me.swimming
|
||||
_probe.drop_state = me.drop_state
|
||||
_probe.materials = me.materials
|
||||
var at: Building.Target = Building.target(_probe, kind)
|
||||
if Building.check(sim, _probe, at, material) != Building.Result.OK:
|
||||
return false
|
||||
_piece_kind = kind
|
||||
_piece_yaw = yaw
|
||||
_piece_material = material
|
||||
return true
|
||||
|
||||
|
||||
## Gathers materials with the boathook: carries on with the prop it's at, or, at most
|
||||
## once a second and only when it's been quiet a while and the bot isn't hurt, looks
|
||||
## for one within BOT_HARVEST_NEAR_METRES (`far` false) or
|
||||
## BOT_HARVEST_METRES. Sets `state` to "gather" and returns true while it has one.
|
||||
func _gather(sim: Simulation, world: BotWorld, me: SimEntity, far: bool) -> bool:
|
||||
var stock: int = 0
|
||||
for amount: int in me.materials:
|
||||
stock = maxi(stock, amount)
|
||||
var wanted: int = Tuning.BOT_BUILD_STOCK
|
||||
if sim.tide != null and world.phase_count() > 0 and sim.tide.phase_at(sim.tick) >= world.phase_count() - Tuning.BOT_STRAND_PHASES:
|
||||
# Late in the match: enough for a ring of breakwaters.
|
||||
wanted = 4 * StructureSet.cost_of(StructureSet.BREAKWATER)
|
||||
if stock >= wanted or not Harvest.can_swing(me):
|
||||
_gather_prop = -1
|
||||
return false
|
||||
if _gather_prop >= 0 and (not sim.props.is_standing(_gather_prop) or sim.tick > _gather_deadline):
|
||||
if sim.props.is_standing(_gather_prop):
|
||||
_gather_skipped[_gather_prop] = true
|
||||
_gather_prop = -1
|
||||
if _gather_prop < 0:
|
||||
var quiet: int = roundi(Tuning.BOT_GATHER_QUIET_SECONDS * TICKS)
|
||||
if sim.tick - _last_seen_tick < quiet or sim.tick - _hit_tick < quiet or me.health + me.armor < Tuning.BOT_GATHER_HEALTH:
|
||||
return false
|
||||
var index: int = 1 if far else 0
|
||||
if sim.tick - _gather_checked[index] < TICKS:
|
||||
return false
|
||||
_gather_checked[index] = sim.tick
|
||||
_gather_prop = _find_gather_prop(sim, world, me, Tuning.BOT_HARVEST_METRES if far else Tuning.BOT_HARVEST_NEAR_METRES)
|
||||
if _gather_prop < 0:
|
||||
return false
|
||||
var gap: float = PropSet._distance_to_box(sim.props.boxes[_gather_prop], me.position)
|
||||
_gather_deadline = sim.tick + roundi((Tuning.BOT_HARVEST_SECONDS + gap / 3.0) * TICKS)
|
||||
state = "gather"
|
||||
_stop()
|
||||
var box: AABB = sim.props.boxes[_gather_prop]
|
||||
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)
|
||||
var to: Vector3 = aim - eye
|
||||
if PropSet._distance_to_box(box, eye) <= Harvest.reach() - 0.6:
|
||||
_swing = true
|
||||
_swing_aim = Vector2(atan2(to.x, to.z), atan2(to.y, Vector2(to.x, to.z).length()))
|
||||
return true
|
||||
_walk_to(me, Vector3(centre.x, box.position.y, centre.z), 0.0)
|
||||
if _direct_stalled > 3 * TICKS:
|
||||
_gather_skipped[_gather_prop] = true
|
||||
_gather_prop = -1
|
||||
return true
|
||||
|
||||
|
||||
## The nearest standing prop of a building material within `radius`, on dry ground
|
||||
## about level with the bot and outside huts and lofts, that it hasn't given up on.
|
||||
func _find_gather_prop(sim: Simulation, world: BotWorld, me: SimEntity, radius: float) -> int:
|
||||
for prop: int in sim.props.near(me.position, radius):
|
||||
if _gather_skipped.has(prop) or not Materials.is_valid(Materials.code_of(sim.props.material_of(prop))):
|
||||
continue
|
||||
var box: AABB = sim.props.boxes[prop]
|
||||
var foot: Vector3 = Vector3(box.get_center().x, box.position.y, box.get_center().z)
|
||||
if absf(box.position.y - me.position.y) > 3.0 or not _spot_allowed(sim, world, foot):
|
||||
continue
|
||||
if world.in_routed_place(foot):
|
||||
continue
|
||||
return prop
|
||||
return -1
|
||||
|
||||
+13
-1
@@ -44,8 +44,13 @@ var phase_tops: Array[Vector3] = []
|
||||
var walkable: PackedByteArray = PackedByteArray()
|
||||
## Where bots have chosen to land this match, so later bots can spread out (H3).
|
||||
var landings: Array[Vector3] = []
|
||||
## Duos (M7): team -> the marker index its first bot chose to land at, so its
|
||||
## teammate lands there too.
|
||||
var team_landings: Dictionary = {}
|
||||
## Victim entity ID -> attacker entity ID, for hits landed during the last tick.
|
||||
var attackers: Dictionary = {}
|
||||
## Builder entity ID -> the kinds of the pieces it placed during the last tick (M6).
|
||||
var placed: Dictionary = {}
|
||||
|
||||
|
||||
## `grid` is the match's navigation grid. Loot markers and safe ground that nothing can
|
||||
@@ -120,12 +125,19 @@ func in_routed_place(position: Vector3) -> bool:
|
||||
return false
|
||||
|
||||
|
||||
## Notes who hit whom during the last tick. Call once per tick, before bots think.
|
||||
## Notes who hit whom, and who placed what, during the last tick. Call once per tick,
|
||||
## before bots think.
|
||||
func observe(sim: Simulation) -> void:
|
||||
attackers.clear()
|
||||
placed.clear()
|
||||
for event: Dictionary in sim.events:
|
||||
if event["type"] == "player_hit" and int(event["player"]) != 0:
|
||||
attackers[int(event["victim"])] = int(event["player"])
|
||||
elif event["type"] == "piece_placed":
|
||||
var builder: int = int(event["player"])
|
||||
if not placed.has(builder):
|
||||
placed[builder] = []
|
||||
placed[builder].append(int(event["kind"]))
|
||||
|
||||
|
||||
func phase_count() -> int:
|
||||
|
||||
+35
-11
@@ -36,7 +36,7 @@ var _stuck_ticks: int = 0
|
||||
var _stuck_tries: int = 0
|
||||
var _jump_next: bool = false
|
||||
var _leap_tick: int = -1
|
||||
## How far the goal was from the barge last tick, while riding.
|
||||
## How far the goal was from the ship last tick, while riding.
|
||||
var _ride_gap: float = INF
|
||||
var _rng: RandomNumberGenerator = null
|
||||
var _rng_seed: int = 0
|
||||
@@ -87,8 +87,8 @@ func think(sim: Simulation, grid: NavGrid) -> PlayerCommand:
|
||||
if player.drop_state == Drop.ABOARD:
|
||||
return _ride(sim, player)
|
||||
if player.drop_state != Drop.NONE:
|
||||
# Gliding down: head for the goal.
|
||||
return _steer(sim, player, goal, 0)
|
||||
# Coming down: head for the goal.
|
||||
return _descend(sim, player)
|
||||
if status != MOVING:
|
||||
return PlayerCommand.from_input(sim.tick, Vector2.ZERO, deg_to_rad(player.yaw * 360.0 / PlayerCommand.YAW_STEPS), 0.0)
|
||||
if not _needs_plan and (sim.tick + player_id) % Tuning.BOT_PATH_CHECK_TICKS == 0:
|
||||
@@ -175,21 +175,45 @@ func _steer(sim: Simulation, player: SimEntity, target: Vector3, buttons: int) -
|
||||
return PlayerCommand.from_input(sim.tick, Vector2(0.0, 1.0), atan2(to.x, to.y), 0.0, buttons)
|
||||
|
||||
|
||||
## Aboard the barge: leap once the goal is within gliding reach, or once the barge
|
||||
## starts drawing away from it; with no goal, at a time set by the player ID. The end of the route puts everyone off anyway.
|
||||
## Aboard the ship: with a goal, fire the mortar at it with the charge that reaches it,
|
||||
## once the ship has come abeam of it and starts drawing away, or sooner if it is in
|
||||
## easy reach at a time set by the player ID; with no goal, at that time, towards the
|
||||
## middle of the island. The end of the route
|
||||
## fires everyone still aboard anyway.
|
||||
func _ride(sim: Simulation, player: SimEntity) -> PlayerCommand:
|
||||
if _leap_tick < 0 and sim.drop != null:
|
||||
_leap_tick = sim.drop.began_tick + Tuning.TICK_RATE_HZ * 2 + (player_id * 53) % (Tuning.TICK_RATE_HZ * 20)
|
||||
var leap: bool = sim.tick >= _leap_tick
|
||||
var target: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5
|
||||
var reach: float = 0.7
|
||||
if status == MOVING:
|
||||
# With somewhere to land, wait until it's in gliding reach, or until the barge
|
||||
# has passed it and is drawing away (H3: bots used to leap on the timer and land
|
||||
# hundreds of metres short).
|
||||
var gap: float = Vector2(goal.x - player.position.x, goal.z - player.position.z).length()
|
||||
leap = gap < 0.6 * (player.position.y - goal.y) or gap > _ride_gap + 0.01
|
||||
target = Vector2(goal.x, goal.z)
|
||||
reach = 1.0
|
||||
var gap: float = target.distance_to(Vector2(player.position.x, player.position.z))
|
||||
# Abeam of the goal; or in easy reach of it once this bot's own moment has come,
|
||||
# so riders don't all fire together; or about to be fired off at the end of the
|
||||
# route anyway, which aims at the middle of the island instead of the goal.
|
||||
leap = gap > _ride_gap + 0.01 or (sim.drop != null and sim.drop.is_over(sim.tick + 2)) \
|
||||
or (leap and gap <= Tuning.BOT_LANDING_REACH_METRES)
|
||||
_ride_gap = gap
|
||||
var to: Vector2 = target - Vector2(player.position.x, player.position.z)
|
||||
var buttons: int = PlayerCommand.BUTTON_JUMP if leap else 0
|
||||
return PlayerCommand.from_input(sim.tick, Vector2.ZERO, 0.0, 0.0, buttons)
|
||||
var pitch: float = Drop.pitch_for_charge(Drop.aim_charge(to.length() * reach)) if leap else 0.0
|
||||
return PlayerCommand.from_input(sim.tick, Vector2.ZERO, atan2(to.x, to.y), pitch, buttons)
|
||||
|
||||
|
||||
## Coming down: steer for the goal, and once over the top of the mortar's arc, open the
|
||||
## kite if the goal is further off than the rest of a fall would carry (a fall covers
|
||||
## well under the kite's glide of about two metres across for each one down).
|
||||
func _descend(sim: Simulation, player: SimEntity) -> PlayerCommand:
|
||||
var buttons: int = 0
|
||||
if player.drop_state == Drop.FREEFALL and player.velocity.y <= 0.0:
|
||||
var gap: float = Vector2(goal.x - player.position.x, goal.z - player.position.z).length()
|
||||
var carry: float = Vector2(player.velocity.x, player.velocity.z).length()
|
||||
var coast: float = maxf(carry * carry - Tuning.GLIDE_SPEED * Tuning.GLIDE_SPEED, 0.0) / (2.0 * Tuning.DROP_STEER_ACCEL)
|
||||
if gap - coast > (player.position.y - goal.y) * 1.6:
|
||||
buttons = PlayerCommand.BUTTON_JUMP
|
||||
return _steer(sim, player, goal, buttons)
|
||||
|
||||
|
||||
## A random open dry point within ROAM_RANGE that a path reaches, from the bot's own
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## The script a soak-test client plays by. It only sees what a network client sees: its
|
||||
## own predicted player and its copy of the island. It leaps from the barge over land,
|
||||
## own predicted player and its copy of the island. It fires itself off the ship at the summit,
|
||||
## glides, heads for the island's highest ground (where the tide leaves people last),
|
||||
## swings the boathook at whatever is in front of it, which harvests trees and crates,
|
||||
## and every few seconds tries to put up a wall. So a soak match has movement, world
|
||||
@@ -40,9 +40,10 @@ func command(tick: int, me: SimEntity, world: Simulation) -> PlayerCommand:
|
||||
var to_top: Vector2 = _top - Vector2(me.position.x, me.position.z)
|
||||
var yaw: float = atan2(to_top.x, to_top.y)
|
||||
if me.drop_state == Drop.ABOARD:
|
||||
# Fire the mortar at the summit after a wait of a few seconds.
|
||||
var wait: int = (3 + number % 8) * TICKS
|
||||
var over_land: bool = world.ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 2.0
|
||||
return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, 0.0, PlayerCommand.BUTTON_JUMP if tick > wait and over_land else 0)
|
||||
var pitch: float = Drop.pitch_for_charge(Drop.aim_charge(to_top.length()))
|
||||
return PlayerCommand.from_input(tick, Vector2.ZERO, yaw, pitch, PlayerCommand.BUTTON_JUMP if tick > wait else 0)
|
||||
if me.drop_state != Drop.NONE:
|
||||
return PlayerCommand.from_input(tick, Vector2(0.0, 1.0), yaw, 0.0)
|
||||
var phase: int = (tick + number * 11) % (6 * TICKS)
|
||||
|
||||
@@ -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))
|
||||
@@ -0,0 +1 @@
|
||||
uid://u6jrr2nuxaod
|
||||
@@ -1,10 +1,12 @@
|
||||
## The placement preview: a translucent copy of the piece where fire would put it, sea
|
||||
## green when the server would accept it and rust red when it wouldn't. It asks the same
|
||||
## The placement preview: a translucent copy of the piece where fire would put it, in the
|
||||
## 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
|
||||
## agree on the client's predicted state.
|
||||
class_name BuildGhost
|
||||
extends Node3D
|
||||
|
||||
## The standard set's colours; Palette.vision can change what is shown.
|
||||
const VALID_COLOUR: Color = Palette.GHOST_OK
|
||||
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:
|
||||
_shown_key = key
|
||||
_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:
|
||||
|
||||
@@ -21,15 +21,20 @@ const CLEARANCE: float = 0.1
|
||||
const CLEAR_STEPS: int = 16
|
||||
## Seconds to move most of the way between hip and aim.
|
||||
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`.
|
||||
var aim_blend: float = 0.0
|
||||
var reduce_motion: bool = false
|
||||
|
||||
|
||||
## Eases aim_blend towards aiming or not over `delta` seconds.
|
||||
func update_aim(aiming: bool, delta: float) -> void:
|
||||
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)
|
||||
if absf(aim_blend - target) < 0.001:
|
||||
aim_blend = target
|
||||
@@ -66,7 +71,7 @@ func solve(feet: Vector3, yaw: float, pitch: float, crouching: bool, ground: Sim
|
||||
|
||||
|
||||
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.
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
## 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,
|
||||
## 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
|
||||
## land, glides, and walks about. That is for tests and for checking a connection with
|
||||
## With `autoplay` on, a simple script plays instead: it fires itself off the ship
|
||||
## towards the middle of the island, glides, and walks about. That is for tests and for checking a connection with
|
||||
## nobody at the keyboard.
|
||||
class_name ClientInput
|
||||
extends RefCounted
|
||||
@@ -31,6 +32,15 @@ var map_open: bool = false
|
||||
var build_kind: int = StructureSet.WALL
|
||||
var material: int = Materials.DRIFTWOOD
|
||||
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.
|
||||
const HELD: Dictionary = {
|
||||
@@ -45,18 +55,43 @@ func aiming() -> bool:
|
||||
return buttons & PlayerCommand.BUTTON_AIM != 0 and not build_mode
|
||||
|
||||
|
||||
## Reads what is held down from the keyboard and mouse. Call once a frame.
|
||||
func poll() -> void:
|
||||
## Reads what is held down from the keyboard, the mouse and the gamepad, and turns
|
||||
## the look by the right stick over `delta` seconds. Call once a frame.
|
||||
func poll(delta: float = 0.0) -> void:
|
||||
if autoplay:
|
||||
return
|
||||
move = Vector2(
|
||||
_axis("right", "left"),
|
||||
_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
|
||||
for action: String in HELD:
|
||||
if bindings.is_held(action):
|
||||
if bindings.is_held(action) or pad.is_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
|
||||
@@ -64,6 +99,10 @@ func poll() -> void:
|
||||
func handle(event: InputEvent, captured: bool) -> void:
|
||||
if autoplay:
|
||||
return
|
||||
if pad.feed(event):
|
||||
for action: String in pad.take_presses():
|
||||
act(action)
|
||||
return
|
||||
var motion: InputEventMouseMotion = event as InputEventMouseMotion
|
||||
if motion != null and captured:
|
||||
turn(motion.relative)
|
||||
@@ -95,6 +134,16 @@ func act(action: String) -> void:
|
||||
map_open = not map_open
|
||||
elif action == "material" and build_mode:
|
||||
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_"):
|
||||
var number: int = action.substr(5).to_int()
|
||||
if build_mode:
|
||||
@@ -123,8 +172,11 @@ func autoplay_command(tick: int, me: SimEntity, ground: SimGround) -> PlayerComm
|
||||
move = Vector2.ZERO
|
||||
buttons = 0
|
||||
if me.drop_state == Drop.ABOARD:
|
||||
# Over dry land, with a moment to look about first.
|
||||
if tick > 3 * Tuning.TICK_RATE_HZ and ground.terrain_height(me.position.x, me.position.z) > Tuning.ISLAND_BEACH_TOP + 2.0:
|
||||
# With a moment to look about first, fire the mortar most of the way to the
|
||||
# middle of the island.
|
||||
if tick > 3 * Tuning.TICK_RATE_HZ:
|
||||
var gap: float = Vector2(centre - me.position.x, centre - me.position.z).length()
|
||||
pitch = Drop.pitch_for_charge(Drop.aim_charge(gap * 0.7))
|
||||
buttons = PlayerCommand.BUTTON_JUMP
|
||||
elif me.drop_state != Drop.NONE:
|
||||
move = Vector2(0.0, 1.0)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Draws what moves in a match: players with what they hold, the sky barge while it
|
||||
## Draws what moves in a match: players with what they hold, the packet ship while it
|
||||
## crosses, items lying in the world, thrown kegs and sea chests. `sync()` matches everything to the
|
||||
## simulation as it is now, and `animate()` steps the players' figures.
|
||||
##
|
||||
@@ -6,8 +6,9 @@
|
||||
## simulation replicates about them, with shots, swings and building played from FX
|
||||
## records through hear(). Held and lying items are the models of A4 (ItemModels): a
|
||||
## held one sits with its grip in the figure's right hand and points where its player
|
||||
## looks. The barge and the sea chests are VesselModels, generated in code. Nothing
|
||||
## here is ever used for collision.
|
||||
## looks. The ship and the sea chests are VesselModels, generated in code. The ship's
|
||||
## lifeline mortar faces the island, and a player it has just fired trails a line from
|
||||
## its muzzle until the arc tops out. Nothing here is ever used for collision.
|
||||
class_name EntityView
|
||||
extends Node3D
|
||||
|
||||
@@ -21,7 +22,7 @@ const SKIN: Color = Palette.SKIN
|
||||
## shows darker, its paint dulled.
|
||||
const CHEST_SHUT: Color = Color.WHITE
|
||||
const CHEST_OPEN: Color = Palette.OPENED_DULL
|
||||
## How far apart passengers stand on the barge's deck, in metres. The simulation
|
||||
## How far apart passengers stand on the ship's deck, in metres. The simulation
|
||||
## carries them all at one point; this only spreads them out to be seen.
|
||||
const DECK_SPACING: float = 1.3
|
||||
const DECK_ROWS: int = 4
|
||||
@@ -30,16 +31,19 @@ const PICKUP_SCALE: float = 1.4
|
||||
|
||||
## The entity drawn in the brightest oilskin, or 0.
|
||||
var local_id: int = 0
|
||||
## Where to draw the barge, when its owner knows better than the simulation's tick: a
|
||||
## Where to draw the ship, when its owner knows better than the simulation's tick: a
|
||||
## network client, which draws between ticks. Vector3.INF leaves it to the tick.
|
||||
var barge_at: Vector3 = Vector3.INF
|
||||
var ship_at: Vector3 = Vector3.INF
|
||||
|
||||
var _sim: Simulation
|
||||
## Entity ID -> its FigureRig.
|
||||
var _figures: Dictionary = {}
|
||||
## Whether _process steps the figures. Captures that pose figures exactly turn it off.
|
||||
var animate_live: bool = true
|
||||
var _barge: Node3D
|
||||
var _ship: Node3D
|
||||
## One line from the mortar to each player still climbing the arc, reused.
|
||||
var _lifelines: Array[MeshInstance3D] = []
|
||||
var _lifeline_mesh: ArrayMesh
|
||||
## Items lying in the world: one MultiMeshInstance3D per item model and tier.
|
||||
var _pickups: Node3D
|
||||
var _pickup_fields: Dictionary = {}
|
||||
@@ -48,9 +52,9 @@ var _chests: MultiMeshInstance3D
|
||||
|
||||
func setup(sim: Simulation) -> void:
|
||||
_sim = sim
|
||||
_barge = _build_barge()
|
||||
_barge.visible = false
|
||||
add_child(_barge)
|
||||
_ship = _build_ship()
|
||||
_ship.visible = false
|
||||
add_child(_ship)
|
||||
_pickups = Node3D.new()
|
||||
_pickups.name = "Pickups"
|
||||
add_child(_pickups)
|
||||
@@ -68,8 +72,8 @@ func figure_of(entity_id: int) -> FigureRig:
|
||||
return _figures.get(entity_id)
|
||||
|
||||
|
||||
func barge() -> Node3D:
|
||||
return _barge
|
||||
func ship() -> Node3D:
|
||||
return _ship
|
||||
|
||||
|
||||
## Items drawn lying in the world.
|
||||
@@ -106,10 +110,15 @@ func sync() -> void:
|
||||
if drop != null:
|
||||
var along: Vector3 = drop.finish - drop.start
|
||||
heading = atan2(along.x, along.z)
|
||||
_barge.visible = crossing
|
||||
_ship.visible = crossing
|
||||
if crossing:
|
||||
_barge.position = barge_at if barge_at != Vector3.INF else drop.barge_position(_sim.tick)
|
||||
_barge.rotation.y = heading
|
||||
_ship.position = ship_at if ship_at != Vector3.INF else drop.ship_position(_sim.tick)
|
||||
_ship.rotation.y = heading
|
||||
# The model's mortar faces its +x: mirror it if the island lies the other way.
|
||||
var starboard: Vector2 = Vector2(cos(heading), -sin(heading))
|
||||
var centre: Vector2 = Vector2.ONE * Tuning.WORLD_SIZE_METRES * 0.5
|
||||
_ship.scale.x = 1.0 if (centre - Vector2(drop.start.x, drop.start.z)).dot(starboard) >= 0.0 else -1.0
|
||||
var lines: int = 0
|
||||
|
||||
var seen: Dictionary = {}
|
||||
var aboard: int = 0
|
||||
@@ -133,7 +142,12 @@ func sync() -> void:
|
||||
figure.position += offset.rotated(Vector3.UP, heading)
|
||||
figure.rotation.y = heading
|
||||
aboard += 1
|
||||
elif crossing and entity.drop_state == Drop.FREEFALL and entity.velocity.y > 0.0 and not entity.eliminated:
|
||||
_draw_lifeline(lines, _ship.transform * VesselModels.muzzle(), entity.position + Vector3(0.0, 1.0, 0.0))
|
||||
lines += 1
|
||||
_hold(figure, entity)
|
||||
for index: int in range(lines, _lifelines.size()):
|
||||
_lifelines[index].visible = false
|
||||
for entity_id: int in _figures.keys():
|
||||
if not seen.has(entity_id):
|
||||
_figures[entity_id].queue_free()
|
||||
@@ -176,9 +190,9 @@ func hear(records: Array[Dictionary]) -> void:
|
||||
|
||||
|
||||
## Puts the held item's model in the figure's hand; the figure points it where the
|
||||
## player looks. Nothing is held aboard the barge, falling, gliding or swimming.
|
||||
## player looks. Nothing is held aboard the ship, falling, gliding, swimming or down.
|
||||
func _hold(figure: FigureRig, entity: SimEntity) -> void:
|
||||
var busy: bool = entity.drop_state != Drop.NONE or entity.swimming or entity.eliminated
|
||||
var busy: bool = entity.drop_state != Drop.NONE or entity.swimming or entity.eliminated or entity.downed
|
||||
figure.hand().visible = not busy
|
||||
if busy:
|
||||
return
|
||||
@@ -248,6 +262,35 @@ func _item_field(key: String) -> MultiMeshInstance3D:
|
||||
return field
|
||||
|
||||
|
||||
## Shows lifeline `index` from `from` to `to`, making it if there aren't enough yet.
|
||||
func _draw_lifeline(index: int, from: Vector3, to: Vector3) -> void:
|
||||
if _lifeline_mesh == null:
|
||||
_lifeline_mesh = VesselModels.lifeline()
|
||||
while _lifelines.size() <= index:
|
||||
var line: MeshInstance3D = MeshInstance3D.new()
|
||||
line.name = "Lifeline%d" % _lifelines.size()
|
||||
line.mesh = _lifeline_mesh
|
||||
line.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
|
||||
add_child(line)
|
||||
_lifelines.append(line)
|
||||
var line: MeshInstance3D = _lifelines[index]
|
||||
var length: float = from.distance_to(to)
|
||||
line.visible = length > 0.5
|
||||
if not line.visible:
|
||||
return
|
||||
var up: Vector3 = Vector3.UP if absf((to - from).normalized().y) < 0.99 else Vector3.RIGHT
|
||||
line.transform = Transform3D(Basis.looking_at(to - from, up) * Basis.from_scale(Vector3(1.0, 1.0, length)), (from + to) * 0.5)
|
||||
|
||||
|
||||
## Lifelines drawn now, for tests.
|
||||
func lifeline_count() -> int:
|
||||
var count: int = 0
|
||||
for line: MeshInstance3D in _lifelines:
|
||||
if line.visible:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func _build_figure(entity_id: int) -> FigureRig:
|
||||
var coat: Color = OILSKINS[0] if entity_id == local_id else OILSKINS[1 + entity_id % (OILSKINS.size() - 1)]
|
||||
var figure: FigureRig = FigureRig.new(coat)
|
||||
@@ -255,13 +298,13 @@ func _build_figure(entity_id: int) -> FigureRig:
|
||||
return figure
|
||||
|
||||
|
||||
## The barge (VesselModels): a hull hung under a canvas envelope. Its deck is at the
|
||||
## origin, where the simulation carries the passengers.
|
||||
func _build_barge() -> Node3D:
|
||||
var barge: MeshInstance3D = MeshInstance3D.new()
|
||||
barge.name = "Barge"
|
||||
barge.mesh = VesselModels.barge()
|
||||
return barge
|
||||
## The packet ship (VesselModels). Its deck is at the origin, where the simulation
|
||||
## carries the passengers.
|
||||
func _build_ship() -> Node3D:
|
||||
var ship: MeshInstance3D = MeshInstance3D.new()
|
||||
ship.name = "Ship"
|
||||
ship.mesh = VesselModels.ship()
|
||||
return ship
|
||||
|
||||
|
||||
func _chest_field() -> MultiMeshInstance3D:
|
||||
|
||||
@@ -188,7 +188,7 @@ static func _clips() -> Dictionary:
|
||||
[0.4, over(air, {"shoulder_r": Vector3(-20, 0, -46), "shoulder_l": Vector3(-20, 0, 46)})],
|
||||
]]
|
||||
|
||||
# Falling from the barge, belly down, spread out.
|
||||
# Climbing the mortar's arc and falling from it, belly down, spread out.
|
||||
var skydive: Dictionary = {
|
||||
"hips": Vector3(72, 0, 0), "waist": Vector3(6, 0, 0), "neck": Vector3(-55, 0, 0),
|
||||
"shoulder_r": Vector3(-70, 0, -70), "shoulder_l": Vector3(-70, 0, 70),
|
||||
@@ -201,7 +201,7 @@ static func _clips() -> Dictionary:
|
||||
[0.5, over(skydive, {"shoulder_r": Vector3(-74, 0, -64), "shoulder_l": Vector3(-74, 0, 64), "knee_r": Vector3(48, 0, 0), "knee_l": Vector3(34, 0, 0)})],
|
||||
]]
|
||||
|
||||
# Hanging under the wing-sail, both hands up on its lines.
|
||||
# Hanging under the gull-kite, both hands up on its lines.
|
||||
var glide: Dictionary = {
|
||||
"hips": Vector3(12, 0, 0), "waist": Vector3(-4, 0, 0), "neck": Vector3(10, 0, 0),
|
||||
"shoulder_r": Vector3(-158, 0, -16), "shoulder_l": Vector3(-158, 0, 16),
|
||||
@@ -231,6 +231,22 @@ static func _clips() -> Dictionary:
|
||||
[0.0, swim], [0.325, swim_pull], [0.65, mirror(swim)], [0.975, mirror(swim_pull)],
|
||||
]]
|
||||
|
||||
# Downed in duos (M7): on hands and knees, head up, crawling a hand and knee at a time.
|
||||
var downed: Dictionary = {
|
||||
"hips": Vector3(78, 0, 0), "waist": Vector3(-4, 0, 0), "neck": Vector3(-52, 0, 0),
|
||||
"shoulder_r": Vector3(-84, 0, -6), "elbow_r": Vector3(-8, 0, 0),
|
||||
"shoulder_l": Vector3(-84, 0, 6), "elbow_l": Vector3(-8, 0, 0),
|
||||
"hip_r": Vector3(-78, 0, -4), "knee_r": Vector3(92, 0, 0),
|
||||
"hip_l": Vector3(-78, 0, 4), "knee_l": Vector3(92, 0, 0), "lift": Vector3(0, -0.5, 0),
|
||||
}
|
||||
var downed_reach: Dictionary = over(downed, {
|
||||
"shoulder_r": Vector3(-104, 0, -6), "hip_l": Vector3(-64, 0, 4), "knee_l": Vector3(84, 0, 0),
|
||||
"waist": Vector3(-4, 6, 0),
|
||||
})
|
||||
clips["downed"] = [1.6, true, [
|
||||
[0.0, downed], [0.4, downed_reach], [0.8, downed], [1.2, mirror(downed_reach)],
|
||||
]]
|
||||
|
||||
# How the held item is carried (arms only).
|
||||
# Long things at the chest, the right hand at the grip and the left reaching
|
||||
# along to the fore-end.
|
||||
|
||||
@@ -36,7 +36,7 @@ const ANIMATED: Array[String] = [
|
||||
const PARENT: Dictionary = {
|
||||
"hips": "", "waist": "hips", "spine": "waist", "neck": "spine",
|
||||
"shoulder_r": "spine", "elbow_r": "shoulder_r", "shoulder_l": "spine", "elbow_l": "shoulder_l",
|
||||
"hip_r": "hips", "knee_r": "hip_r", "hip_l": "hips", "knee_l": "hip_l", "sail": "",
|
||||
"hip_r": "hips", "knee_r": "hip_r", "hip_l": "hips", "knee_l": "hip_l", "kite": "",
|
||||
}
|
||||
## Part model -> the joint pivot it hangs on.
|
||||
const PART_JOINT: Dictionary = {
|
||||
@@ -44,7 +44,7 @@ const PART_JOINT: Dictionary = {
|
||||
"upper_arm_r": "shoulder_r", "forearm_r": "elbow_r",
|
||||
"upper_arm_l": "shoulder_l", "forearm_l": "elbow_l",
|
||||
"thigh_r": "hip_r", "shin_r": "knee_r", "thigh_l": "hip_l", "shin_l": "knee_l",
|
||||
"sail": "sail",
|
||||
"kite": "kite",
|
||||
}
|
||||
## Material names in the part models -> Palette colours. COAT and COAT_DARK are the
|
||||
## player's own oilskin.
|
||||
@@ -52,10 +52,11 @@ const COLOURS: Dictionary = {
|
||||
"TAR": Palette.TAR, "TAR_WEATHERED": Palette.TAR_WEATHERED, "SKIN": Palette.SKIN,
|
||||
"INK": Palette.INK, "BARK": Palette.BARK, "CANVAS": Palette.CANVAS, "GILT": Palette.GILT,
|
||||
"PLANK": Palette.PLANK, "OCHRE_RED": Palette.OCHRE_RED, "TANNED_SAIL": Palette.TANNED_SAIL,
|
||||
"SALT": Palette.SALT,
|
||||
}
|
||||
const COAT_SHADE: float = 0.28
|
||||
## The states of `move`, in input order.
|
||||
const STATES: Array[String] = ["ground", "crouch", "air", "skydive", "glide", "swim", "aboard"]
|
||||
const STATES: Array[String] = ["ground", "crouch", "air", "skydive", "glide", "swim", "aboard", "downed"]
|
||||
const HOLDS: Array[String] = ["long", "short", "carry"]
|
||||
const ACTIONS: Array[String] = ["fire_long", "fire_short", "swing", "throw", "build"]
|
||||
## How long a figure must be off the ground before it's drawn in the air, so steps
|
||||
@@ -88,7 +89,7 @@ var speed: float = 0.0
|
||||
|
||||
var _hand: Node3D
|
||||
var _held: MeshInstance3D
|
||||
var _sail: Node3D
|
||||
var _kite: Node3D
|
||||
var _pitch: float = 0.0
|
||||
var _holding: bool = true
|
||||
var _airborne: float = 0.0
|
||||
@@ -124,8 +125,8 @@ func _init(coat_colour: Color = Palette.OILSKIN) -> void:
|
||||
instance.name = part
|
||||
instance.mesh = mesh
|
||||
(joints[PART_JOINT[part]] as Node3D).add_child(instance)
|
||||
_sail = joints["sail"]
|
||||
_sail.visible = false
|
||||
_kite = joints["kite"]
|
||||
_kite.visible = false
|
||||
_hand = Node3D.new()
|
||||
_hand.name = "hand_r"
|
||||
_hand.position = _vector(layout.get("hand_r", [-0.24, 0.86, 0.03])) - _vector(at.get("elbow_r", [0, 0, 0]))
|
||||
@@ -163,7 +164,7 @@ static func part_mesh(part: String, coat_colour: Color) -> ArrayMesh:
|
||||
|
||||
## H1: one surface per finish instead of one per colour, with each Palette colour
|
||||
## carried as a vertex colour. The model's surfaces are separate draw calls in every
|
||||
## pass, and 24 figures crowded on the barge passed the draw-call budget; merged, a
|
||||
## pass, and 24 figures crowded on the ship passed the draw-call budget; merged, a
|
||||
## figure costs a third of the draws and looks the same. Each surface is named after
|
||||
## its finish: FINISH_COAT, FINISH_GILT or FINISH_PLAIN.
|
||||
static func _merged(source: Mesh, coat_colour: Color) -> ArrayMesh:
|
||||
@@ -256,8 +257,8 @@ func held() -> MeshInstance3D:
|
||||
return _held
|
||||
|
||||
|
||||
func sail() -> Node3D:
|
||||
return _sail
|
||||
func kite() -> Node3D:
|
||||
return _kite
|
||||
|
||||
|
||||
## Sets the tree from an entity's replicated state. `delta` is the time since the last
|
||||
@@ -283,7 +284,7 @@ func drive(entity: SimEntity, delta: float) -> void:
|
||||
flinch()
|
||||
_last_health = entity.health
|
||||
_pitch = float(entity.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5)
|
||||
_sail.visible = state == "glide"
|
||||
_kite.visible = state == "glide"
|
||||
_hand.visible = _holding
|
||||
tree.set("parameters/move/transition_request", state)
|
||||
tree.set("parameters/ground/blend_position", speed)
|
||||
@@ -304,6 +305,9 @@ static func state_of(entity: SimEntity, airborne: bool) -> String:
|
||||
return "glide"
|
||||
if entity.swimming:
|
||||
return "swim"
|
||||
if entity.downed:
|
||||
# Duos (M7): down on hands and knees, crawling.
|
||||
return "downed"
|
||||
if airborne:
|
||||
return "air"
|
||||
return "crouch" if entity.crouching else "ground"
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
## Generated meshes for the drop barge and the sea chests, built in code from Palette
|
||||
## Generated meshes for the packet ship and the sea chests, built in code from Palette
|
||||
## colours (no imported art):
|
||||
##
|
||||
## - the barge: a tarred, lofted hull with a sheer and pointed ends, a planked deck,
|
||||
## rails, mooring lines, and a gored canvas envelope with tanned stripes and an ochre
|
||||
## band, in the folk-art manner of docs/STYLE.md. Its deck top is at the origin, where
|
||||
## the simulation carries the passengers; it points along +z;
|
||||
## - the packet ship (#72): a tarred, lofted hull with a sheer, an ochre rubbing strake
|
||||
## and a salt-white boot-top at the waterline, a planked deck, rails, two masts with
|
||||
## tanned square sails on yards, a bowsprit, shrouds, and the lifeline mortar on its
|
||||
## timber bed, in the folk-art manner of docs/STYLE.md. Its deck top is at the origin,
|
||||
## where the simulation carries the passengers, and the waterline SHIP_DECK_HEIGHT
|
||||
## below it; it points along +z, and the mortar faces +x;
|
||||
## - a sea chest: a painted box with a lid, tarred iron bands, a salt-white border and a
|
||||
## gilt hasp, its base at the origin.
|
||||
class_name VesselModels
|
||||
extends RefCounted
|
||||
|
||||
## Hull half-length, half-breadth at the deck, and depth amidships, in metres.
|
||||
const HULL_HALF_LENGTH: float = 5.5
|
||||
const HULL_HALF_BREADTH: float = 3.4
|
||||
const HULL_DEPTH: float = 1.6
|
||||
## Envelope centre height above the deck and its semi-axes (x, y, z), in metres.
|
||||
const ENVELOPE_HEIGHT: float = 10.5
|
||||
const ENVELOPE_AXES: Vector3 = Vector3(5.2, 3.8, 9.0)
|
||||
const ENVELOPE_RINGS: int = 14
|
||||
const ENVELOPE_SIDES: int = 20
|
||||
## Hull half-length, half-breadth at the deck, and depth amidships, in metres. The keel
|
||||
## sits HULL_DEPTH under the deck, below the waterline.
|
||||
const HULL_HALF_LENGTH: float = 12.0
|
||||
const HULL_HALF_BREADTH: float = 3.8
|
||||
const HULL_DEPTH: float = Tuning.SHIP_DECK_HEIGHT + 1.8
|
||||
## Masts: where along the deck (z), and how tall above it.
|
||||
const MASTS: Array[Vector2] = [Vector2(6.6, 17.0), Vector2(-5.8, 14.5)]
|
||||
## Where the mortar stands on the deck: forward of the passengers, aft of the foremast,
|
||||
## pointing out to +x.
|
||||
const MORTAR_AT: Vector3 = Vector3(1.4, 0.0, 4.7)
|
||||
|
||||
## The mortar's barrel: its breech above MORTAR_AT, the way it points, and its length.
|
||||
const MORTAR_BREECH: Vector3 = Vector3(-0.15, 0.55, 0.0)
|
||||
const MORTAR_AIM: Vector3 = Vector3(0.62, 0.78, 0.0)
|
||||
const MORTAR_LENGTH: float = 1.25
|
||||
|
||||
## The lifeline cord's thickness, in metres.
|
||||
const LIFELINE_WIDTH: float = 0.07
|
||||
|
||||
## Chest size (x, y, z), in metres; its lid is the top LID share of its height.
|
||||
const CHEST_SIZE: Vector3 = Vector3(0.9, 0.55, 0.6)
|
||||
const LID: float = 0.3
|
||||
|
||||
|
||||
static func barge() -> ArrayMesh:
|
||||
static func ship() -> ArrayMesh:
|
||||
var tool: SurfaceTool = SurfaceTool.new()
|
||||
tool.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
tool.set_smooth_group(-1)
|
||||
@@ -43,30 +54,117 @@ static func barge() -> ArrayMesh:
|
||||
x += 0.32
|
||||
index += 1
|
||||
# Rails follow the sheer on stanchions at every station.
|
||||
var rail: Vector3 = Vector3(0.0, 0.65, 0.0)
|
||||
for side: int in [0, 4]:
|
||||
var rail: Vector3 = Vector3(0.0, 0.8, 0.0)
|
||||
for side: int in [0, 6]:
|
||||
var inward: Vector3 = Vector3(0.12 if side == 0 else -0.12, 0.0, 0.0)
|
||||
for station: int in rings.size():
|
||||
var at: Vector3 = rings[station][side] + inward
|
||||
_line(tool, at, at + rail, 0.1, Palette.TAR)
|
||||
if station + 1 < rings.size():
|
||||
_line(tool, at + rail, rings[station + 1][side] + inward + rail, 0.1, Palette.TAR)
|
||||
for side: float in [-1.0, 1.0]:
|
||||
# Mooring lines from the rail to the envelope's belly.
|
||||
for end: float in [-1.0, 1.0]:
|
||||
var foot: Vector3 = Vector3(side * (HULL_HALF_BREADTH - 0.35), 0.6, end * 3.6)
|
||||
var hx: float = 0.55
|
||||
var hz: float = 0.5
|
||||
var under: float = ENVELOPE_AXES.y * sqrt(1.0 - hx * hx - hz * hz)
|
||||
var head: Vector3 = Vector3(side * ENVELOPE_AXES.x * hx, ENVELOPE_HEIGHT - under + 0.15, end * ENVELOPE_AXES.z * hz)
|
||||
_line(tool, foot, head, 0.05, Palette.PLANK.darkened(0.3))
|
||||
_envelope(tool)
|
||||
# Bowsprit, raking up from the bow.
|
||||
var bow: Vector3 = Vector3(0.0, _sheer(1.0) + 0.3, HULL_HALF_LENGTH - 0.4)
|
||||
var sprit_end: Vector3 = bow + Vector3(0.0, 2.4, 6.0)
|
||||
_line(tool, bow, sprit_end, 0.28, Palette.PLANK.darkened(0.15))
|
||||
for mast: Vector2 in MASTS:
|
||||
_mast(tool, mast.x, mast.y, sprit_end if mast == MASTS[0] else Vector3.INF)
|
||||
_mortar(tool)
|
||||
tool.generate_normals()
|
||||
var mesh: ArrayMesh = tool.commit()
|
||||
mesh.surface_set_material(0, _material(0.85))
|
||||
return mesh
|
||||
|
||||
|
||||
## Height of the sheer at `t`, from -1 (stern) to 1 (bow).
|
||||
static func _sheer(t: float) -> float:
|
||||
return 0.9 * t * t
|
||||
|
||||
|
||||
## A mast at `z` rising `height` above the deck: a tarred pole, two yards with tanned
|
||||
## square sails between them, an ochre band on the lower sail, and shrouds to the rails.
|
||||
## A forestay runs to `stay_to` unless it is Vector3.INF.
|
||||
static func _mast(tool: SurfaceTool, z: float, height: float, stay_to: Vector3) -> void:
|
||||
var foot: Vector3 = Vector3(0.0, 0.0, z)
|
||||
var top: Vector3 = Vector3(0.0, height, z)
|
||||
_line(tool, foot, top, 0.36, Palette.PLANK.darkened(0.25))
|
||||
var yards: Array[float] = [height * 0.36, height * 0.66, height * 0.92]
|
||||
var spans: Array[float] = [4.6, 3.8, 2.8]
|
||||
for level: int in yards.size():
|
||||
var y: float = yards[level]
|
||||
var half: float = spans[level]
|
||||
_line(tool, Vector3(-half, y, z + 0.3), Vector3(half, y, z + 0.3), 0.2, Palette.TAR)
|
||||
for level: int in 2:
|
||||
var y_top: float = yards[level + 1]
|
||||
var y_foot: float = yards[level] + 0.25
|
||||
var half_top: float = spans[level + 1]
|
||||
var half_foot: float = spans[level]
|
||||
# The sail bellies forward in the middle: three panels across, the middle one
|
||||
# further out.
|
||||
var columns: int = 4
|
||||
for column: int in columns:
|
||||
var u0: float = float(column) / columns * 2.0 - 1.0
|
||||
var u1: float = float(column + 1) / columns * 2.0 - 1.0
|
||||
var belly0: float = 0.55 + 0.9 * (1.0 - u0 * u0)
|
||||
var belly1: float = 0.55 + 0.9 * (1.0 - u1 * u1)
|
||||
var colour: Color = Palette.TANNED_SAIL if column % 2 == 0 else Palette.TANNED_SAIL.lightened(0.08)
|
||||
_quad(tool,
|
||||
Vector3(u0 * half_top, y_top, z + 0.45), Vector3(u1 * half_top, y_top, z + 0.45),
|
||||
Vector3(u1 * half_foot, y_foot, z + belly1), Vector3(u0 * half_foot, y_foot, z + belly0), colour)
|
||||
if level == 0:
|
||||
# An ochre band across the lower sail, a little above its foot.
|
||||
var yb: float = lerpf(y_foot, y_top, 0.2)
|
||||
var yb2: float = lerpf(y_foot, y_top, 0.3)
|
||||
var hb: float = lerpf(half_foot, half_top, 0.2)
|
||||
var hb2: float = lerpf(half_foot, half_top, 0.3)
|
||||
_quad(tool, Vector3(-hb2, yb2, z + 1.42), Vector3(hb2, yb2, z + 1.42), Vector3(hb, yb, z + 1.47), Vector3(-hb, yb, z + 1.47), Palette.OCHRE_RED)
|
||||
# Shrouds from the top of the lower sail to each rail.
|
||||
for side: float in [-1.0, 1.0]:
|
||||
for step: float in [-0.8, 0.0, 0.8]:
|
||||
_line(tool, Vector3(side * (HULL_HALF_BREADTH - 0.3), 0.7, z + step - 0.6), Vector3(0.0, yards[1], z), 0.05, Palette.TAR)
|
||||
if stay_to != Vector3.INF:
|
||||
_line(tool, top, stay_to, 0.06, Palette.TAR)
|
||||
|
||||
|
||||
## The lifeline mortar: a squat tarred barrel with gilt bands on a timber bed, cocked up
|
||||
## towards +x, and a coil of line beside it.
|
||||
static func _mortar(tool: SurfaceTool) -> void:
|
||||
var at: Vector3 = MORTAR_AT
|
||||
PieceMesher.add_box(tool, AABB(at + Vector3(-0.8, 0.0, -0.7), Vector3(1.6, 0.45, 1.4)), Palette.PLANK.darkened(0.2))
|
||||
var breech: Vector3 = at + MORTAR_BREECH
|
||||
var aim: Vector3 = MORTAR_AIM.normalized()
|
||||
_line(tool, breech, breech + aim * MORTAR_LENGTH, 0.72, Palette.TAR)
|
||||
for band: float in [0.25, 0.95]:
|
||||
_line(tool, breech + aim * band, breech + aim * (band + 0.12), 0.8, Palette.GILT)
|
||||
# A coil of line on the deck behind it, as a ring of short segments.
|
||||
var coil: Vector3 = at + Vector3(-1.6, 0.18, 0.9)
|
||||
for turn: int in 3:
|
||||
var radius: float = 0.55 - turn * 0.1
|
||||
var segments: int = 10
|
||||
for segment: int in segments:
|
||||
var a0: float = TAU * segment / segments
|
||||
var a1: float = TAU * (segment + 1) / segments
|
||||
var p0: Vector3 = coil + Vector3(cos(a0) * radius, turn * 0.07, sin(a0) * radius)
|
||||
var p1: Vector3 = coil + Vector3(cos(a1) * radius, turn * 0.07, sin(a1) * radius)
|
||||
_line(tool, p0, p1, 0.09, Palette.CANVAS.darkened(0.15))
|
||||
|
||||
|
||||
## The middle of the mortar's muzzle, in the ship model's own space.
|
||||
static func muzzle() -> Vector3:
|
||||
return MORTAR_AT + MORTAR_BREECH + MORTAR_AIM.normalized() * MORTAR_LENGTH
|
||||
|
||||
|
||||
## A length of lifeline: a square cord LIFELINE_WIDTH thick and one metre long along
|
||||
## -z, centred on the origin, for EntityView to stretch between the mortar and a player.
|
||||
static func lifeline() -> ArrayMesh:
|
||||
var tool: SurfaceTool = SurfaceTool.new()
|
||||
tool.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
_line(tool, Vector3(0.0, 0.0, 0.5), Vector3(0.0, 0.0, -0.5), LIFELINE_WIDTH, Palette.CANVAS.darkened(0.15))
|
||||
tool.generate_normals()
|
||||
var mesh: ArrayMesh = tool.commit()
|
||||
mesh.surface_set_material(0, _material(0.9))
|
||||
return mesh
|
||||
|
||||
|
||||
static func chest() -> ArrayMesh:
|
||||
var tool: SurfaceTool = SurfaceTool.new()
|
||||
tool.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
@@ -89,65 +187,56 @@ static func chest() -> ArrayMesh:
|
||||
return mesh
|
||||
|
||||
|
||||
## The hull as rings of five points (rail, bilge, keel, bilge, rail) along z. Returns
|
||||
## the rings, for the rails.
|
||||
## The hull as rings of seven points along z: rail, boot-top, waterline, keel and back
|
||||
## up the other side (indices 0 to 6), with the deck at y = 0 and the sea at
|
||||
## -SHIP_DECK_HEIGHT. Returns the rings, for the rails.
|
||||
static func _hull(tool: SurfaceTool) -> Array[PackedVector3Array]:
|
||||
var stations: int = 12
|
||||
var stations: int = 16
|
||||
var water: float = -Tuning.SHIP_DECK_HEIGHT
|
||||
var rings: Array[PackedVector3Array] = []
|
||||
for station: int in stations + 1:
|
||||
var t: float = float(station) / stations * 2.0 - 1.0
|
||||
var z: float = t * HULL_HALF_LENGTH
|
||||
var breadth: float = HULL_HALF_BREADTH * sqrt(maxf(1.0 - pow(absf(t), 4.0), 0.015))
|
||||
var keel: float = -HULL_DEPTH * (1.0 - 0.55 * pow(absf(t), 3.0))
|
||||
var sheer: float = 0.25 * t * t
|
||||
var breadth: float = HULL_HALF_BREADTH * sqrt(maxf(1.0 - pow(absf(t), 3.0), 0.01))
|
||||
var keel: float = -HULL_DEPTH * (1.0 - 0.3 * pow(absf(t), 3.0))
|
||||
var sheer: float = _sheer(t)
|
||||
var ring: PackedVector3Array = PackedVector3Array([
|
||||
Vector3(-breadth, sheer, z), Vector3(-breadth * 0.8, keel * 0.6, z), Vector3(0.0, keel, z),
|
||||
Vector3(breadth * 0.8, keel * 0.6, z), Vector3(breadth, sheer, z),
|
||||
Vector3(-breadth, sheer, z),
|
||||
Vector3(-breadth * 0.97, water + 0.6, z),
|
||||
Vector3(-breadth * 0.93, water, z),
|
||||
Vector3(0.0, keel, z),
|
||||
Vector3(breadth * 0.93, water, z),
|
||||
Vector3(breadth * 0.97, water + 0.6, z),
|
||||
Vector3(breadth, sheer, z),
|
||||
])
|
||||
rings.append(ring)
|
||||
for station: int in stations:
|
||||
for side: int in 4:
|
||||
var colour: Color = Palette.TAR if side == 1 or side == 2 else Palette.TAR_WEATHERED
|
||||
# A painted strake under the rail, every other station a shade lighter.
|
||||
if side == 0 or side == 3:
|
||||
for side: int in 6:
|
||||
var colour: Color = Palette.TAR_WEATHERED
|
||||
if side == 1 or side == 4:
|
||||
colour = Palette.SALT
|
||||
elif side == 2 or side == 3:
|
||||
colour = Palette.TAR
|
||||
else:
|
||||
# The topsides, a painted strake every other station a shade lighter.
|
||||
colour = PieceMesher.tint(colour, station * 7 + side)
|
||||
_quad(tool, rings[station][side], rings[station][side + 1], rings[station + 1][side + 1], rings[station + 1][side], colour)
|
||||
# Transom and stem: close the ends.
|
||||
for end: int in [0, stations]:
|
||||
var ring: PackedVector3Array = rings[end]
|
||||
for side: int in 3:
|
||||
_quad(tool, ring[side], ring[side + 1], ring[5 - side], ring[6 - side], Palette.TAR)
|
||||
# Rubbing strake: an ochre band along the top of the hull.
|
||||
for station: int in stations:
|
||||
for side: int in [0, 4]:
|
||||
for side: int in [0, 6]:
|
||||
var a: Vector3 = rings[station][side]
|
||||
var b: Vector3 = rings[station + 1][side]
|
||||
var out: float = 0.04 * signf(a.x) if absf(a.x) > 0.01 else 0.0
|
||||
var drop: Vector3 = Vector3(0.0, -0.22, 0.0)
|
||||
_quad(tool, a + Vector3(out, 0.0, 0.0), b + Vector3(out, 0.0, 0.0), b + drop + Vector3(out, 0.0, 0.0), a + drop + Vector3(out, 0.0, 0.0), Palette.OCHRE_RED)
|
||||
var out: Vector3 = Vector3(0.04 * signf(a.x), 0.0, 0.0)
|
||||
var drop: Vector3 = Vector3(0.0, -0.3, 0.0)
|
||||
_quad(tool, a + out, b + out, b + drop + out, a + drop + out, Palette.OCHRE_RED)
|
||||
return rings
|
||||
|
||||
|
||||
## The envelope: an ellipsoid of gores along z, alternately canvas and tanned, with an
|
||||
## ochre band round its middle.
|
||||
static func _envelope(tool: SurfaceTool) -> void:
|
||||
var centre: Vector3 = Vector3(0.0, ENVELOPE_HEIGHT, 0.0)
|
||||
var rings: Array[PackedVector3Array] = []
|
||||
for ring: int in ENVELOPE_RINGS + 1:
|
||||
var phi: float = PI * float(ring) / ENVELOPE_RINGS
|
||||
var z: float = -cos(phi) * ENVELOPE_AXES.z
|
||||
var r: float = sin(phi)
|
||||
var points: PackedVector3Array = PackedVector3Array()
|
||||
for side: int in ENVELOPE_SIDES + 1:
|
||||
var theta: float = TAU * float(side) / ENVELOPE_SIDES
|
||||
points.append(centre + Vector3(cos(theta) * r * ENVELOPE_AXES.x, sin(theta) * r * ENVELOPE_AXES.y, z))
|
||||
rings.append(points)
|
||||
var middle: int = ENVELOPE_RINGS / 2
|
||||
tool.set_smooth_group(1)
|
||||
for ring: int in ENVELOPE_RINGS:
|
||||
for side: int in ENVELOPE_SIDES:
|
||||
var colour: Color = Palette.CANVAS if (side / 2) % 2 == 0 else Palette.TANNED_SAIL.lightened(0.15)
|
||||
if ring == middle or ring == middle - 1:
|
||||
colour = Palette.OCHRE_RED
|
||||
_quad(tool, rings[ring][side], rings[ring][side + 1], rings[ring + 1][side + 1], rings[ring + 1][side], colour)
|
||||
tool.set_smooth_group(-1)
|
||||
|
||||
|
||||
## A square line `width` thick from `a` to `b`.
|
||||
static func _line(tool: SurfaceTool, a: Vector3, b: Vector3, width: float, colour: Color) -> void:
|
||||
var along: Vector3 = (b - a).normalized()
|
||||
|
||||
@@ -31,6 +31,8 @@ const WINDOW_MODES: Array[String] = ["Windowed", "Fullscreen", "Exclusive fullsc
|
||||
## Frame caps offered, 0 for none.
|
||||
const FRAME_CAPS: Array[int] = [0, 30, 60, 90, 120, 144, 165, 240]
|
||||
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 mouse: InputSettings = InputSettings.new()
|
||||
@@ -71,6 +73,29 @@ var practice_bots: int = Tuning.SOLO_PLAYERS - 1:
|
||||
var practice_difficulty: int = -1:
|
||||
set(value):
|
||||
practice_difficulty = clampi(value, -1, Tuning.BOT_DIFFICULTIES.size() - 1)
|
||||
## Practice solo (1) or in duos with a bot teammate (Tuning.DUO_TEAM_SIZE), M7.
|
||||
var practice_team_size: int = 1:
|
||||
set(value):
|
||||
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:
|
||||
@@ -102,9 +127,7 @@ func apply_to_viewport(viewport: Viewport) -> void:
|
||||
func save(path: String = DEFAULT_PATH) -> Error:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
# The mouse keeps its own section, as InputSettings has always saved it.
|
||||
config.set_value(InputSettings.SECTION, "mouse_sensitivity", mouse.mouse_sensitivity)
|
||||
config.set_value(InputSettings.SECTION, "aim_sensitivity_scale", mouse.aim_sensitivity_scale)
|
||||
config.set_value(InputSettings.SECTION, "invert_y", mouse.invert_y)
|
||||
mouse.write(config)
|
||||
bindings.write(config)
|
||||
config.set_value("graphics", "quality", quality)
|
||||
config.set_value("graphics", "print_pass", print_pass)
|
||||
@@ -118,6 +141,13 @@ func save(path: String = DEFAULT_PATH) -> Error:
|
||||
config.set_value("player", "last_server", last_server)
|
||||
config.set_value("practice", "bots", practice_bots)
|
||||
config.set_value("practice", "difficulty", practice_difficulty)
|
||||
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)
|
||||
|
||||
|
||||
@@ -144,6 +174,13 @@ static func load_from(path: String = DEFAULT_PATH) -> GameSettings:
|
||||
settings.last_server = String(server_value).strip_edges().left(255)
|
||||
settings.practice_bots = _int(config, "practice", "bots", settings.practice_bots)
|
||||
settings.practice_difficulty = _int(config, "practice", "difficulty", settings.practice_difficulty)
|
||||
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
|
||||
|
||||
|
||||
@@ -152,6 +189,9 @@ static func load_from(path: String = DEFAULT_PATH) -> GameSettings:
|
||||
## when there is none.
|
||||
func apply_to_program(tree: SceneTree) -> void:
|
||||
_apply_audio()
|
||||
Palette.vision = vision
|
||||
if tree != null:
|
||||
tree.root.content_scale_factor = ui_scale
|
||||
if DisplayServer.get_name() == "headless":
|
||||
return
|
||||
Engine.max_fps = max_fps
|
||||
|
||||
@@ -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()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cx1cgtph7dshj
|
||||
@@ -1,6 +1,6 @@
|
||||
## The island as a hand-drawn nautical chart (A11): paper land with ink contours every
|
||||
## CONTOUR_METRES, a heavier coastline, the sea in the sea's ink, place names, the
|
||||
## barge's route, the player's own mark, and the tide forecast: land the coming tide
|
||||
## ship's route, the player's own mark, and the tide forecast: land the coming tide
|
||||
## will flood is hatched, and land the sea has already taken is washed with the sea.
|
||||
##
|
||||
## The forecast comes from the client's own Flood (Flood.forecast), the same spreading
|
||||
@@ -28,7 +28,7 @@ var mode: Mode = Mode.FULL
|
||||
var world: Simulation = null
|
||||
## Place names and where they are, in world metres (x, z).
|
||||
var places: Array[Dictionary] = []
|
||||
## The barge's route ends, in world metres (x, z), or empty when there's no drop.
|
||||
## The ship's route ends, in world metres (x, z), or empty when there's no drop.
|
||||
var route: PackedVector2Array = PackedVector2Array()
|
||||
## The player: position (x, z) in metres, facing (radians, the simulation's yaw), and
|
||||
## whether to draw them.
|
||||
@@ -54,7 +54,7 @@ func _init(chart_mode: Mode = Mode.FULL) -> void:
|
||||
|
||||
|
||||
## Draws the chart of `simulation`'s island and names its places from `match_seed`.
|
||||
## `drop` is the match's barge route, or null. `share` is another ChartMap already set
|
||||
## `drop` is the match's ship route, or null. `share` is another ChartMap already set
|
||||
## up for the same world, whose paper and contours are used rather than drawn again.
|
||||
func setup(simulation: Simulation, match_seed: int, drop: Drop = null, share: ChartMap = null) -> void:
|
||||
world = simulation
|
||||
@@ -174,8 +174,8 @@ func _draw_overlay() -> void:
|
||||
var coming: PackedByteArray = coming_flood(world)
|
||||
var per_cell: int = maxi(roundi(PIXELS / float(flood.side)), 1)
|
||||
var taken: Color = Color(Palette.SEA_INK.lightened(0.3), 0.7)
|
||||
var hatch: Color = Color(Palette.WARNING, 0.95)
|
||||
var wash: Color = Color(Palette.WARNING, 0.16)
|
||||
var hatch: Color = Color(Palette.warning(), 0.95)
|
||||
var wash: Color = Color(Palette.warning(), 0.16)
|
||||
for cz: int in flood.side:
|
||||
for cx: int in flood.side:
|
||||
var index: int = cz * flood.side + cx
|
||||
@@ -241,7 +241,7 @@ func _draw() -> void:
|
||||
var ahead: Vector2 = Vector2(sin(facing), cos(facing))
|
||||
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])
|
||||
draw_colored_polygon(arrow, Palette.OILSKIN)
|
||||
draw_colored_polygon(arrow, Palette.own())
|
||||
arrow.append(arrow[0])
|
||||
draw_polyline(arrow, Palette.INK, 2.0)
|
||||
# North, and the frame's ink edge.
|
||||
|
||||
+84
-12
@@ -14,6 +14,8 @@ const FONT_SMALL: int = 13
|
||||
const FONT_BODY: int = 16
|
||||
const FONT_TITLE: int = 22
|
||||
const MARGIN: float = 18.0
|
||||
## Shown while downed in duos (M7).
|
||||
const DOWN_TEXT: String = "DOWN · bleeding out · crawl to your crewmate, who can haul you up with interact"
|
||||
|
||||
var state: HudState = HudState.new()
|
||||
|
||||
@@ -24,8 +26,12 @@ var _vitals: Vitals
|
||||
var _hotbar: HBoxContainer
|
||||
var _materials: VBoxContainer
|
||||
var _build: Label
|
||||
## Down in duos (M7): what to do about it, above the hotbar.
|
||||
var _down: Label
|
||||
var _reticle: Reticle
|
||||
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.
|
||||
var _feed_seen: Dictionary = {}
|
||||
## Captures turn this off to keep every line of the feed.
|
||||
@@ -77,11 +83,13 @@ func _init() -> void:
|
||||
add_child(_vitals)
|
||||
|
||||
_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.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
_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)
|
||||
|
||||
_build = _label(FONT_BODY, Palette.PAPER)
|
||||
@@ -90,6 +98,14 @@ func _init() -> void:
|
||||
_build.size = Vector2(520.0, 24.0)
|
||||
_build.position = Vector2(-260.0, -112.0 - MARGIN - 30.0)
|
||||
add_child(_build)
|
||||
_down = _label(FONT_BODY, Palette.warning())
|
||||
_down.set_anchors_preset(Control.PRESET_CENTER_BOTTOM)
|
||||
_down.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
_down.size = Vector2(720.0, 24.0)
|
||||
_down.position = Vector2(-360.0, -112.0 - MARGIN - 30.0)
|
||||
_down.text = DOWN_TEXT
|
||||
_down.visible = false
|
||||
add_child(_down)
|
||||
|
||||
_materials = VBoxContainer.new()
|
||||
_materials.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
@@ -97,9 +113,23 @@ func _init() -> void:
|
||||
_materials.position = Vector2(-190.0 - MARGIN, -84.0 - MARGIN)
|
||||
_materials.add_theme_constant_override("separation", 2)
|
||||
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)
|
||||
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_RESIZED and _hotbar != null:
|
||||
_fit_bottom()
|
||||
|
||||
|
||||
## Shows `shown`, and nothing that isn't in it.
|
||||
func show_state(shown: HudState) -> void:
|
||||
state = shown
|
||||
@@ -122,7 +152,7 @@ func show_state(shown: HudState) -> void:
|
||||
for index: int in lines.size():
|
||||
var label: Label = _feed.get_child(index) as Label
|
||||
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():
|
||||
_feed_seen.clear()
|
||||
|
||||
@@ -143,6 +173,7 @@ func show_state(shown: HudState) -> void:
|
||||
var box: SlotBox = SlotBox.new()
|
||||
box.custom_minimum_size = Vector2(86.0, 112.0)
|
||||
_hotbar.add_child(box)
|
||||
_fit_bottom()
|
||||
for index: int in _hotbar.get_child_count():
|
||||
var box: SlotBox = _hotbar.get_child(index) as SlotBox
|
||||
box.visible = index < shown.slots.size()
|
||||
@@ -157,12 +188,53 @@ func show_state(shown: HudState) -> void:
|
||||
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]
|
||||
|
||||
_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.add_theme_color_override("font_color", Palette.warning())
|
||||
_build.visible = shown.playing and not shown.build.is_empty()
|
||||
if _build.visible:
|
||||
var build: Dictionary = shown.build
|
||||
_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"]
|
||||
_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.
|
||||
@@ -249,12 +321,12 @@ class TidePost:
|
||||
# The next level: a rust notch cut into both sides, with a dashed line across.
|
||||
if next > sea + 0.05:
|
||||
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_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_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())
|
||||
# The player's own height: a yellow pointer on the right of the post.
|
||||
if not is_nan(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)
|
||||
|
||||
var x: float = post.end.x + 26.0
|
||||
@@ -272,12 +344,12 @@ class TidePost:
|
||||
timing = "HIGH WATER · last land"
|
||||
_:
|
||||
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)
|
||||
if not is_nan(feet):
|
||||
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
|
||||
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
|
||||
@@ -301,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)
|
||||
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 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)
|
||||
if striped or low:
|
||||
# Armour is hatched one way; low health the other.
|
||||
@@ -357,7 +429,7 @@ class SlotBox:
|
||||
return
|
||||
Hud.draw_card(self, rect, 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)
|
||||
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", "")))
|
||||
@@ -437,7 +509,7 @@ class HurtEdge:
|
||||
for step: int in steps:
|
||||
var inset: float = band * 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
|
||||
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)
|
||||
|
||||
@@ -25,12 +25,16 @@ var standing: int = 0
|
||||
var total: int = 0
|
||||
## Lines for the kill feed, oldest first: {"text", "you"}.
|
||||
var feed: Array[Dictionary] = []
|
||||
## Down in duos (M7): crawling, bleeding, waiting for a crewmate to haul them up.
|
||||
var downed: bool = false
|
||||
## True when the aiming reticle is shown: playing, on foot or swimming.
|
||||
var reticle: bool = false
|
||||
## Hit feedback (A7, HitFeedback): the marker for a shot that struck someone and the
|
||||
## flash for being hurt, each 1 just after and 0 when gone.
|
||||
var hit: 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.
|
||||
@@ -50,9 +54,11 @@ static func from_client(game: ClientGame, input: ClientInput, own_handle: int, f
|
||||
state.playing = true
|
||||
state.health = drawn.health if drawn != null else me.health
|
||||
state.armor = drawn.armor if drawn != null else me.armor
|
||||
state.reticle = me.drop_state == Drop.NONE
|
||||
state.reticle = me.drop_state == Drop.NONE and not me.downed
|
||||
state.downed = me.downed
|
||||
_fill_carried(state, me)
|
||||
state.build = build_of(input.build_mode, input.build_kind, input.material, me.materials)
|
||||
if not me.downed:
|
||||
state.build = build_of(input.build_mode, input.build_kind, input.material, me.materials)
|
||||
return state
|
||||
|
||||
|
||||
@@ -78,9 +84,11 @@ static func from_match(flow: Match, handle: int, build_mode: bool = false, build
|
||||
state.playing = true
|
||||
state.health = me.health
|
||||
state.armor = me.armor
|
||||
state.reticle = me.drop_state == Drop.NONE
|
||||
state.reticle = me.drop_state == Drop.NONE and not me.downed
|
||||
state.downed = me.downed
|
||||
_fill_carried(state, me)
|
||||
state.build = build_of(build_mode, build_kind, material, me.materials)
|
||||
if not me.downed:
|
||||
state.build = build_of(build_mode, build_kind, material, me.materials)
|
||||
return state
|
||||
|
||||
|
||||
@@ -112,7 +120,10 @@ static func feed_lines(entries: Array[Dictionary], own_handle: int) -> Array[Dic
|
||||
var by_is_you: bool = int(entry.get("by", 0)) == own_handle and own_handle != 0
|
||||
var victim: String = "You" if victim_is_you else String(entry.get("victim_name", "Someone"))
|
||||
var by: String = "You" if by_is_you else String(entry.get("by_name", ""))
|
||||
lines.append({"text": feed_text(victim, by, String(entry.get("cause", "none")), int(entry.get("item", -1)), victim_is_you), "you": victim_is_you or by_is_you})
|
||||
var text: String = feed_text(victim, by, String(entry.get("cause", "none")), int(entry.get("item", -1)), victim_is_you)
|
||||
if bool(entry.get("downed", false)):
|
||||
text = downed_text(victim, by, victim_is_you)
|
||||
lines.append({"text": text, "you": victim_is_you or by_is_you})
|
||||
return lines
|
||||
|
||||
|
||||
@@ -136,6 +147,13 @@ static func feed_text(victim: String, by: String, cause: String, item: int, vict
|
||||
return "%s is out" % victim
|
||||
|
||||
|
||||
## A down in duos (M7): the player isn't out until they bleed out or their team falls.
|
||||
static func downed_text(victim: String, by: String, victim_is_you: bool) -> String:
|
||||
if not by.is_empty() and by != victim:
|
||||
return "%s knocked %s down" % [by, "you" if victim_is_you else victim]
|
||||
return "%s %s down" % [victim, "are" if victim_is_you else "is"]
|
||||
|
||||
|
||||
## "flintlock_pistol" -> "Flintlock Pistol".
|
||||
static func item_name(id: String) -> String:
|
||||
return id.replace("_", " ").capitalize()
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://dimljb3jidhs8
|
||||
@@ -10,6 +10,8 @@ const MIN_SENSITIVITY: float = 0.05
|
||||
const MAX_SENSITIVITY: float = 10.0
|
||||
## Looking straight up or down flips the camera basis, so stop just short.
|
||||
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:
|
||||
set(value):
|
||||
@@ -19,6 +21,12 @@ var aim_sensitivity_scale: float = 0.6:
|
||||
set(value):
|
||||
aim_sensitivity_scale = clampf(value, 0.1, 2.0)
|
||||
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.
|
||||
@@ -33,13 +41,33 @@ func apply_mouse(relative: Vector2, yaw: float, pitch: float, aiming: bool) -> V
|
||||
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:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
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, "aim_sensitivity_scale", aim_sensitivity_scale)
|
||||
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.
|
||||
@@ -57,4 +85,10 @@ static func load_from(path: String = DEFAULT_PATH) -> InputSettings:
|
||||
var invert: Variant = config.get_value(SECTION, "invert_y", false)
|
||||
if invert is bool:
|
||||
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
|
||||
|
||||
@@ -27,10 +27,11 @@ var effects: EffectsView
|
||||
|
||||
|
||||
## Applies the player's graphics settings: the sun's shadows and the print pass.
|
||||
## Under the OpenGL fallback the sun never casts shadows (Look.sun_shadows_supported).
|
||||
func apply_settings(settings: GameSettings) -> void:
|
||||
var distance: float = settings.shadow_distance()
|
||||
if sun != null:
|
||||
sun.shadow_enabled = distance > 0.0
|
||||
sun.shadow_enabled = distance > 0.0 and Look.sun_shadows_supported()
|
||||
sun.directional_shadow_max_distance = maxf(distance, 1.0)
|
||||
var splits: Dictionary = {1: DirectionalLight3D.SHADOW_ORTHOGONAL, 2: DirectionalLight3D.SHADOW_PARALLEL_2_SPLITS, 4: DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS}
|
||||
sun.directional_shadow_mode = splits.get(settings.shadow_splits(), DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS)
|
||||
@@ -38,6 +39,7 @@ func apply_settings(settings: GameSettings) -> void:
|
||||
print_pass.visible = settings.print_pass
|
||||
if effects != null:
|
||||
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.
|
||||
@@ -120,7 +122,7 @@ func follow(entity_id: int, pitch: float = NAN, look_yaw: float = NAN) -> bool:
|
||||
return false
|
||||
var yaw: float = look_yaw if not is_nan(look_yaw) else float(player.yaw) / PlayerCommand.YAW_STEPS * TAU
|
||||
var look_pitch: float = pitch if not is_nan(pitch) else float(player.pitch) / PlayerCommand.PITCH_MAX * (PI * 0.5)
|
||||
# Where the figure is drawn: on the barge's deck that is its own place, not the
|
||||
# Where the figure is drawn: on the ship's deck that is its own place, not the
|
||||
# one point the simulation carries every passenger at.
|
||||
var feet: Vector3 = player.position
|
||||
var figure: Node3D = entities.figure_of(entity_id)
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bftj1asrutyll
|
||||
@@ -40,16 +40,28 @@ static func environment(graded: bool = true) -> Environment:
|
||||
return environment
|
||||
|
||||
|
||||
## The low afternoon sun from the sea side.
|
||||
## The low afternoon sun from the sea side. It casts shadows only where the renderer
|
||||
## draws them correctly (sun_shadows_supported).
|
||||
static func sun(shadow_distance: float = 400.0) -> DirectionalLight3D:
|
||||
var light: DirectionalLight3D = DirectionalLight3D.new()
|
||||
light.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
|
||||
light.light_energy = 0.95
|
||||
light.shadow_enabled = true
|
||||
light.shadow_enabled = sun_shadows_supported()
|
||||
light.directional_shadow_max_distance = shadow_distance
|
||||
return light
|
||||
|
||||
|
||||
## Whether `rendering_method` draws the sun's shadows without changing the colours (H14).
|
||||
## Godot's Compatibility renderer (the OpenGL fallback) draws a shadowed directional
|
||||
## light in a pass of its own and adds it to the frame after the frame is already in
|
||||
## sRGB, so a sunlit pixel comes out as srgb(ambient) + srgb(sun) instead of
|
||||
## srgb(ambient + sun): sunlit ground and rocks turn pale. Measured on llvmpipe, the
|
||||
## sum matches to within one level in 255. No project or environment setting changes
|
||||
## it, so under that renderer the sun casts no shadows, as on the Low preset.
|
||||
static func sun_shadows_supported(rendering_method: String = RenderingServer.get_current_rendering_method()) -> bool:
|
||||
return rendering_method != "gl_compatibility"
|
||||
|
||||
|
||||
## Adds the woodcut print pass to `camera`, as a full-screen quad drawn after
|
||||
## everything else. Returns the quad, whose material takes `sea_level` (see
|
||||
## set_sea_level) and `strength`.
|
||||
|
||||
@@ -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)
|
||||
## The sea on the HUD's tide gauge and map.
|
||||
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"]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
## packets to receive() and sends whatever advance() leaves in `outbox`.
|
||||
##
|
||||
## The client generates the match's island itself from the seed in the MATCH notice
|
||||
## (`world`, a Simulation that is never stepped) and plans the same barge route, so it
|
||||
## (`world`, a Simulation that is never stepped) and plans the same ship route, so it
|
||||
## can run the same movement code as the server on the same ground. WORLD messages keep
|
||||
## that world's built pieces, props, chests and tide in line with the server's, and OWN
|
||||
## messages say what the player carries (`replica`, a ClientWorld). Pieces the player
|
||||
@@ -322,7 +322,7 @@ func _take_snapshot() -> void:
|
||||
_recent.clear()
|
||||
return
|
||||
if not prediction.active:
|
||||
# The barge's route is drawn from the seed alone, at the match's first tick.
|
||||
# The ship's route is drawn from the seed alone, at the match's first tick.
|
||||
prediction.begin(world.ground, Drop.plan(world.ground, SimRng.new(world_seed), 0))
|
||||
clock.start(receiver.sim_tick)
|
||||
clock.observe(receiver.sim_tick, receiver.command_tick)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
## pieces, props, chests and tide in line with the server. This adds the rest of the
|
||||
## picture, afresh every frame: every entity the server has told this client about,
|
||||
## where it is being drawn now (everyone else from the recent past, the client's own
|
||||
## player where it was predicted), the barge, the clock and the sea level. Nothing
|
||||
## player where it was predicted), the ship, the clock and the sea level. Nothing
|
||||
## here is authoritative, and nothing reads it back but views and the client's own
|
||||
## check before placing a piece.
|
||||
class_name ClientMirror
|
||||
@@ -16,8 +16,8 @@ extends RefCounted
|
||||
var watched_id: int = 0
|
||||
## The client's own player while it is in the match, or 0.
|
||||
var own_id: int = 0
|
||||
## Where the barge is being drawn, or Vector3.INF when it isn't crossing.
|
||||
var barge_at: Vector3 = Vector3.INF
|
||||
## Where the ship is being drawn, or Vector3.INF when it isn't crossing.
|
||||
var ship_at: Vector3 = Vector3.INF
|
||||
## The moment being drawn, in simulation ticks.
|
||||
var time: float = 0.0
|
||||
|
||||
@@ -35,7 +35,7 @@ func sync(game: ClientGame) -> void:
|
||||
var world: Simulation = game.world
|
||||
watched_id = 0
|
||||
own_id = 0
|
||||
barge_at = Vector3.INF
|
||||
ship_at = Vector3.INF
|
||||
if world == null:
|
||||
return
|
||||
var receiver: SnapshotReceiver = game.receiver
|
||||
@@ -60,7 +60,7 @@ func sync(game: ClientGame) -> void:
|
||||
_drop.finished = _drop.is_over(world.tick)
|
||||
world.drop = _drop
|
||||
if not _drop.finished:
|
||||
barge_at = _drop.barge_position(world.tick).lerp(_drop.barge_position(world.tick + 1), time - floorf(time))
|
||||
ship_at = _drop.ship_position(world.tick).lerp(_drop.ship_position(world.tick + 1), time - floorf(time))
|
||||
else:
|
||||
world.drop = null
|
||||
|
||||
@@ -147,14 +147,15 @@ func _show_player(entity: SimEntity, record: PackedInt32Array, shown: Dictionary
|
||||
entity.crouching = flags & NetSnapshot.FLAG_CROUCHING != 0
|
||||
entity.swimming = flags & NetSnapshot.FLAG_SWIMMING != 0
|
||||
entity.eliminated = flags & NetSnapshot.FLAG_ELIMINATED != 0
|
||||
entity.downed = flags & NetSnapshot.FLAG_DOWNED != 0
|
||||
entity.drop_state = (flags >> NetSnapshot.FLAG_DROP_SHIFT) & 3
|
||||
# Only whether they last, for drawing: the ticks left aren't replicated.
|
||||
entity.reload_ticks = 1 if flags & NetSnapshot.FLAG_RELOADING != 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.
|
||||
entity.item = record[NetSnapshot.R_HELD] - 1
|
||||
if entity.drop_state == Drop.ABOARD and barge_at != Vector3.INF:
|
||||
entity.position = barge_at
|
||||
if entity.drop_state == Drop.ABOARD and ship_at != Vector3.INF:
|
||||
entity.position = ship_at
|
||||
|
||||
|
||||
## The client's own player: where and how it was predicted, not where the server last
|
||||
@@ -171,5 +172,5 @@ func _show_own(entity: SimEntity, game: ClientGame) -> void:
|
||||
entity.velocity = me.velocity
|
||||
entity.reload_ticks = me.reload_ticks
|
||||
entity.use_ticks = me.use_ticks
|
||||
if me.drop_state == Drop.ABOARD and barge_at != Vector3.INF:
|
||||
entity.position = barge_at
|
||||
if me.drop_state == Drop.ABOARD and ship_at != Vector3.INF:
|
||||
entity.position = ship_at
|
||||
|
||||
@@ -15,7 +15,7 @@ class_name ClientPrediction
|
||||
extends RefCounted
|
||||
|
||||
## The flags movement reads and changes.
|
||||
const _MOVEMENT_FLAGS: int = NetSnapshot.FLAG_ON_GROUND | NetSnapshot.FLAG_SWIMMING | NetSnapshot.FLAG_ELIMINATED | (3 << NetSnapshot.FLAG_DROP_SHIFT)
|
||||
const _MOVEMENT_FLAGS: int = NetSnapshot.FLAG_ON_GROUND | NetSnapshot.FLAG_SWIMMING | NetSnapshot.FLAG_ELIMINATED | NetSnapshot.FLAG_DOWNED | (3 << NetSnapshot.FLAG_DROP_SHIFT)
|
||||
## Predicted ticks kept to compare with the server: four seconds.
|
||||
const HISTORY_TICKS: int = 120
|
||||
|
||||
@@ -157,7 +157,7 @@ func _run(tick: int) -> void:
|
||||
return
|
||||
_drop.ride(player, command, tick)
|
||||
if player.drop_state == Drop.ABOARD and _drop.is_over(tick + 1):
|
||||
_drop.leap(player, tick + 1)
|
||||
_drop.fire_at_end(player, tick + 1)
|
||||
return
|
||||
var water: float = _water_at(player.position)
|
||||
Movement.step(player, command, _ground, water)
|
||||
|
||||
+7
-4
@@ -7,7 +7,8 @@
|
||||
## server -> FEED
|
||||
## u8 type, u8 standing, u8 players in the match, u8 entry count, then entries:
|
||||
## s32 victim handle, s32 eliminator handle (0 = none), u8 cause (CAUSES),
|
||||
## u8 item code plus one (0 = none), u8 place, u8 flags (1 = tied),
|
||||
## u8 item code plus one (0 = none), u8 place, u8 flags (1 = tied, 2 = downed,
|
||||
## not out: duos, M7),
|
||||
## str victim name, str eliminator name,
|
||||
## where str is u8 byte length then that many UTF-8 bytes (at most MAX_NAME_BYTES).
|
||||
##
|
||||
@@ -23,11 +24,12 @@ const ENTRY_FIXED_BYTES: int = 12
|
||||
const MAX_ENTRIES: int = 16
|
||||
const MAX_NAME_BYTES: int = 32
|
||||
const FLAG_TIED: int = 1
|
||||
const FLAG_DOWNED: int = 2
|
||||
|
||||
|
||||
## Encodes the count and `entries`, newest last. Each entry has "victim", "by",
|
||||
## "cause" (a name in CAUSES), "item" (-1 none), "place", "tied", "victim_name" and
|
||||
## "by_name". Only the newest MAX_ENTRIES are kept.
|
||||
## "cause" (a name in CAUSES), "item" (-1 none), "place", "tied", "downed", "victim_name"
|
||||
## and "by_name". Only the newest MAX_ENTRIES are kept.
|
||||
static func encode(standing: int, total: int, entries: Array[Dictionary]) -> PackedByteArray:
|
||||
var out: StreamPeerBuffer = StreamPeerBuffer.new()
|
||||
out.put_u8(MSG_FEED)
|
||||
@@ -42,7 +44,7 @@ static func encode(standing: int, total: int, entries: Array[Dictionary]) -> Pac
|
||||
out.put_u8(maxi(0, CAUSES.find(String(entry.get("cause", "none")))))
|
||||
out.put_u8(clampi(int(entry.get("item", -1)) + 1, 0, 255))
|
||||
out.put_u8(clampi(int(entry.get("place", 0)), 0, 255))
|
||||
out.put_u8(FLAG_TIED if bool(entry.get("tied", false)) else 0)
|
||||
out.put_u8((FLAG_TIED if bool(entry.get("tied", false)) else 0) | (FLAG_DOWNED if bool(entry.get("downed", false)) else 0))
|
||||
_put_name(out, String(entry.get("victim_name", "")))
|
||||
_put_name(out, String(entry.get("by_name", "")))
|
||||
return out.data_array
|
||||
@@ -67,6 +69,7 @@ static func decode(bytes: PackedByteArray) -> Dictionary:
|
||||
var entry: Dictionary = {
|
||||
"victim": bytes.decode_s32(at), "by": bytes.decode_s32(at + 4), "cause": CAUSES[cause],
|
||||
"item": int(bytes[at + 9]) - 1, "place": int(bytes[at + 10]), "tied": bytes[at + 11] & FLAG_TIED != 0,
|
||||
"downed": bytes[at + 11] & FLAG_DOWNED != 0,
|
||||
}
|
||||
at += ENTRY_FIXED_BYTES
|
||||
var names: Array[String] = []
|
||||
|
||||
@@ -16,7 +16,7 @@ class_name NetProtocol
|
||||
extends RefCounted
|
||||
|
||||
## Raised whenever the wire format changes in a way old clients can't read.
|
||||
const VERSION: int = 4
|
||||
const VERSION: int = 5
|
||||
const MAGIC: String = "TDWL"
|
||||
const CHANNEL_CONTROL: int = 0
|
||||
## Unreliable game traffic: commands up, snapshots down.
|
||||
|
||||
+10
-5
@@ -38,8 +38,8 @@ const MATCH_BYTES: int = 14
|
||||
## told. Exact, not quantized, so a prediction made from it matches the server's to the
|
||||
## bit: position and velocity (three f32 each, which is all a Vector3 holds), the water
|
||||
## level around the player (f64), which of the nine flood cells around the player that
|
||||
## water reaches (u16), swimming stamina in ticks (u16) and the player's FLAG_ bits (u8).
|
||||
const SELF_BYTES: int = 37
|
||||
## water reaches (u16), swimming stamina in ticks (u16) and the player's FLAG_ bits (u16).
|
||||
const SELF_BYTES: int = 38
|
||||
## Every bit of the nine-cell water mask.
|
||||
const WATER_EVERYWHERE: int = 0x1FF
|
||||
## The most commands one INPUT may carry. Clients send fewer; see Tuning.
|
||||
@@ -80,6 +80,8 @@ const FLAG_ELIMINATED: int = 1 << 3
|
||||
const FLAG_DROP_SHIFT: int = 4
|
||||
const FLAG_RELOADING: int = 1 << 6
|
||||
const FLAG_USING: int = 1 << 7
|
||||
## Down, not out (duos, M7): crawling and waiting for a teammate.
|
||||
const FLAG_DOWNED: int = 1 << 8
|
||||
|
||||
const _U8: int = 0
|
||||
const _S8: int = 1
|
||||
@@ -89,7 +91,7 @@ const _WIDTH: Array[int] = [1, 1, 2, 4]
|
||||
|
||||
## Per archetype: the wire type of every record index.
|
||||
const _TYPES: Dictionary = {
|
||||
SimEntity.ARCHETYPE_PLAYER: [_U8, _U16, _U16, _U16, _U16, _S8, _U8, _U8, _U8, _U8],
|
||||
SimEntity.ARCHETYPE_PLAYER: [_U8, _U16, _U16, _U16, _U16, _S8, _U8, _U8, _U16, _U8],
|
||||
SimEntity.ARCHETYPE_PICKUP: [_U8, _U16, _U16, _U16, _U8, _U16, _U8],
|
||||
SimEntity.ARCHETYPE_PROJECTILE: [_U8, _U16, _U16, _U16, _U8, _U32],
|
||||
}
|
||||
@@ -157,6 +159,8 @@ static func flags_of(entity: SimEntity) -> int:
|
||||
flags |= FLAG_RELOADING
|
||||
if entity.use_ticks > 0:
|
||||
flags |= FLAG_USING
|
||||
if entity.downed:
|
||||
flags |= FLAG_DOWNED
|
||||
return flags
|
||||
|
||||
|
||||
@@ -180,6 +184,7 @@ static func apply_self(player: SimEntity, own: Dictionary) -> void:
|
||||
player.crouching = flags & FLAG_CROUCHING != 0
|
||||
player.swimming = flags & FLAG_SWIMMING != 0
|
||||
player.eliminated = flags & FLAG_ELIMINATED != 0
|
||||
player.downed = flags & FLAG_DOWNED != 0
|
||||
player.drop_state = (flags >> FLAG_DROP_SHIFT) & 3
|
||||
|
||||
|
||||
@@ -257,7 +262,7 @@ static func encode_snapshot(header: Dictionary, removed: PackedInt32Array, recor
|
||||
out.put_double(own["water"])
|
||||
out.put_u16(int(own["water_mask"]) & WATER_EVERYWHERE)
|
||||
out.put_u16(clampi(int(own["stamina"]), 0, 65535))
|
||||
out.put_u8(int(own["flags"]) & 0xFF)
|
||||
out.put_u16(int(own["flags"]) & 0xFFFF)
|
||||
out.put_u8(removed.size())
|
||||
for entity_id: int in removed:
|
||||
_put_varint(out, entity_id)
|
||||
@@ -325,7 +330,7 @@ static func decode_snapshot(bytes: PackedByteArray) -> Dictionary:
|
||||
"water": bytes.decode_double(at + 24),
|
||||
"water_mask": bytes.decode_u16(at + 32) & WATER_EVERYWHERE,
|
||||
"stamina": bytes.decode_u16(at + 34),
|
||||
"flags": bytes[at + 36],
|
||||
"flags": bytes.decode_u16(at + 36),
|
||||
}
|
||||
for value: float in [own["position"].x, own["position"].y, own["position"].z, own["velocity"].x, own["velocity"].y, own["velocity"].z, own["water"]]:
|
||||
if not is_finite(value):
|
||||
|
||||
@@ -20,7 +20,12 @@ const RECORD_SIZE: int = 8 + PlayerCommand.ENCODED_SIZE
|
||||
const MAX_RAW_BYTES: int = 64 * 1024 * 1024
|
||||
const RULE_KEYS: Array[String] = [
|
||||
"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
|
||||
## 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:
|
||||
# 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).
|
||||
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]):
|
||||
return null
|
||||
if key == "fill_with_bots":
|
||||
result.rules.fill_with_bots = bool(rule_values[key])
|
||||
if BOOL_RULE_KEYS.has(key):
|
||||
result.rules.set(key, bool(rule_values[key]))
|
||||
else:
|
||||
result.rules.set(key, int(rule_values[key]))
|
||||
result.rules.max_players = clampi(result.rules.max_players, 1, Tuning.SOLO_PLAYERS)
|
||||
|
||||
@@ -55,10 +55,11 @@ func _ready() -> void:
|
||||
if not config.has_seed:
|
||||
config.match_seed = _fresh_seed()
|
||||
Engine.max_fps = 0 if config.unthrottled else REALTIME_MAX_FPS
|
||||
var rules: MatchRules = null
|
||||
var rules: MatchRules = ServerLoop.immediate_rules(config.players, config.bots)
|
||||
if config.listen:
|
||||
rules = MatchRules.new()
|
||||
rules.fill_with_bots = config.bots > 0
|
||||
rules.team_size = config.team_size
|
||||
loop = ServerLoop.new(config.match_seed, config.players, config.bots, rules, config.bot_difficulty)
|
||||
if config.listen:
|
||||
var net: NetServer = NetServer.new()
|
||||
|
||||
@@ -17,6 +17,16 @@ var _accumulator: float = 0.0
|
||||
var _greeted: bool = false
|
||||
|
||||
|
||||
## Rules for an offline match of one person and `bots` bots on teams of `team_size`:
|
||||
## null for solo, which ServerLoop starts at once with its own rules.
|
||||
static func offline_rules(bots: int, team_size: int) -> MatchRules:
|
||||
if team_size <= 1:
|
||||
return null
|
||||
var rules: MatchRules = ServerLoop.immediate_rules(1, bots)
|
||||
rules.team_size = team_size
|
||||
return rules
|
||||
|
||||
|
||||
## A match of one person and `bots` bots. With `rules` null it starts at once, and a
|
||||
## new one starts after each one's results. `difficulty` is every bot's, as an index
|
||||
## into Tuning.BOT_DIFFICULTIES, or -1 to mix them.
|
||||
|
||||
@@ -119,7 +119,7 @@ func after_tick() -> void:
|
||||
feed_changes = PackedByteArray()
|
||||
own_changes.clear()
|
||||
for event: Dictionary in flow.events:
|
||||
if event["type"] == "placed" or event["type"] == "match_started":
|
||||
if event["type"] in ["placed", "match_started", "downed", "revived"]:
|
||||
feed_changed = true
|
||||
if event["type"] == "phase":
|
||||
changed = true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Command-line configuration for a headless server.
|
||||
##
|
||||
## tools/godot.sh -- --server [--listen] [--port=N] [--seed=N] [--players=N] [--bots=N]
|
||||
## [--bot-difficulty=mixed|easy|normal|hard] [--ticks=N]
|
||||
## [--bot-difficulty=mixed|easy|normal|hard] [--team-size=1|2] [--ticks=N]
|
||||
## [--unthrottled] [--log-every=N] [--matches=N] [--world-hash-every=N]
|
||||
## [--name=NAME] [--list=HOST[:PORT]]... [--no-lan]
|
||||
## [--health-port=N] [--health-bind=ADDRESS] [--stop-file=PATH]
|
||||
@@ -24,6 +24,9 @@
|
||||
## A listening server answers LAN discovery on its port plus one unless `--no-lan`,
|
||||
## and registers with each `--list` server (see ListServer) under `--name`.
|
||||
##
|
||||
## `--team-size=2` plays duos (M7): pairs in join order, who can't hurt each other and
|
||||
## go down instead of out while their teammate stands. 1, solo, is the default.
|
||||
##
|
||||
## Unknown or malformed arguments are errors, so a typo can't silently run the wrong
|
||||
## match. See `parse()`.
|
||||
class_name ServerConfig
|
||||
@@ -46,6 +49,8 @@ var port: int = DEFAULT_PORT
|
||||
## Idle player slots, for a server that isn't listening.
|
||||
var players: int = 0
|
||||
var bots: int = 0
|
||||
## Players on a team: 1 for solo, Tuning.DUO_TEAM_SIZE for duos.
|
||||
var team_size: int = 1
|
||||
## Every bot's difficulty, as an index into Tuning.BOT_DIFFICULTIES, or -1 to mix them.
|
||||
var bot_difficulty: int = -1
|
||||
## Ticks to run before exiting. 0 runs until the process is stopped.
|
||||
@@ -107,6 +112,7 @@ func to_dictionary() -> Dictionary:
|
||||
"port": port,
|
||||
"players": players,
|
||||
"bots": bots,
|
||||
"team_size": team_size,
|
||||
"bot_difficulty": "mixed" if bot_difficulty < 0 else String(Tuning.BOT_DIFFICULTIES[bot_difficulty]["name"]),
|
||||
"ticks": ticks,
|
||||
"matches": matches,
|
||||
@@ -147,6 +153,9 @@ func _parse_one(arg: String) -> void:
|
||||
"--bots":
|
||||
if _check_int(key, value):
|
||||
bots = value.to_int()
|
||||
"--team-size":
|
||||
if _check_int(key, value):
|
||||
team_size = value.to_int()
|
||||
"--ticks":
|
||||
if _check_int(key, value):
|
||||
ticks = value.to_int()
|
||||
@@ -260,6 +269,8 @@ func _validate() -> void:
|
||||
)
|
||||
if listen and players > 0:
|
||||
errors.append("--players is for a server that isn't listening; with --listen, people join over the network")
|
||||
if team_size < 1 or team_size > Tuning.DUO_TEAM_SIZE:
|
||||
errors.append("--team-size must be 1 (solo) or %d (duos), got %d" % [Tuning.DUO_TEAM_SIZE, team_size])
|
||||
if ticks < 0:
|
||||
errors.append("--ticks can't be negative")
|
||||
if log_every < 0:
|
||||
|
||||
@@ -47,7 +47,7 @@ func _init(match_seed: int, human_players: int, bot_count: int, rules: MatchRule
|
||||
for handle: int in range(1, human_players + 1):
|
||||
match_flow.join(handle)
|
||||
if rules.lobby_ticks == 0 and rules.countdown_ticks == 0:
|
||||
# Every match starts on the sky barge, on the first tick.
|
||||
# Every match starts on the packet ship, on the first tick.
|
||||
_advance()
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ extends RefCounted
|
||||
|
||||
enum Result {
|
||||
OK,
|
||||
## Dead, swimming, aboard the barge or falling.
|
||||
## Dead, swimming, aboard the ship or falling.
|
||||
NOT_ALLOWED,
|
||||
## Unknown piece kind or material.
|
||||
BAD_REQUEST,
|
||||
|
||||
+181
-45
@@ -1,78 +1,128 @@
|
||||
## The start of a match: a sky barge drifts across the island on a seeded straight route,
|
||||
## carrying every player. Each one leaps when they choose, falls, opens a wing-sail
|
||||
## (by hand, or automatically near the ground) and steers down. Anyone still aboard
|
||||
## when the barge reaches the end of its route is thrown off.
|
||||
## The start of a match (#72): a packet ship sails a seeded straight line past the
|
||||
## island, offshore, carrying every player. Each one fires themselves inland by lifeline
|
||||
## mortar when they choose: the look direction sets the heading, and how high they aim
|
||||
## sets the charge, so a level aim lands near the shore and an aim up high carries to
|
||||
## the far side. They ride the mortar's arc up, then fall, open a gull-kite (by hand,
|
||||
## or by itself near the ground) and steer down. Anyone still aboard when the ship
|
||||
## reaches the end of its route is fired towards the middle of the island.
|
||||
##
|
||||
## The route is drawn from the "drop" stream: a heading, and a point near the island's
|
||||
## middle that the route passes through, so it always crosses land. Movement handles
|
||||
## falling and gliding; this owns the barge, boarding and leaping.
|
||||
## The route is drawn from the "drop" stream: a heading, and the side of the island the
|
||||
## ship passes on. It passes as close in as it can while keeping SHIP_COAST_CLEARANCE
|
||||
## of open water between itself and any land. Movement handles the arc, falling and gliding;
|
||||
## this owns the ship, boarding and firing.
|
||||
class_name Drop
|
||||
extends RefCounted
|
||||
|
||||
## Player drop states, in SimEntity.drop_state.
|
||||
## Player drop states, in SimEntity.drop_state. FREEFALL covers the mortar's climb
|
||||
## (rising, with no steering) as well as the fall.
|
||||
const NONE: int = 0
|
||||
const ABOARD: int = 1
|
||||
const FREEFALL: int = 2
|
||||
const GLIDING: int = 3
|
||||
|
||||
## Where the route starts and ends, at barge altitude.
|
||||
## Where the route starts and ends, at deck height.
|
||||
var start: Vector3 = Vector3.ZERO
|
||||
var finish: Vector3 = Vector3.ZERO
|
||||
## Ticks the barge takes from start to finish.
|
||||
## Ticks the ship takes from start to finish.
|
||||
var duration_ticks: int = 0
|
||||
## Simulation tick the drop began on.
|
||||
var began_tick: int = 0
|
||||
## True once the barge has reached the end and thrown everyone off.
|
||||
## True once the ship has reached the end and fired everyone still aboard.
|
||||
var finished: bool = false
|
||||
|
||||
|
||||
## Plans the route for `island` from the simulation's "drop" stream.
|
||||
## Plans the route past `island_ground` from the simulation's "drop" stream.
|
||||
static func plan(island_ground: SimGround, rng: SimRng, tick: int) -> Drop:
|
||||
var drop: Drop = Drop.new()
|
||||
var stream: RandomNumberGenerator = rng.stream("drop")
|
||||
var size: float = Tuning.WORLD_SIZE_METRES
|
||||
var centre: Vector2 = Vector2(size, size) * 0.5
|
||||
var heading: float = stream.randf() * TAU
|
||||
var jitter_angle: float = stream.randf() * TAU
|
||||
var jitter: float = sqrt(stream.randf()) * Tuning.BARGE_CENTRE_JITTER
|
||||
var through: Vector2 = centre + Vector2(cos(jitter_angle), sin(jitter_angle)) * jitter
|
||||
# Pull the crossing point onto land if the jitter put it over water.
|
||||
var tries: int = 0
|
||||
while island_ground.terrain_height(through.x, through.y) <= Tuning.ISLAND_BEACH_TOP and tries < 16:
|
||||
through = through.lerp(centre, 0.5)
|
||||
tries += 1
|
||||
var direction: Vector2 = Vector2(cos(heading), sin(heading))
|
||||
var margin: float = Tuning.BARGE_ROUTE_MARGIN
|
||||
var back: float = _distance_to_edge(through, -direction, margin, size)
|
||||
var ahead: float = _distance_to_edge(through, direction, margin, size)
|
||||
var a: Vector2 = through - direction * back
|
||||
var b: Vector2 = through + direction * ahead
|
||||
drop.start = Vector3(a.x, Tuning.BARGE_ALTITUDE, a.y)
|
||||
drop.finish = Vector3(b.x, Tuning.BARGE_ALTITUDE, b.y)
|
||||
drop.duration_ticks = maxi(ceili(a.distance_to(b) / Tuning.BARGE_SPEED * Tuning.TICK_RATE_HZ), 1)
|
||||
var margin: float = Tuning.SHIP_ROUTE_MARGIN
|
||||
var best_a: Vector2 = Vector2.ZERO
|
||||
var best_b: Vector2 = Vector2.ZERO
|
||||
var found: bool = false
|
||||
for _try: int in Tuning.SHIP_ROUTE_TRIES:
|
||||
var heading: float = stream.randf() * TAU
|
||||
var side: float = 1.0 if stream.randf() < 0.5 else -1.0
|
||||
var direction: Vector2 = Vector2(cos(heading), sin(heading))
|
||||
# Away from the island, on the chosen side.
|
||||
var outward: Vector2 = Vector2(-direction.y, direction.x) * side
|
||||
var offset: float = Tuning.SHIP_OFFSET_MIN
|
||||
while offset <= Tuning.SHIP_OFFSET_MAX:
|
||||
var through: Vector2 = centre + outward * offset
|
||||
var a: Vector2 = through - direction * _distance_to_edge(through, -direction, margin, size)
|
||||
var b: Vector2 = through + direction * _distance_to_edge(through, direction, margin, size)
|
||||
if a.distance_to(b) < Tuning.SHIP_MIN_ROUTE_METRES:
|
||||
break
|
||||
if not found:
|
||||
# The fallback, should no route anywhere stay clear: the farthest one out.
|
||||
best_a = a
|
||||
best_b = b
|
||||
if _clear_of_land(island_ground, a, b):
|
||||
best_a = a
|
||||
best_b = b
|
||||
found = true
|
||||
break
|
||||
offset += Tuning.SHIP_OFFSET_STEP
|
||||
if found:
|
||||
break
|
||||
if not found:
|
||||
# Nothing on the drawn headings stayed clear: try the four routes along the
|
||||
# world's sides, as far out as routes go, which are the longest.
|
||||
var sides: Array[Vector2] = [Vector2.DOWN, Vector2.UP, Vector2.LEFT, Vector2.RIGHT]
|
||||
for outward: Vector2 in sides:
|
||||
var direction: Vector2 = Vector2(outward.y, -outward.x)
|
||||
var through: Vector2 = centre + outward * Tuning.SHIP_OFFSET_MAX
|
||||
var a: Vector2 = through - direction * _distance_to_edge(through, -direction, margin, size)
|
||||
var b: Vector2 = through + direction * _distance_to_edge(through, direction, margin, size)
|
||||
if _clear_of_land(island_ground, a, b):
|
||||
best_a = a
|
||||
best_b = b
|
||||
break
|
||||
drop.start = Vector3(best_a.x, Tuning.SHIP_DECK_HEIGHT, best_a.y)
|
||||
drop.finish = Vector3(best_b.x, Tuning.SHIP_DECK_HEIGHT, best_b.y)
|
||||
drop.duration_ticks = maxi(ceili(best_a.distance_to(best_b) / Tuning.SHIP_SPEED * Tuning.TICK_RATE_HZ), 1)
|
||||
drop.began_tick = tick
|
||||
return drop
|
||||
|
||||
|
||||
## How far along the route the barge is at `tick`, from 0 to 1.
|
||||
## True if the route from `a` to `b` is open sea with no land within
|
||||
## SHIP_COAST_CLEARANCE of it, probed in eight directions at half and full clearance.
|
||||
static func _clear_of_land(island_ground: SimGround, a: Vector2, b: Vector2) -> bool:
|
||||
var count: int = maxi(ceili(a.distance_to(b) / Tuning.SHIP_CLEARANCE_STEP), 1)
|
||||
var limit: float = Tuning.SEA_LEVEL_START - Tuning.SHIP_DRAUGHT
|
||||
for index: int in count + 1:
|
||||
var point: Vector2 = a.lerp(b, float(index) / count)
|
||||
if island_ground.terrain_height(point.x, point.y) > limit:
|
||||
return false
|
||||
for direction: int in 8:
|
||||
var angle: float = TAU * direction / 8.0
|
||||
for radius: float in [Tuning.SHIP_COAST_CLEARANCE * 0.5, Tuning.SHIP_COAST_CLEARANCE]:
|
||||
var probe: Vector2 = point + Vector2(cos(angle), sin(angle)) * radius
|
||||
if island_ground.terrain_height(probe.x, probe.y) > limit:
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
## How far along the route the ship is at `tick`, from 0 to 1.
|
||||
func progress(tick: int) -> float:
|
||||
return clampf(float(tick - began_tick) / duration_ticks, 0.0, 1.0)
|
||||
|
||||
|
||||
func barge_position(tick: int) -> Vector3:
|
||||
func ship_position(tick: int) -> Vector3:
|
||||
return start.lerp(finish, progress(tick))
|
||||
|
||||
|
||||
func barge_velocity() -> Vector3:
|
||||
func ship_velocity() -> Vector3:
|
||||
return (finish - start) / (float(duration_ticks) / Tuning.TICK_RATE_HZ)
|
||||
|
||||
|
||||
## True once the barge is at the end of its route.
|
||||
## True once the ship is at the end of its route.
|
||||
func is_over(tick: int) -> bool:
|
||||
return tick - began_tick >= duration_ticks
|
||||
|
||||
|
||||
## Points along the route every `step` metres, at ground level, for tests and maps.
|
||||
## Points along the route every `step` metres, at sea level, for tests and maps.
|
||||
func route_samples(step: float) -> PackedVector2Array:
|
||||
var points: PackedVector2Array = PackedVector2Array()
|
||||
var a: Vector2 = Vector2(start.x, start.z)
|
||||
@@ -83,7 +133,7 @@ func route_samples(step: float) -> PackedVector2Array:
|
||||
return points
|
||||
|
||||
|
||||
## Puts a player aboard: carried with the barge, not moving on their own.
|
||||
## Puts a player aboard: carried with the ship, not moving on their own.
|
||||
static func board(player: SimEntity, at: Vector3) -> void:
|
||||
player.drop_state = ABOARD
|
||||
player.position = at
|
||||
@@ -92,25 +142,111 @@ static func board(player: SimEntity, at: Vector3) -> void:
|
||||
player.swimming = false
|
||||
|
||||
|
||||
## Throws a player off the barge into freefall, keeping some of the barge's speed.
|
||||
func leap(player: SimEntity, tick: int) -> void:
|
||||
# The lifeline mortar
|
||||
|
||||
## The mortar's charge, 0 to 1, for a look pitch in radians: level or lower is the
|
||||
## least, MORTAR_PITCH_HIGH_DEGREES or higher the most.
|
||||
static func charge_for_pitch(pitch_radians: float) -> float:
|
||||
var low: float = deg_to_rad(Tuning.MORTAR_PITCH_LOW_DEGREES)
|
||||
var high: float = deg_to_rad(Tuning.MORTAR_PITCH_HIGH_DEGREES)
|
||||
return clampf((pitch_radians - low) / (high - low), 0.0, 1.0)
|
||||
|
||||
|
||||
## The look pitch, in radians, that gives `charge`.
|
||||
static func pitch_for_charge(charge: float) -> float:
|
||||
var low: float = deg_to_rad(Tuning.MORTAR_PITCH_LOW_DEGREES)
|
||||
var high: float = deg_to_rad(Tuning.MORTAR_PITCH_HIGH_DEGREES)
|
||||
return lerpf(low, high, clampf(charge, 0.0, 1.0))
|
||||
|
||||
|
||||
## The launch velocity for a heading (yaw, radians, as PlayerCommand measures it) and
|
||||
## a charge.
|
||||
static func launch_velocity(yaw_radians: float, charge: float) -> Vector3:
|
||||
var speed: float = lerpf(Tuning.MORTAR_MIN_SPEED, Tuning.MORTAR_MAX_SPEED, clampf(charge, 0.0, 1.0))
|
||||
return Vector3(sin(yaw_radians) * speed, Tuning.MORTAR_RISE_SPEED, cos(yaw_radians) * speed)
|
||||
|
||||
|
||||
## Fires a player off the ship by mortar, along `yaw_radians` with `charge`.
|
||||
func fire(player: SimEntity, tick: int, yaw_radians: float, charge: float) -> void:
|
||||
player.drop_state = FREEFALL
|
||||
player.position = barge_position(tick)
|
||||
var carried: Vector3 = barge_velocity() * Tuning.LEAP_CARRY
|
||||
player.velocity = Vector3(carried.x, 0.0, carried.z)
|
||||
player.position = ship_position(tick)
|
||||
player.velocity = launch_velocity(yaw_radians, charge)
|
||||
player.on_ground = false
|
||||
|
||||
|
||||
## A tick aboard the barge: jump leaps off, anything else rides along. The server and a
|
||||
## client predicting its own player both come through here.
|
||||
## How far over level ground a shot with `charge` carries while the player keeps
|
||||
## steering straight on: with `kite_at_top`, opening the kite as soon as the climb ends
|
||||
## (the furthest a shot can carry, and the slowest way down); without, falling until
|
||||
## the kite opens by itself. Mirrors Movement._fall_from_ship(); bots and the forced
|
||||
## shot pick their charge with it.
|
||||
static func reach(charge: float, kite_at_top: bool = false) -> float:
|
||||
var dt: float = 1.0 / Tuning.TICK_RATE_HZ
|
||||
var launch: Vector3 = launch_velocity(0.0, charge)
|
||||
var flat: float = launch.z
|
||||
var rise: float = launch.y
|
||||
var height: float = Tuning.SHIP_DECK_HEIGHT
|
||||
var travelled: float = 0.0
|
||||
var gliding: bool = false
|
||||
for _tick: int in Tuning.TICK_RATE_HZ * 120:
|
||||
if rise > 0.0:
|
||||
rise -= Tuning.GRAVITY * dt
|
||||
else:
|
||||
gliding = gliding or kite_at_top or height <= Tuning.KITE_AUTO_DEPLOY_HEIGHT
|
||||
if gliding:
|
||||
flat = move_toward(flat, Tuning.GLIDE_SPEED, Tuning.DROP_STEER_ACCEL * dt)
|
||||
rise = move_toward(rise, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * dt)
|
||||
else:
|
||||
flat = move_toward(flat, Tuning.FREEFALL_STEER_SPEED, Tuning.DROP_STEER_ACCEL * dt)
|
||||
rise = maxf(rise - Tuning.GRAVITY * dt, -Tuning.FREEFALL_MAX_SPEED)
|
||||
travelled += flat * dt
|
||||
height += rise * dt
|
||||
if height <= 0.0:
|
||||
break
|
||||
return travelled
|
||||
|
||||
|
||||
## The least charge whose reach() is at least `distance`, or 1 if none is.
|
||||
static func charge_for_distance(distance: float, kite_at_top: bool = false) -> float:
|
||||
if reach(0.0, kite_at_top) >= distance:
|
||||
return 0.0
|
||||
if reach(1.0, kite_at_top) <= distance:
|
||||
return 1.0
|
||||
var low: float = 0.0
|
||||
var high: float = 1.0
|
||||
for _step: int in 12:
|
||||
var middle: float = (low + high) * 0.5
|
||||
if reach(middle, kite_at_top) < distance:
|
||||
low = middle
|
||||
else:
|
||||
high = middle
|
||||
return high
|
||||
|
||||
|
||||
## The charge that carries `distance` with the quickest way down: a fall if one carries
|
||||
## that far, otherwise a full charge with the kite opened at the top.
|
||||
static func aim_charge(distance: float) -> float:
|
||||
return charge_for_distance(distance) if reach(1.0) >= distance else charge_for_distance(distance, true)
|
||||
|
||||
|
||||
## A tick aboard the ship: jump fires the mortar, anything else rides along. The
|
||||
## server and a client predicting its own player both come through here.
|
||||
func ride(player: SimEntity, command: PlayerCommand, tick: int) -> void:
|
||||
if command != null:
|
||||
player.yaw = command.yaw
|
||||
player.pitch = command.pitch
|
||||
if command.is_pressed(PlayerCommand.BUTTON_JUMP):
|
||||
leap(player, tick)
|
||||
fire(player, tick, command.yaw_radians(), charge_for_pitch(command.pitch_radians()))
|
||||
return
|
||||
player.position = barge_position(tick + 1)
|
||||
player.position = ship_position(tick + 1)
|
||||
|
||||
|
||||
## The end of the route: fires a player still aboard towards the middle of the island,
|
||||
## with the charge that carries there.
|
||||
func fire_at_end(player: SimEntity, tick: int) -> void:
|
||||
var at: Vector3 = ship_position(tick)
|
||||
var centre: Vector2 = Vector2(Tuning.WORLD_SIZE_METRES, Tuning.WORLD_SIZE_METRES) * 0.5
|
||||
var to: Vector2 = centre - Vector2(at.x, at.z)
|
||||
fire(player, tick, atan2(to.x, to.y), aim_charge(to.length() * Tuning.MORTAR_FORCED_REACH))
|
||||
|
||||
|
||||
## Distance from `from` along unit `direction` to the square [margin, size - margin].
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
## - Falloff: full damage at the middle, down linearly to Tuning.BLAST_EDGE_FACTOR of it
|
||||
## at the edge, times the charge's tier.
|
||||
## - Players take `damage`, armor first, credited to the thrower. The thrower takes
|
||||
## Tuning.BLAST_SELF_FACTOR of theirs. Everyone else takes it all: there are no
|
||||
## teammates in solo, and duos (M7) will apply one team rule to every weapon.
|
||||
## Tuning.BLAST_SELF_FACTOR of theirs. Everyone else takes it all, except the thrower's
|
||||
## teammates, who take none (Weapons.damage_player's team rule).
|
||||
## - Pieces and props take `structure_damage`. A breakwater is a piece, so a charge can
|
||||
## breach one and let the sea in.
|
||||
## Everything a blast reaches is worked out before any of it is applied, in ID order,
|
||||
|
||||
+46
-5
@@ -125,7 +125,7 @@ func in_match() -> bool:
|
||||
## Adds a participant. Returns false if the handle is already here or the lobby is
|
||||
## full. During a match they wait for the next one.
|
||||
func join(handle: int, bot: bool = false) -> bool:
|
||||
# Once the barge has left, newcomers watch (see watch()) until the next lobby.
|
||||
# Once the ship has left, newcomers watch (see watch()) until the next lobby.
|
||||
if in_match() or phase == RESULTS:
|
||||
return false
|
||||
if participants.has(handle) or watchers.has(handle) or participants.size() >= rules.max_players:
|
||||
@@ -222,6 +222,7 @@ func step() -> void:
|
||||
DROP, PLAY:
|
||||
sim.step()
|
||||
_collect_damage()
|
||||
_collect_downs()
|
||||
_collect_eliminations()
|
||||
if phase == DROP and sim.drop.finished:
|
||||
_enter(PLAY)
|
||||
@@ -238,7 +239,7 @@ func _enter(next: int) -> void:
|
||||
phase_ticks = 0
|
||||
|
||||
|
||||
## Fills empty places with bots, puts every participant on the barge and places loot.
|
||||
## Fills empty places with bots, puts every participant on the ship and places loot.
|
||||
func _start() -> void:
|
||||
if rules.fill_with_bots:
|
||||
while participants.size() < rules.max_players:
|
||||
@@ -252,6 +253,9 @@ func _start() -> void:
|
||||
entity_of[handle] = entity_id
|
||||
handle_of[entity_id] = handle
|
||||
team_of[handle] = 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}
|
||||
_match_size = participants.size()
|
||||
_roster = participants.duplicate()
|
||||
@@ -264,6 +268,13 @@ func _start() -> void:
|
||||
_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.
|
||||
func _collect_damage() -> void:
|
||||
for event: Dictionary in sim.events:
|
||||
@@ -279,6 +290,32 @@ func _collect_damage() -> void:
|
||||
_last_weapon[victim] = int(event.get("item", -1))
|
||||
|
||||
|
||||
## Reports downs and revives (M7) by handle: {"type": "downed", "handle", "by", "cause",
|
||||
## "item"} and {"type": "revived", "handle", "by"}. Downs also go in the kill feed, marked
|
||||
## "downed".
|
||||
func _collect_downs() -> void:
|
||||
for event: Dictionary in sim.events:
|
||||
if not handle_of.has(event.get("player", 0)):
|
||||
continue
|
||||
var handle: int = handle_of[event["player"]]
|
||||
if event["type"] == "downed":
|
||||
var by: int = int(handle_of.get(event["by"], 0))
|
||||
var record: Dictionary = {
|
||||
"type": "downed", "handle": handle, "by": by, "cause": String(event["cause"]),
|
||||
"item": int(_last_weapon.get(handle, -1)) if by != 0 else -1, "tick": sim.tick,
|
||||
}
|
||||
events.append(record)
|
||||
var entry: Dictionary = record.duplicate()
|
||||
entry.erase("type")
|
||||
entry["downed"] = true
|
||||
entry["place"] = 0
|
||||
entry["tied"] = false
|
||||
entry["left"] = false
|
||||
kill_feed.append(entry)
|
||||
elif event["type"] == "revived":
|
||||
events.append({"type": "revived", "handle": handle, "by": int(handle_of.get(event["by"], 0))})
|
||||
|
||||
|
||||
## Places everyone the simulation eliminated this tick. They share the best place of
|
||||
## the range they fall into: with five standing and two falling together, both are 4th.
|
||||
func _collect_eliminations() -> void:
|
||||
@@ -330,7 +367,9 @@ func _check_finished() -> void:
|
||||
for handle: int in living:
|
||||
teams[team_of[handle]] = true
|
||||
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
|
||||
winners.clear()
|
||||
if teams.size() >= 1:
|
||||
@@ -377,8 +416,8 @@ func _check_finished() -> void:
|
||||
events.append({"type": "match_ended", "match": current_seed(), "winners": winners.duplicate(), "timed_out": timed_out})
|
||||
|
||||
|
||||
## The best of `handles` by the tie-break: most health, then highest feet, then the
|
||||
## earliest to join. With `worst`, the worst instead.
|
||||
## The best of `handles` by the tie-break: standing over downed, most health, then
|
||||
## highest feet, then the earliest to join. With `worst`, the worst instead.
|
||||
func _tie_break(handles: Array[int], worst: bool = false) -> int:
|
||||
var chosen: int = handles[0]
|
||||
for handle: int in handles:
|
||||
@@ -393,6 +432,8 @@ func _tie_break(handles: Array[int], worst: bool = false) -> int:
|
||||
func _beats(a: int, b: int) -> bool:
|
||||
var pa: SimEntity = sim.entities.find(entity_of[a])
|
||||
var pb: SimEntity = sim.entities.find(entity_of[b])
|
||||
if pa.downed != pb.downed:
|
||||
return pb.downed
|
||||
if pa.health != pb.health:
|
||||
return pa.health > pb.health
|
||||
if not is_equal_approx(pa.position.y, pb.position.y):
|
||||
|
||||
@@ -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)
|
||||
## Fill empty places with bots when the match starts.
|
||||
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.
|
||||
@@ -24,3 +29,15 @@ static func immediate() -> MatchRules:
|
||||
rules.lobby_ticks = 0
|
||||
rules.countdown_ticks = 0
|
||||
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
|
||||
|
||||
+25
-12
@@ -21,12 +21,17 @@ static func step(player: SimEntity, command: PlayerCommand, ground: SimGround, s
|
||||
player.crouching = command.is_pressed(PlayerCommand.BUTTON_CROUCH)
|
||||
wants_jump = command.is_pressed(PlayerCommand.BUTTON_JUMP) and not player.crouching
|
||||
wish = _wish_velocity(command, player.crouching)
|
||||
if player.downed:
|
||||
# Downed (M7): low to the ground and crawling, with no jump or sprint.
|
||||
player.crouching = true
|
||||
wants_jump = false
|
||||
wish = wish.limit_length(Tuning.DOWNED_CRAWL_SPEED)
|
||||
|
||||
if player.drop_state == Drop.ABOARD:
|
||||
# Riders move with the barge; Simulation places them.
|
||||
# Riders move with the ship; Simulation places them.
|
||||
return
|
||||
if player.drop_state != Drop.NONE:
|
||||
_fall_from_barge(player, command, ground, sea_level)
|
||||
_fall_from_ship(player, command, ground, sea_level)
|
||||
return
|
||||
|
||||
if player.swimming:
|
||||
@@ -228,6 +233,10 @@ static func _swim(player: SimEntity, command: PlayerCommand, ground: SimGround,
|
||||
speed = Tuning.SWIM_SPRINT_SPEED
|
||||
if not has_stamina:
|
||||
speed *= Tuning.SWIM_EXHAUSTED_FACTOR
|
||||
if player.downed:
|
||||
# A downed swimmer paddles at a crawl and can't dive.
|
||||
speed = minf(speed, Tuning.DOWNED_CRAWL_SPEED)
|
||||
diving = false
|
||||
var velocity: Vector3 = move * speed
|
||||
|
||||
var float_depth: float = Tuning.SWIM_FLOAT_DEPTH if has_stamina else Tuning.SWIM_EXHAUSTED_DEPTH
|
||||
@@ -259,15 +268,18 @@ static func _swim(player: SimEntity, command: PlayerCommand, ground: SimGround,
|
||||
player.on_ground = false
|
||||
|
||||
|
||||
## One tick of the drop after leaping: freefall, then the wing-sail. Players steer with
|
||||
## the move keys relative to where they look; jump opens the sail, and it opens by itself
|
||||
## WING_AUTO_DEPLOY_HEIGHT above the ground or water. Near the bottom the sail folds and
|
||||
## ordinary falling (or the water) takes over, slow enough to do no damage.
|
||||
static func _fall_from_barge(player: SimEntity, command: PlayerCommand, ground: SimGround, sea_level: float) -> void:
|
||||
## One tick of the drop after the mortar fires: the climb, freefall, then the gull-kite.
|
||||
## While the shot is still climbing nothing steers it and the kite can't open. Then
|
||||
## players steer with the move keys relative to where they look; jump opens the kite,
|
||||
## and it opens by itself KITE_AUTO_DEPLOY_HEIGHT above the ground or water. Near the
|
||||
## bottom the kite folds and ordinary falling (or the water) takes over, slow enough to
|
||||
## do no damage.
|
||||
static func _fall_from_ship(player: SimEntity, command: PlayerCommand, ground: SimGround, sea_level: float) -> void:
|
||||
var below: float = _drop_floor(player, ground, sea_level, player.position.y)
|
||||
if player.drop_state == Drop.FREEFALL:
|
||||
var climbing: bool = player.drop_state == Drop.FREEFALL and player.velocity.y > 0.0
|
||||
if player.drop_state == Drop.FREEFALL and not climbing:
|
||||
var opens: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_JUMP)
|
||||
if opens or player.position.y - below <= Tuning.WING_AUTO_DEPLOY_HEIGHT:
|
||||
if opens or player.position.y - below <= Tuning.KITE_AUTO_DEPLOY_HEIGHT:
|
||||
player.drop_state = Drop.GLIDING
|
||||
var gliding: bool = player.drop_state == Drop.GLIDING
|
||||
|
||||
@@ -281,9 +293,10 @@ static func _fall_from_barge(player: SimEntity, command: PlayerCommand, ground:
|
||||
var right: Vector3 = Vector3(-cos(angle), 0.0, sin(angle))
|
||||
wish = (right * input.x + forward * input.y) * (Tuning.GLIDE_SPEED if gliding else Tuning.FREEFALL_STEER_SPEED)
|
||||
var velocity: Vector3 = player.velocity
|
||||
var flat: Vector3 = Vector3(velocity.x, 0.0, velocity.z).move_toward(wish, Tuning.DROP_STEER_ACCEL * DT)
|
||||
velocity.x = flat.x
|
||||
velocity.z = flat.z
|
||||
if not climbing:
|
||||
var flat: Vector3 = Vector3(velocity.x, 0.0, velocity.z).move_toward(wish, Tuning.DROP_STEER_ACCEL * DT)
|
||||
velocity.x = flat.x
|
||||
velocity.z = flat.z
|
||||
if gliding:
|
||||
velocity.y = move_toward(velocity.y, -Tuning.GLIDE_FALL_SPEED, Tuning.GLIDE_BRAKE * DT)
|
||||
else:
|
||||
|
||||
@@ -63,6 +63,14 @@ var prev_buttons: int = 0
|
||||
var view_quarters: int = 0
|
||||
## Set once health reaches 0. Eliminated players take no more commands.
|
||||
var eliminated: bool = false
|
||||
## The player's team, set by Match; -1 for none. Players on the same team can't hurt
|
||||
## each other, and a player with a teammate standing goes down instead of out (M7).
|
||||
var team: int = -1
|
||||
## Down but not out: crawling, bleeding health, waiting for a teammate. See Simulation.
|
||||
var downed: bool = false
|
||||
## Ticks a teammate has spent reviving this downed player without a break, and who.
|
||||
var revive_ticks: int = 0
|
||||
var reviver: int = 0
|
||||
## The player who last damaged this one, or 0.
|
||||
var last_attacker: int = 0
|
||||
## What dealt this player's most recent damage: one of the CAUSE_ constants. The cause
|
||||
|
||||
+143
-15
@@ -35,7 +35,7 @@ var tide: Tide = null
|
||||
var flood: Flood = null
|
||||
## Every built piece. Their boxes are part of `ground`.
|
||||
var structures: StructureSet = StructureSet.new()
|
||||
## The sky barge, from start_drop() on. Null in matches and tests that start on foot.
|
||||
## The packet ship, from start_drop() on. Null in matches and tests that start on foot.
|
||||
var drop: Drop = null
|
||||
|
||||
## Floor loot, sea chests and crate contents. Empty until place_loot().
|
||||
@@ -62,6 +62,8 @@ var _planned_levels: PackedFloat32Array = PackedFloat32Array()
|
||||
var _destroyed_checked: int = 0
|
||||
## Player entity IDs, ascending.
|
||||
var _players: Array[int] = []
|
||||
## Downed players someone worked on reviving this tick.
|
||||
var _tended: Dictionary = {}
|
||||
|
||||
|
||||
## Generates the island from the seed, unless `world` is given. Tests that don't care
|
||||
@@ -101,12 +103,57 @@ func add_player() -> int:
|
||||
Water.reset(player)
|
||||
Inventory.reset(player)
|
||||
if drop != null and not drop.finished:
|
||||
Drop.board(player, drop.barge_position(tick))
|
||||
Drop.board(player, drop.ship_position(tick))
|
||||
_players.append(player.id)
|
||||
_pending[player.id] = {}
|
||||
return player.id
|
||||
|
||||
|
||||
## Puts a player on a team. Players on one team can't hurt each other, and go down
|
||||
## instead of out while a teammate stands (M7). Match sets every player's team.
|
||||
func set_team(player_id: int, team: int) -> void:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if player != null:
|
||||
player.team = team
|
||||
|
||||
|
||||
## Whether `a` and `b` are different players on the same team.
|
||||
func are_teammates(a: SimEntity, b: SimEntity) -> bool:
|
||||
return a != null and b != null and a.id != b.id and a.team >= 0 and a.team == b.team
|
||||
|
||||
|
||||
## On their feet: in the match, not eliminated, not downed, health left.
|
||||
static func is_standing(player: SimEntity) -> bool:
|
||||
return player != null and not player.eliminated and not player.downed and player.health > 0
|
||||
|
||||
|
||||
## Whether any teammate of `player` is standing.
|
||||
func has_standing_teammate(player: SimEntity) -> bool:
|
||||
if player.team < 0:
|
||||
return false
|
||||
for other_id: int in _players:
|
||||
var other: SimEntity = entities.find(other_id)
|
||||
if are_teammates(player, other) and is_standing(other):
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
## The nearest downed teammate within Tuning.REVIVE_RANGE of `player`, or null. Ties go
|
||||
## to the lower ID.
|
||||
func revivable_teammate(player: SimEntity) -> SimEntity:
|
||||
var best: SimEntity = null
|
||||
var best_distance: float = Tuning.REVIVE_RANGE * Tuning.REVIVE_RANGE
|
||||
for other_id: int in _players:
|
||||
var other: SimEntity = entities.find(other_id)
|
||||
if not are_teammates(player, other) or not other.downed or other.eliminated:
|
||||
continue
|
||||
var distance: float = player.position.distance_squared_to(other.position)
|
||||
if distance <= best_distance and (best == null or distance < best_distance):
|
||||
best = other
|
||||
best_distance = distance
|
||||
return best
|
||||
|
||||
|
||||
## Removes a player and any commands queued for it.
|
||||
func remove_player(player_id: int) -> void:
|
||||
entities.remove(player_id)
|
||||
@@ -127,11 +174,11 @@ func submit_command(player_id: int, command: PlayerCommand) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
## Starts the match's drop: plans the barge's route and puts every player aboard.
|
||||
## Starts the match's drop: plans the ship's route and puts every player aboard.
|
||||
func start_drop() -> void:
|
||||
drop = Drop.plan(ground, rng, tick)
|
||||
for player_id: int in _players:
|
||||
Drop.board(entities.find(player_id), drop.barge_position(tick))
|
||||
Drop.board(entities.find(player_id), drop.ship_position(tick))
|
||||
|
||||
|
||||
## Rolls the match's loot from the "loot" stream and puts the floor loot in the world.
|
||||
@@ -204,15 +251,16 @@ func step() -> void:
|
||||
drop.ride(player, command, tick)
|
||||
else:
|
||||
_apply_command(player, command)
|
||||
_advance_downed()
|
||||
Weapons.advance_projectiles(self)
|
||||
_spill_broken_crates()
|
||||
_check_eliminations()
|
||||
if drop != null and not drop.finished and drop.is_over(tick + 1):
|
||||
# The end of the route: everyone still aboard goes over the side.
|
||||
# The end of the route: the mortar fires everyone still aboard inland.
|
||||
for player_id: int in _players:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if player.drop_state == Drop.ABOARD:
|
||||
drop.leap(player, tick + 1)
|
||||
drop.fire_at_end(player, tick + 1)
|
||||
drop.finished = true
|
||||
tick += 1
|
||||
|
||||
@@ -220,12 +268,20 @@ func step() -> void:
|
||||
func _apply_command(player: SimEntity, command: PlayerCommand) -> void:
|
||||
var water: float = water_level_at(player.position)
|
||||
Movement.step(player, command, ground, water)
|
||||
var sprinting: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_SPRINT)
|
||||
var sprinting: bool = command != null and command.is_pressed(PlayerCommand.BUTTON_SPRINT) and not player.downed
|
||||
Water.update(player, water_level_at(player.position), drown_dps, sprinting)
|
||||
if player.action_cooldown > 0:
|
||||
player.action_cooldown -= 1
|
||||
if command != null:
|
||||
Weapons.note_view(player, command, tick)
|
||||
if player.downed:
|
||||
# Crawling is all a downed player can do.
|
||||
player.prev_buttons = command.buttons if command != null else 0
|
||||
return
|
||||
if command != null and command.is_pressed(PlayerCommand.BUTTON_INTERACT) and _tend(player):
|
||||
# Reviving takes both hands: no looting, firing or building meanwhile.
|
||||
player.prev_buttons = command.buttons
|
||||
return
|
||||
Weapons.update(player)
|
||||
Consumables.update(self, player, command)
|
||||
var held: int = command.buttons if command != null else 0
|
||||
@@ -273,19 +329,87 @@ func _spill_broken_crates() -> void:
|
||||
events.append({"type": "crate_spilled", "prop": prop, "pickups": ids})
|
||||
|
||||
|
||||
## Marks players whose health reached 0 as eliminated, and drops what they carried.
|
||||
## A standing player holding interact works on reviving the nearest downed teammate in
|
||||
## range. Returns true if there was one. Revives on the REVIVE_SECONDS-th tick in a row.
|
||||
func _tend(player: SimEntity) -> bool:
|
||||
if player.drop_state != Drop.NONE or player.swimming:
|
||||
return false
|
||||
var patient: SimEntity = revivable_teammate(player)
|
||||
if patient == null:
|
||||
return false
|
||||
if patient.reviver != player.id:
|
||||
patient.revive_ticks = 0
|
||||
patient.reviver = player.id
|
||||
patient.revive_ticks += 1
|
||||
_tended[patient.id] = true
|
||||
if patient.revive_ticks >= roundi(Tuning.REVIVE_SECONDS * Tuning.TICK_RATE_HZ):
|
||||
patient.downed = false
|
||||
patient.health = Tuning.REVIVE_HEALTH
|
||||
patient.revive_ticks = 0
|
||||
patient.reviver = 0
|
||||
events.append({"type": "revived", "player": patient.id, "by": player.id})
|
||||
return true
|
||||
|
||||
|
||||
## Downed players bleed, and a revive nobody worked on this tick starts over.
|
||||
func _advance_downed() -> void:
|
||||
for player_id: int in _players:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if not player.downed or player.eliminated:
|
||||
continue
|
||||
if not _tended.has(player_id):
|
||||
player.revive_ticks = 0
|
||||
player.reviver = 0
|
||||
if tick % Tuning.DOWNED_BLEED_INTERVAL_TICKS == 0:
|
||||
player.health = maxi(player.health - 1, 0)
|
||||
_tended.clear()
|
||||
|
||||
|
||||
## Players whose health reached 0 go down if a teammate is still standing, and are
|
||||
## eliminated otherwise, dropping what they carried. Downed players are eliminated once
|
||||
## their health runs out again, or once no teammate is left standing to revive them.
|
||||
## The blow that downed them is what eliminated them, credited to who struck it.
|
||||
func _check_eliminations() -> void:
|
||||
var out: Array[SimEntity] = []
|
||||
for player_id: int in _players:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if player.eliminated or player.health > 0:
|
||||
continue
|
||||
player.eliminated = true
|
||||
player.velocity = Vector3.ZERO
|
||||
events.append({
|
||||
"type": "eliminated", "player": player_id, "by": player.last_attacker,
|
||||
"cause": SimEntity.CAUSE_NAMES[player.last_cause],
|
||||
})
|
||||
Inventory.drop_all(self, player)
|
||||
if not player.downed and player.drop_state == Drop.NONE and has_standing_teammate(player):
|
||||
player.downed = true
|
||||
player.health = Tuning.DOWNED_HEALTH
|
||||
player.armor = 0
|
||||
player.reload_ticks = 0
|
||||
player.use_ticks = 0
|
||||
player.revive_ticks = 0
|
||||
player.reviver = 0
|
||||
events.append({
|
||||
"type": "downed", "player": player_id, "by": player.last_attacker,
|
||||
"cause": SimEntity.CAUSE_NAMES[player.last_cause],
|
||||
})
|
||||
else:
|
||||
out.append(player)
|
||||
for player: SimEntity in out:
|
||||
_eliminate(player)
|
||||
# A downed player with nobody left to revive them is out.
|
||||
for player_id: int in _players:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if player.downed and not player.eliminated and not has_standing_teammate(player):
|
||||
_eliminate(player)
|
||||
|
||||
|
||||
func _eliminate(player: SimEntity) -> void:
|
||||
player.eliminated = true
|
||||
player.health = 0
|
||||
player.velocity = Vector3.ZERO
|
||||
player.downed = false
|
||||
player.revive_ticks = 0
|
||||
player.reviver = 0
|
||||
events.append({
|
||||
"type": "eliminated", "player": player.id, "by": player.last_attacker,
|
||||
"cause": SimEntity.CAUSE_NAMES[player.last_cause],
|
||||
})
|
||||
Inventory.drop_all(self, player)
|
||||
|
||||
|
||||
## Moves the sea surface, and spreads the flood for it at once. Takes effect on the
|
||||
@@ -369,6 +493,10 @@ func state_hash() -> String:
|
||||
buffer.put_32(entity.prev_buttons)
|
||||
buffer.put_u8(1 if entity.eliminated else 0)
|
||||
buffer.put_64(entity.view_quarters)
|
||||
buffer.put_32(entity.team)
|
||||
buffer.put_u8(1 if entity.downed else 0)
|
||||
buffer.put_32(entity.revive_ticks)
|
||||
buffer.put_32(entity.reviver)
|
||||
buffer.put_32(entity.last_attacker)
|
||||
buffer.put_u8(entity.last_cause)
|
||||
buffer.put_32(entity.item)
|
||||
|
||||
+103
-17
@@ -56,8 +56,25 @@ const NET_CORRECTION_SNAP_METRES: float = 3.0
|
||||
const SOLO_PLAYERS: int = 24
|
||||
const DUO_TEAMS: int = 12
|
||||
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
|
||||
|
||||
# Duos: downed, revive and bleed-out (M7). See Simulation.
|
||||
## A player whose health runs out while a teammate is still standing goes down instead
|
||||
## of out, with this much health to bleed. Hits on a downed player take it, too.
|
||||
const DOWNED_HEALTH: int = 60
|
||||
## A downed player loses one health this often, so bleeding out takes 30 seconds.
|
||||
const DOWNED_BLEED_INTERVAL_TICKS: int = 15
|
||||
## Downed players crawl: no jumping, sprinting, firing, building or using items.
|
||||
const DOWNED_CRAWL_SPEED: float = 1.0
|
||||
## A standing teammate holding interact within this distance (feet to feet) revives a
|
||||
## downed one in REVIVE_SECONDS. Letting go or moving away starts it over.
|
||||
const REVIVE_RANGE: float = 2.0
|
||||
## Health a revived player gets up with.
|
||||
const REVIVE_HEALTH: int = 30
|
||||
|
||||
# Match flow, in seconds. See Match and MatchRules, which can override each one.
|
||||
## The lobby counts down once this many participants have joined.
|
||||
const MATCH_MIN_PLAYERS: int = 1
|
||||
@@ -128,29 +145,49 @@ const SWIM_SPRINT_STAMINA_COST: int = 3
|
||||
const STAMINA_RECOVERY_RATE: int = 3
|
||||
const BREATH_RECOVERY_RATE: int = 4
|
||||
|
||||
# The drop, in metres and seconds. The sky barge crosses the island on a straight
|
||||
# seeded route through a point within BARGE_CENTRE_JITTER of the middle.
|
||||
const BARGE_ALTITUDE: float = 150.0
|
||||
const BARGE_SPEED: float = 24.0
|
||||
# The drop (#72), in metres and seconds. The packet ship sails a straight seeded line
|
||||
# past the island, offshore, and players fire themselves inland by lifeline mortar.
|
||||
## The deck the players ride on, above the starting sea level.
|
||||
const SHIP_DECK_HEIGHT: float = 4.0
|
||||
const SHIP_SPEED: float = 16.0
|
||||
## The route starts and ends this far inside the world's edge.
|
||||
const BARGE_ROUTE_MARGIN: float = 40.0
|
||||
const BARGE_CENTRE_JITTER: float = 140.0
|
||||
## Every route crosses at least this much dry land.
|
||||
const BARGE_MIN_LAND_METRES: float = 250.0
|
||||
## Fraction of the barge's speed a leaping player keeps.
|
||||
const LEAP_CARRY: float = 0.4
|
||||
const SHIP_ROUTE_MARGIN: float = 40.0
|
||||
## The route keeps this much open water between itself and the coast. The planner tries
|
||||
## routes from SHIP_OFFSET_MIN to SHIP_OFFSET_MAX from the middle of the world, in
|
||||
## SHIP_OFFSET_STEP steps, and takes the first that is clear, for up to SHIP_ROUTE_TRIES
|
||||
## headings. Sea counts as open where the bottom is SHIP_DRAUGHT under the water.
|
||||
const SHIP_COAST_CLEARANCE: float = 45.0
|
||||
const SHIP_DRAUGHT: float = 1.0
|
||||
const SHIP_OFFSET_MIN: float = 300.0
|
||||
const SHIP_OFFSET_MAX: float = 465.0
|
||||
const SHIP_OFFSET_STEP: float = 6.0
|
||||
const SHIP_CLEARANCE_STEP: float = 6.0
|
||||
const SHIP_ROUTE_TRIES: int = 32
|
||||
## A route shorter than this (one cutting a corner of the world) isn't used.
|
||||
const SHIP_MIN_ROUTE_METRES: float = 420.0
|
||||
## The lifeline mortar: every shot climbs at MORTAR_RISE_SPEED; its speed over the
|
||||
## ground runs from MORTAR_MIN_SPEED to MORTAR_MAX_SPEED with the charge, which comes
|
||||
## from how high the player aims, from MORTAR_PITCH_LOW_DEGREES to ..._HIGH_DEGREES.
|
||||
const MORTAR_RISE_SPEED: float = 75.0
|
||||
const MORTAR_MIN_SPEED: float = 16.0
|
||||
const MORTAR_MAX_SPEED: float = 110.0
|
||||
const MORTAR_PITCH_LOW_DEGREES: float = -10.0
|
||||
const MORTAR_PITCH_HIGH_DEGREES: float = 45.0
|
||||
## Riders fired at the end of the route are sent this fraction of the way to the middle
|
||||
## of the island, so they land inland without all landing on one spot.
|
||||
const MORTAR_FORCED_REACH: float = 0.8
|
||||
const FREEFALL_MAX_SPEED: float = 32.0
|
||||
## Horizontal speed a falling player can steer to, before and after the sail opens.
|
||||
## Horizontal speed a falling player can steer to, before and after the kite opens.
|
||||
const FREEFALL_STEER_SPEED: float = 9.0
|
||||
const GLIDE_SPEED: float = 13.0
|
||||
## How fast horizontal speed changes while steering a fall, in metres per second squared.
|
||||
const DROP_STEER_ACCEL: float = 20.0
|
||||
## Sink rate under an open wing-sail, and how hard opening it brakes the fall.
|
||||
## Sink rate under an open gull-kite, and how hard opening it brakes the fall.
|
||||
const GLIDE_FALL_SPEED: float = 5.5
|
||||
const GLIDE_BRAKE: float = 60.0
|
||||
## The sail opens by itself this high above the ground or water.
|
||||
const WING_AUTO_DEPLOY_HEIGHT: float = 40.0
|
||||
## Within this height of the ground or water, the sail folds and the player drops the rest.
|
||||
## The kite opens by itself this high above the ground or water.
|
||||
const KITE_AUTO_DEPLOY_HEIGHT: float = 40.0
|
||||
## Within this height of the ground or water, the kite folds and the player drops the rest.
|
||||
const DROP_LAND_HANDOFF: float = 1.0
|
||||
|
||||
# The island. Worldgen fills the whole world square; the island is about a kilometre
|
||||
@@ -265,6 +302,11 @@ const BOT_STUCK_REPATHS: int = 3
|
||||
## Each bot re-checks its remaining path against grid changes this often, in ticks.
|
||||
const BOT_PATH_CHECK_TICKS: int = 15
|
||||
|
||||
## Duos (M7): a bot goes to revive a downed teammate this close, unless it's in a fight.
|
||||
const BOT_REVIVE_METRES: float = 60.0
|
||||
## Duos: a roaming bot this far from its teammate heads back to them.
|
||||
const BOT_REGROUP_METRES: float = 30.0
|
||||
|
||||
# Bot brains. Bots loot, fight, heal and keep ahead of the tide with only what a player
|
||||
# would know: what they can see, the map's points of interest, and the tide forecast.
|
||||
## Per difficulty: `reaction` is seconds between first seeing an opponent and firing,
|
||||
@@ -297,7 +339,10 @@ const BOT_ENGAGE_METRES: float = 30.0
|
||||
## away from its opponent, and won't break off again until as long again has passed.
|
||||
const BOT_RETREAT_SECONDS: float = 6.0
|
||||
const BOT_RETREAT_METRES: float = 30.0
|
||||
## A bot weighs this many landing spots near the barge's line and takes the one with
|
||||
## A bot lands at a loot marker no further than this from the ship's line (#72: within
|
||||
## the lifeline mortar's reach).
|
||||
const BOT_LANDING_REACH_METRES: float = 600.0
|
||||
## A bot weighs this many landing spots near the ship's line and takes the one with
|
||||
## the fewest other bots' landings within BOT_LANDING_SPREAD_METRES.
|
||||
const BOT_LANDING_CHOICES: int = 8
|
||||
const BOT_LANDING_SPREAD_METRES: float = 60.0
|
||||
@@ -324,6 +369,47 @@ const BOT_LOOT_TIDE_SECONDS: float = 30.0
|
||||
## Bots give up on a loot spot or an item they can't get to after this long.
|
||||
const BOT_LOOT_TIMEOUT_SECONDS: float = 45.0
|
||||
const BOT_PICKUP_TIMEOUT_SECONDS: float = 8.0
|
||||
## M6, bots that build. An armed bot with nothing more pressing gathers with the
|
||||
## boathook until its best material reaches BOT_BUILD_STOCK (in the last
|
||||
## BOT_STRAND_PHASES tide phases, enough for four breakwaters): from a prop within
|
||||
## BOT_HARVEST_NEAR_METRES while it loots, or BOT_HARVEST_METRES once it has nothing
|
||||
## left to loot. It gives up on a prop after BOT_HARVEST_SECONDS. It doesn't start
|
||||
## within BOT_GATHER_QUIET_SECONDS of last seeing an opponent or being hit, or with
|
||||
## health and armor under BOT_GATHER_HEALTH.
|
||||
const BOT_BUILD_STOCK: int = 60
|
||||
const BOT_GATHER_QUIET_SECONDS: float = 10.0
|
||||
const BOT_GATHER_HEALTH: int = 60
|
||||
const BOT_HARVEST_NEAR_METRES: float = 12.0
|
||||
const BOT_HARVEST_METRES: float = 24.0
|
||||
const BOT_HARVEST_SECONDS: float = 12.0
|
||||
## Cover: a bot shot while it reloads, within a second of first seeing its shooter, or
|
||||
## with health and armor down to BOT_COVER_HEALTH, puts a wall between them, and waits
|
||||
## behind it at least BOT_COVER_HOLD_SECONDS and until any reload is done. Only for a
|
||||
## shooter at least BOT_COVER_MIN_METRES off, and no more often than BOT_COVER_SECONDS.
|
||||
const BOT_COVER_HOLD_SECONDS: float = 2.0
|
||||
const BOT_COVER_HEALTH: int = 60
|
||||
const BOT_COVER_MIN_METRES: float = 6.0
|
||||
const BOT_COVER_SECONDS: float = 5.0
|
||||
## A badly hurt bot that could break off (BOT_DIFFICULTIES "retreat") and can afford a
|
||||
## wall walls itself off and heals there instead, for up to this long.
|
||||
const BOT_COVER_HEAL_SECONDS: float = 7.0
|
||||
## Ramps: up toward an opponent at least BOT_RAMP_RISE_METRES higher, within
|
||||
## BOT_RAMP_REACH_METRES across, and up ground at least this steep (rise over run).
|
||||
## At most BOT_RAMP_MAX ramps a fight; the bot walks on BOT_RAMP_WALK_SECONDS after each.
|
||||
const BOT_RAMP_RISE_METRES: float = 3.0
|
||||
const BOT_RAMP_REACH_METRES: float = 24.0
|
||||
const BOT_RAMP_SLOPE: float = 0.5
|
||||
const BOT_RAMP_MAX: int = 5
|
||||
const BOT_RAMP_WALK_SECONDS: float = 1.5
|
||||
## At the last stand (a tide phase that leaves no dry ground), a bot on the last high
|
||||
## point rings its own cell with breakwaters once the rise is this close.
|
||||
const BOT_RING_SECONDS: float = 30.0
|
||||
## In the last this many tide phases, a bot running from the tide that can't reach dry
|
||||
## ground before the sea reaches its feet rings its cell with breakwaters instead, if
|
||||
## the coming level is one they hold back (BREAKWATER_MAX_HEAD, less a metre).
|
||||
const BOT_STRAND_PHASES: int = 3
|
||||
## A fight ends for the measurement (M6) once the bot has had nobody to fight this long.
|
||||
const BOT_FIGHT_GAP_SECONDS: float = 4.0
|
||||
|
||||
# Building
|
||||
const GRID_CELL_METRES: float = 4.0
|
||||
@@ -545,7 +631,7 @@ const LOOT_SCATTER_METRES: float = 0.7
|
||||
# Balance targets (H3), judged by `make balance` over bot-only matches; see docs/BALANCE.md.
|
||||
## The pass needs at least this many matches.
|
||||
const BALANCE_MIN_MATCHES: int = 200
|
||||
## The median match, from the barge leaving to the last player standing, lasts this
|
||||
## The median match, from the ship leaving to the last player standing, lasts this
|
||||
## many minutes.
|
||||
const BALANCE_MEDIAN_MINUTES_MIN: float = 12.0
|
||||
const BALANCE_MEDIAN_MINUTES_MAX: float = 18.0
|
||||
|
||||
+5
-1
@@ -269,10 +269,14 @@ static func _pull(sim: Simulation, player: SimEntity, point: Vector3, speed: flo
|
||||
|
||||
|
||||
## Takes `amount` from armor, then health. Returns the damage actually done. `item` is
|
||||
## the weapon's item code, or -1, for the kill feed.
|
||||
## the weapon's item code, or -1, for the kill feed. Every weapon, the boathook and
|
||||
## blasts come through here, so this is the one team rule: nobody can hurt a teammate
|
||||
## (M7). Hurting yourself, as with your own keg, still counts.
|
||||
static func damage_player(sim: Simulation, victim: SimEntity, amount: int, attacker: int, headshot: bool = false, item: int = -1) -> int:
|
||||
if victim == null or victim.eliminated or amount <= 0:
|
||||
return 0
|
||||
if attacker != 0 and sim.are_teammates(victim, sim.entities.find(attacker)):
|
||||
return 0
|
||||
var to_armor: int = mini(victim.armor, amount)
|
||||
victim.armor -= to_armor
|
||||
var to_health: int = mini(victim.health, amount - to_armor)
|
||||
|
||||
+120
-9
@@ -1,22 +1,24 @@
|
||||
## The game's menus (A10), in the paper-and-ink motifs of docs/STYLE.md: 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.
|
||||
## The game's menus (A10), in the paper-and-ink motifs of docs/STYLE.md: the welcome
|
||||
## 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, 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
|
||||
## 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.
|
||||
class_name Menus
|
||||
extends Control
|
||||
|
||||
signal practice_requested(bots: int, difficulty: 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 resume_requested
|
||||
signal leave_requested
|
||||
signal quit_requested
|
||||
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 FONT_TITLE: int = 40
|
||||
const FONT_HEADING: int = 24
|
||||
@@ -41,6 +43,7 @@ var _binding_note: Label
|
||||
## Practice.
|
||||
var _bots: SpinBox
|
||||
var _difficulty: OptionButton
|
||||
var _mode: OptionButton
|
||||
## Join.
|
||||
var _name: LineEdit
|
||||
var _address: LineEdit
|
||||
@@ -60,6 +63,12 @@ var _volumes: Dictionary = {}
|
||||
var _window_mode: OptionButton
|
||||
var _vsync: CheckButton
|
||||
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.
|
||||
var _results_title: Label
|
||||
var _results_body: Label
|
||||
@@ -77,6 +86,7 @@ var over_match: bool = false:
|
||||
|
||||
func _init() -> void:
|
||||
name = "Menus"
|
||||
PadInput.install_menu_actions()
|
||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
theme = MenuTheme.make()
|
||||
backdrop = MenuBackdrop.new()
|
||||
@@ -88,6 +98,7 @@ func _init() -> void:
|
||||
shade.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
shade.visible = false
|
||||
add_child(shade)
|
||||
_build_welcome()
|
||||
_build_main()
|
||||
_build_practice()
|
||||
_build_join()
|
||||
@@ -205,7 +216,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
return
|
||||
if not listening_for.is_empty():
|
||||
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()
|
||||
get_viewport().set_input_as_handled()
|
||||
elif code != 0:
|
||||
@@ -336,6 +351,7 @@ func _build_main() -> void:
|
||||
notice.add_theme_color_override("font_color", Palette.OCHRE_RED)
|
||||
column.add_child(notice)
|
||||
_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, "Settings", func() -> void: show_screen("settings"))
|
||||
_button(column, "Quit", func() -> void: quit_requested.emit())
|
||||
@@ -348,6 +364,28 @@ func _build_main() -> void:
|
||||
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:
|
||||
var column: VBoxContainer = _panel("practice", "Practice")
|
||||
_bots = SpinBox.new()
|
||||
@@ -360,6 +398,10 @@ func _build_practice() -> void:
|
||||
for index: int in Tuning.BOT_DIFFICULTIES.size():
|
||||
_difficulty.add_item(String(Tuning.BOT_DIFFICULTIES[index]["name"]).capitalize(), index + 1)
|
||||
_row(column, "Bot skill", _difficulty)
|
||||
_mode = OptionButton.new()
|
||||
_mode.add_item("Solo", 1)
|
||||
_mode.add_item("Duos, with a bot crewmate", Tuning.DUO_TEAM_SIZE)
|
||||
_row(column, "Crew", _mode)
|
||||
_button(column, "Set out", _start_practice)
|
||||
_button(column, "Back", back)
|
||||
|
||||
@@ -367,8 +409,9 @@ func _build_practice() -> void:
|
||||
func _start_practice() -> void:
|
||||
settings.practice_bots = int(_bots.value)
|
||||
settings.practice_difficulty = _difficulty.selected - 1
|
||||
settings.practice_team_size = _mode.get_item_id(_mode.selected)
|
||||
save_settings()
|
||||
practice_requested.emit(settings.practice_bots, settings.practice_difficulty)
|
||||
practice_requested.emit(settings.practice_bots, settings.practice_difficulty, settings.practice_team_size)
|
||||
|
||||
|
||||
func _build_join() -> void:
|
||||
@@ -466,6 +509,7 @@ func _build_settings() -> void:
|
||||
var controls_scroll: ScrollContainer = ScrollContainer.new()
|
||||
controls_scroll.name = "Controls"
|
||||
controls_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||
controls_scroll.follow_focus = true
|
||||
_tabs.add_child(controls_scroll)
|
||||
var controls: VBoxContainer = VBoxContainer.new()
|
||||
controls.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
@@ -496,6 +540,38 @@ func _build_settings() -> void:
|
||||
_invert.toggled.connect(func(on: bool) -> void: settings.mouse.invert_y = on)
|
||||
_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")
|
||||
_quality = OptionButton.new()
|
||||
for index: int in GameSettings.QUALITY_NAMES.size():
|
||||
@@ -529,6 +605,34 @@ func _build_settings() -> void:
|
||||
_max_fps.item_selected.connect(func(index: int) -> void: settings.max_fps = GameSettings.FRAME_CAPS[index])
|
||||
_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.text = "Choose an action to change its key."
|
||||
_tabs.tab_changed.connect(func(tab: int) -> void: _binding_note.visible = tab == 0)
|
||||
@@ -580,6 +684,7 @@ func _build_results() -> void:
|
||||
func _refresh_controls() -> void:
|
||||
_bots.value = settings.practice_bots
|
||||
_difficulty.selected = settings.practice_difficulty + 1
|
||||
_mode.selected = maxi(_mode.get_item_index(settings.practice_team_size), 0)
|
||||
_name.text = settings.player_name
|
||||
if _address.text.is_empty():
|
||||
_address.text = settings.last_server
|
||||
@@ -594,7 +699,13 @@ func _refresh_controls() -> void:
|
||||
_window_mode.selected = settings.window_mode
|
||||
_vsync.set_pressed_no_signal(settings.vsync)
|
||||
_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)
|
||||
_refresh_bindings()
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1 @@
|
||||
uid://s4xeekurih46
|
||||
@@ -88,7 +88,7 @@ static func format(a: Dictionary) -> String:
|
||||
var m: Dictionary = a["minutes"]
|
||||
lines.append("Tidewall balance report: %d bot-only matches, %d players each" % [a["matches"], Tuning.SOLO_PLAYERS])
|
||||
lines.append("")
|
||||
lines.append("Match length (minutes from the barge leaving):")
|
||||
lines.append("Match length (minutes from the ship leaving):")
|
||||
lines.append(" min %.1f p10 %.1f p25 %.1f median %.1f p75 %.1f p90 %.1f max %.1f" % [m["min"], m["p10"], m["p25"], m["median"], m["p75"], m["p90"], m["max"]])
|
||||
lines.append(" target median %.0f to %.0f; %d of %d ended by the tide's clock" % [Tuning.BALANCE_MEDIAN_MINUTES_MIN, Tuning.BALANCE_MEDIAN_MINUTES_MAX, a["timed_out"], a["matches"]])
|
||||
var curve: PackedStringArray = []
|
||||
|
||||
+90
-5
@@ -14,9 +14,23 @@ static func tick_limit() -> int:
|
||||
## "causes": {cause: count}, "places": {difficulty name: [place, ...]},
|
||||
## "eliminations": {difficulty name: count}, "weapon_kills": {item id: count},
|
||||
## "death_seconds": [seconds into the match of each fall], "shots", "slow_ticks",
|
||||
## "timing", "state_hash"}. Seconds count from the barge leaving.
|
||||
static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficulty: int = -1) -> Dictionary:
|
||||
var loop: ServerLoop = ServerLoop.new(seed_value, 0, bots, null, difficulty)
|
||||
## "timing", "state_hash", "building": {"build": group, "control": group}}. Seconds
|
||||
## count from the ship leaving. Each group (M6) adds up its bots' BotBrain.stats and
|
||||
## holds their "bots", "places" and "wins".
|
||||
##
|
||||
## With `team_size` 2 the match is duos (M7), and the result also has "downs",
|
||||
## "revives", "team_hits" (hits that did damage between teammates, which must be 0) and
|
||||
## "winner_teams" (how many teams the winners came from, which must be 1).
|
||||
##
|
||||
## With `split_builders`, only every other bot gathers and builds; the rest are the
|
||||
## control group. Bot difficulty also goes by turns of three, so both groups have each
|
||||
## level equally (within one bot).
|
||||
static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficulty: int = -1, split_builders: bool = false, team_size: int = 1) -> Dictionary:
|
||||
var rules: MatchRules = null
|
||||
if team_size > 1:
|
||||
rules = ServerLoop.immediate_rules(0, bots)
|
||||
rules.team_size = team_size
|
||||
var loop: ServerLoop = ServerLoop.new(seed_value, 0, bots, rules, difficulty)
|
||||
var flow: Match = loop.match_flow
|
||||
var level_of: Dictionary = {}
|
||||
for bot: BotBrain in loop.bots:
|
||||
@@ -25,21 +39,40 @@ static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficul
|
||||
"seed": seed_value, "finished": false, "winner": 0, "winner_difficulty": "",
|
||||
"timed_out": false, "causes": {}, "places": {}, "eliminations": {}, "shots": 0,
|
||||
"slow_ticks": [], "weapon_kills": {}, "death_seconds": [],
|
||||
"downs": 0, "revives": 0, "team_hits": 0, "winner_teams": 0,
|
||||
}
|
||||
var limit: int = tick_limit()
|
||||
var split: bool = false
|
||||
while loop.ticks < limit and flow.phase != Match.RESULTS:
|
||||
if split_builders and not split and not loop.bots.is_empty():
|
||||
# The bots join when the match starts, before any of them thinks.
|
||||
split = true
|
||||
for index: int in loop.bots.size():
|
||||
loop.bots[index].builds = index % 2 == 0
|
||||
var before: int = Time.get_ticks_usec()
|
||||
loop.run_tick()
|
||||
if Time.get_ticks_usec() - before > ServerLoop.TICK_BUDGET_USEC:
|
||||
result["slow_ticks"].append(loop.sim.tick)
|
||||
for event: Dictionary in loop.sim.events:
|
||||
if event["type"] == "shot":
|
||||
result["shots"] += 1
|
||||
match String(event["type"]):
|
||||
"shot":
|
||||
result["shots"] += 1
|
||||
"downed":
|
||||
result["downs"] += 1
|
||||
"revived":
|
||||
result["revives"] += 1
|
||||
"player_hit":
|
||||
if int(event["armor"]) + int(event["health"]) > 0 and loop.sim.are_teammates(loop.sim.entities.find(int(event["victim"])), loop.sim.entities.find(int(event["player"]))):
|
||||
result["team_hits"] += 1
|
||||
for event: Dictionary in flow.events:
|
||||
if event["type"] == "match_ended":
|
||||
result["timed_out"] = event["timed_out"]
|
||||
result["ticks"] = loop.sim.tick
|
||||
result["finished"] = flow.phase == Match.RESULTS
|
||||
var winner_teams: Dictionary = {}
|
||||
for handle: int in flow.winners:
|
||||
winner_teams[flow.team_of[handle]] = true
|
||||
result["winner_teams"] = winner_teams.size()
|
||||
if flow.winners.size() > 0:
|
||||
result["winner"] = flow.winners[0]
|
||||
result["winner_difficulty"] = level_of.get(flow.winners[0], "")
|
||||
@@ -62,6 +95,19 @@ static func run_match(seed_value: int, bots: int = Tuning.SOLO_PLAYERS, difficul
|
||||
# The boathook isn't in the catalog: its code is ItemCatalog.NONE.
|
||||
var weapon: String = def.id if def != null else (ItemCatalog.BOATHOOK if int(record["item"]) == ItemCatalog.NONE else "unknown")
|
||||
result["weapon_kills"][weapon] = int(result["weapon_kills"].get(weapon, 0)) + 1
|
||||
var place_of: Dictionary = {}
|
||||
for row: Dictionary in flow.summary():
|
||||
place_of[row["handle"]] = row["place"]
|
||||
var groups: Dictionary = {"build": _empty_group(), "control": _empty_group()}
|
||||
for bot: BotBrain in loop.bots:
|
||||
var group: Dictionary = groups["build" if bot.builds else "control"]
|
||||
group["bots"] += 1
|
||||
for key: String in bot.stats:
|
||||
group[key] += int(bot.stats[key])
|
||||
var place: int = int(place_of.get(flow.handle_of[bot.player_id], 0))
|
||||
group["places"].append(place)
|
||||
group["wins"] += 1 if place == 1 else 0
|
||||
result["building"] = groups
|
||||
result["timing"] = loop.timing_stats()
|
||||
result["state_hash"] = loop.sim.state_hash()
|
||||
return result
|
||||
@@ -104,3 +150,42 @@ static func summarise(results: Array[Dictionary]) -> Dictionary:
|
||||
total["drown_share"] = float(total["causes"].get("drown", 0)) / maxi(total["deaths"], 1)
|
||||
total["mean_ticks"] = ticks / maxi(results.size(), 1)
|
||||
return total
|
||||
|
||||
|
||||
static func _empty_group() -> Dictionary:
|
||||
var group: Dictionary = {"bots": 0, "places": [], "wins": 0}
|
||||
for key: String in BotBrain.new(0).stats:
|
||||
group[key] = 0
|
||||
return group
|
||||
|
||||
|
||||
## Adds up the "building" groups of run_match() results: per group the totals, plus
|
||||
## "mean_place", "fight_share_built" (fights with a piece placed in them, of all
|
||||
## fights), "stocked_share" (fights begun with the materials for a wall, of all fights),
|
||||
## "stocked_share_built" (of those, the ones built in) and "fight_loss" (fights lost,
|
||||
## of all fights), and for the build group
|
||||
## "loss_when_built" and "loss_when_not".
|
||||
static func summarise_building(results: Array[Dictionary]) -> Dictionary:
|
||||
var total: Dictionary = {"build": _empty_group(), "control": _empty_group()}
|
||||
for result: Dictionary in results:
|
||||
for name: String in total:
|
||||
var group: Dictionary = result["building"][name]
|
||||
for key: String in group:
|
||||
if key == "places":
|
||||
total[name]["places"].append_array(group["places"])
|
||||
else:
|
||||
total[name][key] += int(group[key])
|
||||
for name: String in total:
|
||||
var group: Dictionary = total[name]
|
||||
var sum: int = 0
|
||||
for place: int in group["places"]:
|
||||
sum += place
|
||||
group["mean_place"] = float(sum) / maxi(group["places"].size(), 1)
|
||||
group["fight_share_built"] = float(group["fights_built"]) / maxi(group["fights"], 1)
|
||||
group["stocked_share"] = float(group["fights_stocked"]) / maxi(group["fights"], 1)
|
||||
group["stocked_share_built"] = float(group["fights_stocked_built"]) / maxi(group["fights_stocked"], 1)
|
||||
group["fight_loss"] = float(group["fights_lost"]) / maxi(group["fights"], 1)
|
||||
group["loss_when_built"] = float(group["fights_built_lost"]) / maxi(group["fights_built"], 1)
|
||||
group["loss_when_not"] = float(group["fights_lost"] - group["fights_built_lost"]) / maxi(group["fights"] - group["fights_built"], 1)
|
||||
group.erase("places")
|
||||
return total
|
||||
|
||||
@@ -446,3 +446,66 @@ func test_a_bot_with_nothing_to_do_holds_its_ground() -> void:
|
||||
_run(roundi(Tuning.BOT_HOLD_SECONDS * 0.8) * TICKS)
|
||||
assert_true(me.position.distance_to(at) < 3.0, "and stays put while holding (moved %.1f m)" % me.position.distance_to(at))
|
||||
assert_true(at.distance_to(HOME) <= Tuning.BOT_ROAM_METRES + 5.0, "it didn't roam far (%.1f m)" % at.distance_to(HOME))
|
||||
|
||||
|
||||
# Duos (M7): bots as teammates.
|
||||
|
||||
func test_bots_never_target_or_shoot_a_teammate() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
var mate: SimEntity = _player(HOME + Vector3(8.0, 0.0, 0.0))
|
||||
sim.set_team(me.id, 0)
|
||||
sim.set_team(mate.id, 0)
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
_run(3 * TICKS)
|
||||
assert_eq(brain.target_id, 0, "a teammate in plain view isn't a target")
|
||||
assert_eq(int(shots_by.get(me.id, 0)), 0)
|
||||
assert_eq(mate.health, Tuning.PLAYER_MAX_HEALTH)
|
||||
|
||||
|
||||
func test_a_bot_goes_to_a_downed_teammate_and_revives_them() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
var mate: SimEntity = _player(HOME + Vector3(12.0, 0.0, 6.0))
|
||||
sim.set_team(me.id, 0)
|
||||
sim.set_team(mate.id, 0)
|
||||
_ready_world()
|
||||
mate.health = 0
|
||||
_run(1)
|
||||
assert_true(mate.downed)
|
||||
var revived: Array[bool] = [false]
|
||||
var states: Dictionary = {}
|
||||
_run(20 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
for event: Dictionary in sim.events:
|
||||
if event["type"] == "revived" and event["by"] == me.id:
|
||||
revived[0] = true
|
||||
return revived[0])
|
||||
assert_true(states.has("revive"), "states: %s" % [states.keys()])
|
||||
assert_true(revived[0], "revived within 20 s (mate downed: %s, %.1f m apart)" % [mate.downed, me.position.distance_to(mate.position)])
|
||||
assert_false(mate.downed)
|
||||
assert_true(Simulation.is_standing(mate))
|
||||
|
||||
|
||||
func test_a_downed_bot_crawls_toward_its_standing_teammate() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
var mate: SimEntity = _player(HOME + Vector3(10.0, 0.0, 0.0))
|
||||
sim.set_team(me.id, 0)
|
||||
sim.set_team(mate.id, 0)
|
||||
_ready_world()
|
||||
me.health = 0
|
||||
_run(1)
|
||||
assert_true(me.downed)
|
||||
var before: float = me.position.distance_to(mate.position)
|
||||
_run(3 * TICKS)
|
||||
assert_eq(brain.state, "downed")
|
||||
var after: float = me.position.distance_to(mate.position)
|
||||
assert_near(before - after, 3.0 * Tuning.DOWNED_CRAWL_SPEED, 0.5, "crawled toward the teammate")
|
||||
assert_eq(int(shots_by.get(me.id, 0)), 0)
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
extends TestCase
|
||||
|
||||
## Bots that build, from issue M6: they gather materials with the boathook, wall off a
|
||||
## shooter while they reload, wall off and heal instead of running when badly hurt,
|
||||
## ramp up to an opponent on a cliff, and ring their cell with breakwaters at the last
|
||||
## stand. Every piece goes through the same build command and checks as a player's.
|
||||
|
||||
const FLOOR: float = 20.0
|
||||
const HOME: Vector3 = Vector3(202.0, FLOOR, 202.0)
|
||||
const TICKS: int = Tuning.TICK_RATE_HZ
|
||||
## Yaw steps facing +x.
|
||||
const FACING_X: int = PlayerCommand.YAW_STEPS / 4
|
||||
|
||||
var sim: Simulation
|
||||
var grid: NavGrid
|
||||
var world: BotWorld
|
||||
var brains: Array[BotBrain] = []
|
||||
## Victim ID -> attacker ID, written into the bots' world every tick, as if each victim
|
||||
## kept being hit by its attacker.
|
||||
var hits: Dictionary = {}
|
||||
|
||||
|
||||
func _setup(ground: SimGround = null) -> void:
|
||||
sim = Simulation.new(7, ground if ground != null else SimGround.flat(FLOOR))
|
||||
brains.clear()
|
||||
hits.clear()
|
||||
|
||||
|
||||
func _player(at: Vector3, yaw: int = 0) -> SimEntity:
|
||||
var player: SimEntity = sim.entities.find(sim.add_player())
|
||||
player.position = at
|
||||
player.on_ground = true
|
||||
player.yaw = yaw
|
||||
return player
|
||||
|
||||
|
||||
func _bot(at: Vector3, level: int = BotBrain.NORMAL, yaw: int = 0) -> BotBrain:
|
||||
var brain: BotBrain = BotBrain.new(_player(at, yaw).id, level)
|
||||
brains.append(brain)
|
||||
return brain
|
||||
|
||||
|
||||
func _pin(brain: BotBrain) -> void:
|
||||
brain._hunt_goal = sim.entities.find(brain.player_id).position
|
||||
brain._holding = true
|
||||
brain._hunt_until = 1 << 30
|
||||
|
||||
|
||||
func _arm(player: SimEntity, rounds: int = 150) -> void:
|
||||
assert_eq(Inventory.give(player, ItemCatalog.code_of("dock_carbine"), 1), 0)
|
||||
Inventory.give(player, ItemCatalog.code_of("cartridges"), rounds)
|
||||
|
||||
|
||||
func _ready_world() -> void:
|
||||
grid = NavGrid.build(sim)
|
||||
world = BotWorld.build(sim, grid)
|
||||
for entity: SimEntity in sim.entities.entities():
|
||||
if entity.archetype == SimEntity.ARCHETYPE_PLAYER:
|
||||
world.player_ids.append(entity.id)
|
||||
|
||||
|
||||
func _run(ticks: int, until: Callable = Callable()) -> void:
|
||||
for _index: int in ticks:
|
||||
grid.sync(sim)
|
||||
world.observe(sim)
|
||||
for victim: int in hits:
|
||||
world.attackers[victim] = hits[victim]
|
||||
for brain: BotBrain in brains:
|
||||
sim.submit_command(brain.player_id, brain.think(sim, grid, world))
|
||||
sim.step()
|
||||
if until.is_valid() and until.call():
|
||||
return
|
||||
|
||||
|
||||
func _pieces_of(owner: int, kind: int = -1) -> Array[StructureSet.Piece]:
|
||||
var found: Array[StructureSet.Piece] = []
|
||||
for piece: StructureSet.Piece in sim.structures.pieces.values():
|
||||
if piece.owner == owner and (kind < 0 or piece.kind == kind):
|
||||
found.append(piece)
|
||||
return found
|
||||
|
||||
|
||||
## Puts a single boulder (stone) on the flat test ground, `at` its footprint centre.
|
||||
func _boulder(at: Vector3) -> void:
|
||||
var props: PropSet = PropSet.new()
|
||||
props.kinds.append(PropSet.KINDS.find("boulder"))
|
||||
props.positions.append(at)
|
||||
props.yaws.append(0.0)
|
||||
props.boxes.append(AABB(at - Vector3(1.0, 0.0, 1.0), Vector3(2.0, 1.5, 2.0)))
|
||||
props.health.append(int(Tuning.PROP_KINDS["boulder"]["health"]))
|
||||
props.add_solids_to(sim.ground)
|
||||
sim.props = props
|
||||
sim.structures.props = props
|
||||
|
||||
|
||||
func test_an_armed_bot_gathers_materials_from_a_prop_nearby() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
_boulder(HOME + Vector3(6.0, 0.0, 0.0))
|
||||
_ready_world()
|
||||
var states: Dictionary = {}
|
||||
_run(20 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return me.materials[Materials.STONE] >= Tuning.HARVEST_PER_HIT * 3)
|
||||
assert_true(states.has("gather"), "it went to gather: %s" % [states.keys()])
|
||||
assert_true(me.materials[Materials.STONE] >= Tuning.HARVEST_PER_HIT * 3, "it broke stone (%d)" % me.materials[Materials.STONE])
|
||||
_run(1)
|
||||
assert_eq(brain.stats["harvested"], me.materials[Materials.STONE])
|
||||
|
||||
|
||||
func test_a_bot_with_enough_stock_or_no_weapon_leaves_props_alone() -> void:
|
||||
for armed: bool in [true, false]:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
if armed:
|
||||
_arm(me)
|
||||
me.materials[Materials.DRIFTWOOD] = Tuning.BOT_BUILD_STOCK
|
||||
_boulder(HOME + Vector3(6.0, 0.0, 0.0))
|
||||
_ready_world()
|
||||
var states: Dictionary = {}
|
||||
_run(8 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return false)
|
||||
assert_false(states.has("gather"), "armed %s: %s" % [armed, states.keys()])
|
||||
assert_eq(me.materials[Materials.STONE], 0)
|
||||
|
||||
|
||||
func test_a_control_bot_never_gathers_or_builds() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
brain.builds = false
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
_boulder(HOME + Vector3(6.0, 0.0, 0.0))
|
||||
_ready_world()
|
||||
_run(8 * TICKS)
|
||||
assert_eq(me.materials[Materials.STONE], 0)
|
||||
assert_eq(brain.stats["pieces"], 0)
|
||||
|
||||
|
||||
func test_a_bot_shot_at_while_reloading_walls_off_the_shooter() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD, FACING_X)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
me.materials[Materials.DRIFTWOOD] = 50
|
||||
var shooter: SimEntity = _player(HOME + Vector3(20.0, 0.0, 0.0), FACING_X * 3)
|
||||
_arm(shooter)
|
||||
shooter.selected = 1
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
# Seen, then shot while its magazine runs dry.
|
||||
var seen: Dictionary = {}
|
||||
_run(2 * TICKS, func() -> bool:
|
||||
seen[brain.state] = true
|
||||
return brain.state == "fight")
|
||||
assert_eq(brain.state, "fight", "%s target %d visible %s" % [seen.keys(), brain.target_id, brain.target_visible])
|
||||
me.slot_rounds[0] = 0
|
||||
hits[me.id] = shooter.id
|
||||
var states: Dictionary = {}
|
||||
_run(2 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return not _pieces_of(me.id).is_empty())
|
||||
var walls: Array[StructureSet.Piece] = _pieces_of(me.id, StructureSet.WALL)
|
||||
assert_eq(walls.size(), 1, "one wall: %s" % [states.keys()])
|
||||
var wall: AABB = walls[0].boxes[0]
|
||||
assert_true(wall.get_center().x > me.position.x and wall.get_center().x < shooter.position.x, "between them (wall at x %.1f)" % wall.get_center().x)
|
||||
assert_eq(me.materials[Materials.DRIFTWOOD], 50 - StructureSet.cost_of(StructureSet.WALL))
|
||||
hits.clear()
|
||||
_run(Tuning.BOT_SENSE_TICKS + 2)
|
||||
assert_eq(brain.state, "cover")
|
||||
assert_false(brain.target_visible, "the wall hides the shooter")
|
||||
_run(roundi(Tuning.BOT_COVER_HOLD_SECONDS * TICKS) + TICKS)
|
||||
assert_true(me.slot_rounds[0] > 0, "it reloaded behind the wall")
|
||||
assert_ne(brain.state, "cover", "and came out again")
|
||||
|
||||
|
||||
func test_a_badly_hurt_bot_walls_off_and_heals_instead_of_running() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD, FACING_X)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
Inventory.give(me, ItemCatalog.code_of("sailcloth_bandage"), 2)
|
||||
me.health = 30
|
||||
me.materials[Materials.DRIFTWOOD] = 30
|
||||
var other: SimEntity = _player(HOME + Vector3(20.0, 0.0, 0.0), FACING_X * 3)
|
||||
_arm(other)
|
||||
other.selected = 1
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
var states: Dictionary = {}
|
||||
var start: Vector3 = me.position
|
||||
_run(8 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return false)
|
||||
assert_true(states.has("cover"), "it took cover: %s" % [states.keys()])
|
||||
assert_false(states.has("retreat"), "rather than running: %s" % [states.keys()])
|
||||
assert_eq(_pieces_of(me.id, StructureSet.WALL).size(), 1)
|
||||
assert_true(me.health > 30, "and healed (%d)" % me.health)
|
||||
assert_true(me.position.distance_to(start) < 3.0, "where it stood (moved %.1f m)" % me.position.distance_to(start))
|
||||
|
||||
|
||||
## Flat ground with a block 8 m high from x = 212 m: a cliff to its top.
|
||||
func _cliff() -> SimGround:
|
||||
var ground: SimGround = SimGround.flat(FLOOR)
|
||||
ground.add_solid(AABB(Vector3(212.0, 0.0, 180.0), Vector3(30.0, FLOOR + 8.0, 40.0)))
|
||||
return ground
|
||||
|
||||
|
||||
func test_a_bot_ramps_up_a_cliff_to_an_opponent_on_top() -> void:
|
||||
_setup(_cliff())
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD, FACING_X)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
me.materials[Materials.DRIFTWOOD] = 100
|
||||
var above: SimEntity = _player(Vector3(222.0, FLOOR + 8.0, 202.0), FACING_X * 3)
|
||||
_arm(above)
|
||||
above.selected = 1
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
# The one on top keeps shooting down at it.
|
||||
hits[me.id] = above.id
|
||||
var states: Dictionary = {}
|
||||
_run(12 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return me.position.y >= FLOOR + 7.5 and me.on_ground)
|
||||
var ramps: Array[StructureSet.Piece] = _pieces_of(me.id, StructureSet.RAMP)
|
||||
assert_true(ramps.size() >= 2, "a staircase of ramps (%d): %s" % [ramps.size(), states.keys()])
|
||||
assert_true(ramps.size() <= Tuning.BOT_RAMP_MAX)
|
||||
assert_true(me.position.y >= FLOOR + 7.5, "up on top (at %.1f m)" % me.position.y)
|
||||
|
||||
|
||||
func test_a_bot_on_a_gentle_rise_walks_rather_than_ramps() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD, FACING_X)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
me.materials[Materials.DRIFTWOOD] = 100
|
||||
# 4 m higher but 20 m off, with open ground between: no cliff.
|
||||
var other: SimEntity = _player(HOME + Vector3(20.0, 4.0, 0.0), FACING_X * 3)
|
||||
other.on_ground = true
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
hits[me.id] = other.id
|
||||
_run(TICKS)
|
||||
assert_eq(_pieces_of(me.id, StructureSet.RAMP).size(), 0)
|
||||
|
||||
|
||||
func test_a_bot_rings_itself_with_breakwaters_at_the_last_stand() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
me.materials[Materials.STONE] = 4 * StructureSet.cost_of(StructureSet.BREAKWATER)
|
||||
sim.start_tide()
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
# Make the first phase a last stand on the bots' map, with its high point where the
|
||||
# bot stands, then fast forward to just before the rise.
|
||||
world.phase_cells[0] = 0
|
||||
world.phase_tops[0] = me.position
|
||||
assert_true(brain._ring_due(sim, world, me) == (sim.tide.ticks_until_rise(sim.tick) <= roundi(Tuning.BOT_RING_SECONDS * TICKS)))
|
||||
var rise_in: int = sim.tide.ticks_until_rise(sim.tick) - roundi(Tuning.BOT_RING_SECONDS * TICKS) + 1
|
||||
sim.tick += maxi(rise_in, 0)
|
||||
_run(TICKS, func() -> bool: return _pieces_of(me.id, StructureSet.BREAKWATER).size() >= 4)
|
||||
var ring: Array[StructureSet.Piece] = _pieces_of(me.id, StructureSet.BREAKWATER)
|
||||
assert_eq(ring.size(), 4, "a breakwater on each side of its cell")
|
||||
var g: float = StructureSet.cell_size()
|
||||
var cell: Vector2i = Vector2i(floori(me.position.x / g), floori(me.position.z / g))
|
||||
for piece: StructureSet.Piece in ring:
|
||||
var centre: Vector3 = piece.boxes[0].get_center()
|
||||
assert_true(absf(centre.x - (cell.x + 0.5) * g) <= g * 0.5 + 0.5 and absf(centre.z - (cell.y + 0.5) * g) <= g * 0.5 + 0.5, "round its own cell")
|
||||
assert_eq(me.materials[Materials.STONE], 0)
|
||||
_run(1)
|
||||
assert_eq(brain.stats["breakwaters"], 4)
|
||||
|
||||
|
||||
func test_fights_are_counted_with_and_without_building() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME, BotBrain.HARD, FACING_X)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
var other: SimEntity = _player(HOME + Vector3(15.0, 0.0, 0.0), FACING_X * 3)
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
_run(15 * TICKS, func() -> bool: return other.eliminated)
|
||||
assert_true(other.eliminated, "it won the fight")
|
||||
_run(roundi((Tuning.BOT_FIGHT_GAP_SECONDS + 1.0) * TICKS))
|
||||
assert_eq(brain.stats["fights"], 1)
|
||||
assert_eq(brain.stats["fights_built"], 0)
|
||||
assert_eq(brain.stats["fights_lost"], 0)
|
||||
|
||||
|
||||
func test_the_batch_summary_compares_builders_with_the_control_group() -> void:
|
||||
var results: Array[Dictionary] = []
|
||||
for builds: Array in [[4, 1, 2, 1], [6, 1, 1, 0]]:
|
||||
var build: Dictionary = BotBatch._empty_group()
|
||||
build["bots"] = 12
|
||||
build["places"] = [1, 3]
|
||||
build["wins"] = 1
|
||||
build["fights"] = builds[0]
|
||||
build["fights_built"] = builds[1]
|
||||
build["fights_lost"] = builds[2]
|
||||
build["fights_built_lost"] = builds[3]
|
||||
build["fights_stocked"] = 2
|
||||
build["fights_stocked_built"] = builds[1]
|
||||
var control: Dictionary = BotBatch._empty_group()
|
||||
control["bots"] = 12
|
||||
control["places"] = [2, 4]
|
||||
control["fights"] = 5
|
||||
control["fights_lost"] = 3
|
||||
results.append({"building": {"build": build, "control": control}})
|
||||
var total: Dictionary = BotBatch.summarise_building(results)
|
||||
assert_eq(total["build"]["fights"], 10)
|
||||
assert_near(total["build"]["fight_share_built"], 0.2, 0.0001)
|
||||
assert_near(total["build"]["stocked_share"], 0.4, 0.0001)
|
||||
assert_near(total["build"]["stocked_share_built"], 0.5, 0.0001)
|
||||
assert_near(total["build"]["fight_loss"], 0.3, 0.0001)
|
||||
assert_near(total["build"]["loss_when_built"], 0.5, 0.0001)
|
||||
assert_near(total["build"]["loss_when_not"], 0.25, 0.0001)
|
||||
assert_near(total["build"]["mean_place"], 2.0, 0.0001)
|
||||
assert_near(total["control"]["mean_place"], 3.0, 0.0001)
|
||||
assert_near(total["control"]["fight_loss"], 0.6, 0.0001)
|
||||
assert_eq(total["build"]["wins"], 2)
|
||||
assert_false(total["build"].has("places"))
|
||||
|
||||
|
||||
func test_a_bot_the_tide_would_catch_rings_itself_in_and_stays_dry() -> void:
|
||||
_setup()
|
||||
var brain: BotBrain = _bot(HOME)
|
||||
var me: SimEntity = sim.entities.find(brain.player_id)
|
||||
_arm(me)
|
||||
me.materials[Materials.STONE] = 4 * StructureSet.cost_of(StructureSet.BREAKWATER)
|
||||
# The tide's late phases: a rise to 3 m over the bot's ground, starting now, with
|
||||
# dry ground 300 m off, far too far to walk before the water arrives.
|
||||
var phases: int = Tide.phase_count()
|
||||
var levels: PackedFloat32Array = PackedFloat32Array()
|
||||
for index: int in phases:
|
||||
levels.append(FLOOR + 3.0 if index >= phases - Tuning.BOT_STRAND_PHASES else FLOOR - 10.0)
|
||||
sim.start_tide()
|
||||
sim.tide = Tide.new(sim.tick - _rise_start_of(phases - Tuning.BOT_STRAND_PHASES), levels)
|
||||
_ready_world()
|
||||
_pin(brain)
|
||||
brain._fleeing = true
|
||||
brain._flee_goal = HOME + Vector3(300.0, 0.0, 0.0)
|
||||
brain._tide_checked = sim.tick
|
||||
assert_true(brain._stranded(sim, world, me), "it can't outrun the water")
|
||||
var states: Dictionary = {}
|
||||
_run(2 * TICKS, func() -> bool:
|
||||
states[brain.state] = true
|
||||
return false)
|
||||
assert_eq(_pieces_of(me.id, StructureSet.BREAKWATER).size(), 4, "it rang its cell: %s" % [states.keys()])
|
||||
var at: Vector3 = me.position
|
||||
_run(20 * TICKS)
|
||||
assert_eq(brain.state, "breakwater", "and stays in it")
|
||||
assert_true(me.position.distance_to(at) < 1.0, "without wandering off (%.1f m)" % me.position.distance_to(at))
|
||||
|
||||
|
||||
## Ticks from the tide's start to the start of phase `index`'s rise.
|
||||
static func _rise_start_of(index: int) -> int:
|
||||
var at: int = 0
|
||||
for phase: int in index + 1:
|
||||
at += roundi(float(Tuning.TIDE_PHASES[phase]["hold"]) * TICKS)
|
||||
if phase < index:
|
||||
at += maxi(roundi(float(Tuning.TIDE_PHASES[phase]["rise"]) * TICKS), 1)
|
||||
return at
|
||||
@@ -0,0 +1 @@
|
||||
uid://dy6flf2fftvmq
|
||||
@@ -12,14 +12,15 @@ func test_a_scripted_seat_sends_commands_like_anyone_else() -> void:
|
||||
assert_eq(loop.bots.size(), 1)
|
||||
for _index: int in Tuning.TICK_RATE_HZ * 24:
|
||||
loop.run_tick()
|
||||
assert_ne(loop.sim.entities.find(1).drop_state, Drop.ABOARD, "the scripted player leapt from the barge")
|
||||
assert_ne(loop.sim.entities.find(1).drop_state, Drop.ABOARD, "the scripted player leapt from the ship")
|
||||
|
||||
|
||||
func test_harvests_driftwood_and_builds_with_it() -> void:
|
||||
# Seed 29 is the match `make match` plays: the player lands, finds a weapon, cuts
|
||||
# driftwood and puts up a breakwater and a wall within a minute. (It was seed 2 until
|
||||
# H3 changed where bots land; there the scripted player now falls in a landing fight.)
|
||||
var loop: ServerLoop = ServerLoop.new(29, 1, 23)
|
||||
# Seed 2 is the match `make match` plays: the player lands, finds a weapon, cuts
|
||||
# driftwood and puts up a breakwater and a wall within a minute. (It was seed 29 from
|
||||
# H3 until the packet ship (#72) changed where everyone lands; on 29 the scripted
|
||||
# player now falls in a landing fight.)
|
||||
var loop: ServerLoop = ServerLoop.new(2, 1, 23)
|
||||
loop.play_humans_by_script()
|
||||
var player: ScriptedPlayer = loop.scripted[0]
|
||||
var placed: int = 0
|
||||
|
||||
@@ -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
|
||||
@@ -6,6 +6,8 @@ extends "res://test/capture/smoke_scene.gd"
|
||||
@export var yaw_degrees: float = 0.0
|
||||
@export var pitch_degrees: float = -8.0
|
||||
@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:
|
||||
@@ -19,6 +21,7 @@ func _add_camera() -> void:
|
||||
camera.yaw = deg_to_rad(yaw_degrees)
|
||||
camera.pitch = deg_to_rad(pitch_degrees)
|
||||
camera.aiming = aiming
|
||||
camera.rig.reduce_motion = reduce_motion
|
||||
if aiming:
|
||||
camera.rig.aim_blend = 1.0
|
||||
add_child(camera)
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
[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_downed"
|
||||
@@ -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
|
||||
@@ -3,7 +3,7 @@
|
||||
## by its autoplay script. The picture is the client's own: its copy of the world, its
|
||||
## predicted player, everyone else as the server's snapshots have them.
|
||||
##
|
||||
## Stages: barge (a few seconds into the drop), glide, landed, and basin: once landed,
|
||||
## Stages: ship (a few seconds into the drop), glide, landed, and basin: once landed,
|
||||
## the server rings a patch of low ground near the shore with breakwaters and play goes
|
||||
## on until the tide has risen past it, so the sea stands outside the ring and the
|
||||
## ground inside, below the sea, stays dry on the client too (issue N11). build and
|
||||
@@ -12,16 +12,23 @@
|
||||
## hud and hud_build (issue A9): once landed, the server hands the player a carbine, a
|
||||
## fowling piece and bandages, wounds them a little and takes three bots out in
|
||||
## different ways, so every part of the HUD has something to show; hud_build then goes
|
||||
## into build mode. Every stage draws the HUD as the client's HudState has it.
|
||||
## into build mode. hud_downed (issue M7) plays duos, with the first bot as the player's
|
||||
## crewmate, and after the hud staging a bot's shot downs the player. Every stage draws
|
||||
## the HUD as the client's HudState has it.
|
||||
extends Node3D
|
||||
|
||||
const DT: float = 1.0 / Tuning.TICK_RATE_HZ
|
||||
const HOST: String = "127.0.0.1"
|
||||
const LIMIT_ROUNDS: int = 200 * Tuning.TICK_RATE_HZ
|
||||
|
||||
@export var stage: String = "barge"
|
||||
@export var stage: String = "ship"
|
||||
@export var match_seed: int = 2
|
||||
@export var bots: int = 23
|
||||
## A13: a colour-vision set (Palette.VISION_*), captions for the sounds of the last
|
||||
## 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 _net: NetServer
|
||||
@@ -30,10 +37,14 @@ var _session: ClientSession
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Palette.vision = vision
|
||||
get_tree().root.content_scale_factor = ui_scale
|
||||
var rules: MatchRules = MatchRules.new()
|
||||
rules.max_players = bots + 1
|
||||
rules.lobby_ticks = 6
|
||||
rules.countdown_ticks = 6
|
||||
if stage == "hud_downed":
|
||||
rules.team_size = Tuning.DUO_TEAM_SIZE
|
||||
_loop = ServerLoop.new(match_seed, 0, bots, rules)
|
||||
_net = NetServer.new()
|
||||
if _net.listen(0, HOST) != OK:
|
||||
@@ -64,17 +75,17 @@ func _ready() -> void:
|
||||
var reached: bool = false
|
||||
if _session.game.playing():
|
||||
match stage:
|
||||
"barge":
|
||||
"ship":
|
||||
reached = me.drop_state == Drop.ABOARD and _session.game.prediction.next_tick > 3 * Tuning.TICK_RATE_HZ
|
||||
"glide":
|
||||
reached = me.drop_state == Drop.GLIDING
|
||||
"landed", "basin", "build", "build_refused", "hud", "hud_build":
|
||||
"landed", "basin", "build", "build_refused", "hud", "hud_build", "hud_downed":
|
||||
reached = me.drop_state == Drop.NONE
|
||||
if reached and since < 0:
|
||||
since = 0
|
||||
elif since >= 0:
|
||||
since += 1
|
||||
if since >= (2 * Tuning.TICK_RATE_HZ if stage != "barge" else 1):
|
||||
if since >= (2 * Tuning.TICK_RATE_HZ if stage != "ship" else 1):
|
||||
break
|
||||
if since < 0:
|
||||
push_error("client capture: never reached stage '%s'" % stage)
|
||||
@@ -94,7 +105,28 @@ func _ready() -> void:
|
||||
return
|
||||
if stage == "hud_build" and _build_mode(true).is_empty():
|
||||
return
|
||||
if stage == "hud_downed":
|
||||
var downed_text: String = _down_player()
|
||||
if downed_text.is_empty():
|
||||
return
|
||||
basin_text += downed_text
|
||||
_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.view.settle()
|
||||
var others: int = 0
|
||||
@@ -139,7 +171,7 @@ func _stage_hud() -> String:
|
||||
var taken: int = 0
|
||||
for bot: int in flow.bot_handles.keys():
|
||||
var player: SimEntity = sim.entities.find(int(flow.entity_of.get(bot, 0)))
|
||||
if player == null or player.eliminated:
|
||||
if player == null or player.eliminated or sim.are_teammates(mine, player):
|
||||
continue
|
||||
player.health = 0
|
||||
player.last_cause = causes[taken]
|
||||
@@ -164,6 +196,35 @@ func _stage_hud() -> String:
|
||||
return " · %d of %d standing, %d feed lines" % [hud.standing, hud.total, hud.feed.size()]
|
||||
|
||||
|
||||
## Duos: a bot's shot takes the player's last health with their crewmate still up, so
|
||||
## they go down. Returns a caption line, or "" after reporting an error.
|
||||
func _down_player() -> String:
|
||||
var flow: Match = _loop.match_flow
|
||||
var sim: Simulation = _loop.sim
|
||||
var mine: SimEntity = sim.entities.find(int(flow.entity_of.get(_session.link.handle, 0)))
|
||||
var foe: SimEntity = null
|
||||
for bot: int in flow.bot_handles.keys():
|
||||
var player: SimEntity = sim.entities.find(int(flow.entity_of.get(bot, 0)))
|
||||
if player != null and not player.eliminated and not sim.are_teammates(mine, player):
|
||||
foe = player
|
||||
break
|
||||
if mine == null or foe == null or not sim.has_standing_teammate(mine):
|
||||
push_error("client capture: no foe, or no crewmate standing, to down the player")
|
||||
return ""
|
||||
mine.armor = 0
|
||||
Weapons.damage_player(sim, mine, mine.health, foe.id, false, ItemCatalog.code_of("dock_carbine"))
|
||||
for _round: int in Tuning.TICK_RATE_HZ:
|
||||
_game.poll()
|
||||
_loop.run_tick()
|
||||
_game.after_tick()
|
||||
_session.pump(DT)
|
||||
var hud: HudState = _session.hud_state()
|
||||
if not mine.downed or not hud.downed:
|
||||
push_error("client capture: the player isn't down (server %s, HUD %s)" % [mine.downed, hud.downed])
|
||||
return ""
|
||||
return " · downed, %d health to bleed" % mine.health
|
||||
|
||||
|
||||
## Stops the autoplay where the player stands and goes into build mode for a driftwood
|
||||
## wall, after the server has given the player plenty of materials or taken them all.
|
||||
## Returns a caption line, or "" after reporting an error.
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
[node name="CaptureClient" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "barge"
|
||||
stage = "ship"
|
||||
@@ -3,7 +3,7 @@
|
||||
## animation, seen from in front and to their right:
|
||||
##
|
||||
## - states: idle, walk, run, crouched, creeping, in the air, skydiving, gliding,
|
||||
## swimming. (Aboard the barge is the idle with the feet set wider; the deck
|
||||
## swimming, downed (M7). (Aboard the ship is the idle with the feet set wider; the deck
|
||||
## placement would pull it out of the row.)
|
||||
## - actions: carrying a longgun, a revolver and a tonic, firing each kind, a boathook
|
||||
## swing, a keg thrown, building, reloading, drinking and a flinch.
|
||||
@@ -24,6 +24,7 @@ const STATES: Array = [
|
||||
["skydive", "", "skydive", 0.8, ""],
|
||||
["glide", "", "glide", 0.8, ""],
|
||||
["swim", "", "swim", 0.35, ""],
|
||||
["downed", "", "downed", 0.5, ""],
|
||||
]
|
||||
const ACTIONS: Array = [
|
||||
["long", "whalers_longgun", "ground", 0.6, ""],
|
||||
@@ -114,6 +115,10 @@ func _stand(at: Vector3, row: Array) -> SimEntity:
|
||||
"swim":
|
||||
player.swimming = true
|
||||
player.on_ground = false
|
||||
"downed":
|
||||
player.downed = true
|
||||
player.crouching = true
|
||||
player.health = Tuning.DOWNED_HEALTH
|
||||
"aboard":
|
||||
player.drop_state = Drop.ABOARD
|
||||
player.on_ground = false
|
||||
@@ -126,7 +131,7 @@ func _stand(at: Vector3, row: Array) -> SimEntity:
|
||||
|
||||
func _pose(player: SimEntity, row: Array) -> void:
|
||||
var figure: FigureRig = view.entities.figure_of(player.id)
|
||||
# The barge's deck isn't drawn here: put the passenger back where it stands.
|
||||
# The ship's deck isn't drawn here: put the passenger back where it stands.
|
||||
figure.position = player.position
|
||||
figure.drive(player, 0.0)
|
||||
figure.drive(player, 1.0)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
## H14: flat ground, a boulder and a post under Look's environment and sun. With
|
||||
## `force_shadows`, the sun casts shadows even where Look.sun_shadows_supported says the
|
||||
## renderer gets them wrong, to recheck the Compatibility renderer after an engine
|
||||
## upgrade: `CAPTURE_RENDERER=compatibility tools/capture.sh sun_shadow_probe out.png`
|
||||
## shows pale sunlit ground for as long as the engine adds the shadowed sun in sRGB.
|
||||
## Compare with the `sun_probe` scenario, the same scene without the override.
|
||||
extends Node3D
|
||||
|
||||
@export var force_shadows: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var world: WorldEnvironment = WorldEnvironment.new()
|
||||
world.environment = Look.environment()
|
||||
add_child(world)
|
||||
var sun: DirectionalLight3D = Look.sun(200.0)
|
||||
if force_shadows:
|
||||
sun.shadow_enabled = true
|
||||
add_child(sun)
|
||||
var plane: PlaneMesh = PlaneMesh.new()
|
||||
plane.size = Vector2(80.0, 80.0)
|
||||
_mesh(plane, Vector3.ZERO, Color(0.31, 0.42, 0.22))
|
||||
var rock: SphereMesh = SphereMesh.new()
|
||||
rock.radius = 1.5
|
||||
rock.height = 2.4
|
||||
_mesh(rock, Vector3(-2.0, 0.8, 2.0), Color(0.47, 0.44, 0.39))
|
||||
var post: BoxMesh = BoxMesh.new()
|
||||
post.size = Vector3(0.6, 4.0, 0.6)
|
||||
_mesh(post, Vector3(3.0, 2.0, 4.0), Color(0.55, 0.36, 0.22))
|
||||
var camera: Camera3D = Camera3D.new()
|
||||
camera.position = Vector3(0.0, 5.0, -10.0)
|
||||
add_child(camera)
|
||||
camera.look_at(Vector3(0.0, 0.0, 4.0))
|
||||
camera.make_current()
|
||||
|
||||
|
||||
func _mesh(mesh: Mesh, at: Vector3, colour: Color) -> void:
|
||||
var material: StandardMaterial3D = StandardMaterial3D.new()
|
||||
material.albedo_color = colour
|
||||
material.roughness = 1.0
|
||||
material.metallic_specular = 0.15
|
||||
var instance: MeshInstance3D = MeshInstance3D.new()
|
||||
instance.mesh = mesh
|
||||
instance.material_override = material
|
||||
instance.position = at
|
||||
add_child(instance)
|
||||
@@ -0,0 +1 @@
|
||||
uid://dl4w8btyw3mll
|
||||
@@ -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"
|
||||
@@ -3,7 +3,7 @@
|
||||
## prints what it shows as a caption (Godot's default font; this is a test caption,
|
||||
## not the game's HUD).
|
||||
##
|
||||
## Stages: lobby, barge, glide, landed, built, final, tide (the island just before the
|
||||
## Stages: lobby, ship, glide, landed, built, final, tide (the island just before the
|
||||
## end, from where the lobby saw it), results.
|
||||
extends Node3D
|
||||
|
||||
@@ -31,8 +31,11 @@ func _ready() -> void:
|
||||
match stage:
|
||||
"lobby":
|
||||
pass
|
||||
"barge":
|
||||
"ship":
|
||||
_replay.run_until(func() -> bool: return flow.in_match() and flow.sim.tick >= 2 * TICKS)
|
||||
"launch":
|
||||
# A bot half a second up the mortar's arc, its lifeline still trailing.
|
||||
_replay.run_until(func() -> bool: return flow.in_match() and _climber() != null and _climber().velocity.y < Tuning.MORTAR_RISE_SPEED - 8.0)
|
||||
"glide":
|
||||
_replay.run_until(func() -> bool: return _player() != null and _player().drop_state == Drop.GLIDING)
|
||||
_run_ticks(TICKS)
|
||||
@@ -67,11 +70,19 @@ func _ready() -> void:
|
||||
if stage == "lobby" or stage == "tide":
|
||||
_view.overview()
|
||||
who = "the island"
|
||||
elif stage == "barge":
|
||||
elif stage == "ship" or stage == "launch":
|
||||
# From over the water astern and seaward of the ship, looking past it to the island.
|
||||
var along: Vector3 = (sim.drop.finish - sim.drop.start).normalized()
|
||||
var at: Vector3 = sim.drop.barge_position(sim.tick)
|
||||
_view.look_from(at - along * 22.0 + Vector3(0.0, 9.0, 0.0) + along.cross(Vector3.UP) * 9.0, at + along * 40.0 - Vector3(0.0, 22.0, 0.0))
|
||||
who = "the barge"
|
||||
var at: Vector3 = sim.drop.ship_position(sim.tick)
|
||||
var centre: Vector3 = Vector3(Tuning.WORLD_SIZE_METRES * 0.5, 0.0, Tuning.WORLD_SIZE_METRES * 0.5)
|
||||
var inland: Vector3 = Vector3(centre.x - at.x, 0.0, centre.z - at.z).normalized()
|
||||
if stage == "ship":
|
||||
_view.look_from(at - along * 26.0 - inland * 16.0 + Vector3(0.0, 11.0, 0.0), at + inland * 30.0 + Vector3(0.0, 2.0, 0.0))
|
||||
who = "the ship"
|
||||
else:
|
||||
var climber: SimEntity = _climber()
|
||||
_view.look_from(at - along * 30.0 - inland * 24.0 + Vector3(0.0, 8.0, 0.0), climber.position.lerp(at, 0.45))
|
||||
who = "a bot fired from the ship"
|
||||
elif watched != 0:
|
||||
var entity: SimEntity = sim.entities.find(flow.entity_of[watched])
|
||||
var airborne: bool = entity.drop_state != Drop.NONE
|
||||
@@ -89,6 +100,17 @@ func _ready() -> void:
|
||||
_caption(_describe(who) + ("" if quality < 0 else "\nquality: %s, renderer: %s" % [GameSettings.QUALITY_NAMES[quality], RenderingServer.get_current_rendering_method()]))
|
||||
|
||||
|
||||
## The first player climbing the mortar's arc, or null.
|
||||
func _climber() -> SimEntity:
|
||||
var sim: Simulation = _replay.flow.sim
|
||||
if sim == null or sim.drop == null:
|
||||
return null
|
||||
for entity: SimEntity in sim.entities.entities():
|
||||
if entity.archetype == SimEntity.ARCHETYPE_PLAYER and entity.drop_state == Drop.FREEFALL and entity.velocity.y > 0.0:
|
||||
return entity
|
||||
return null
|
||||
|
||||
|
||||
func _player() -> SimEntity:
|
||||
var flow: Match = _replay.flow
|
||||
if not flow.entity_of.has(PLAYER):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user