A joining app plays whatever map its host plays #46

Open
agra wants to merge 2 commits from task/4202-joining-follows-host into master
Owner

Tracker: #4202

Stacked on #44: merge that first. Until it lands this PR also shows the map picker's commit.

--join <address> no longer needs to be told the map: the app asks the host which map it plays before loading anything, and loads that one.

What changes

  • Protocol 13. A new ask and plays pair. The answer carries the client's salt and the map's name, and the server keeps nothing of an ask. An ask carries MAP_NAME_BYTES unread so its answer is never the larger, which keeps the handshake from being an amplifier. A name that does not print or runs past that length does not decode.
  • Server and Host. Server.init takes its map's name, from server.sx and from Host, and Host.start takes a GameMap.
  • The app. hostsMap in main.sx asks while the window keeps answering, as join does, over the same conditioned link. The window now says which map it is loading on every launch, not only after the picker.
  • The bots tool follows the host the same way.

Decisions

  • --map on a joiner is refused at launch. The host chooses the map, so the app exits 2 and says why, and the bots tool no longer takes --map.
  • A map this build does not have prints the server at <address> plays <name>, a map this build does not have and exits 1. The world-hash refusal stays for a host on the same map from another bake.

Also fixed

The test scene holds no bodies or dummies, so a bot's walk over it read past an empty list of targets. A world with fewer targets than a game holds players now gets a ring of them about the clearing.

Evidence

  • tools/gate.sh fast: 112 passed, 0 failed. After it, only test comments changed, and net_handshake and bots passed again.
  • tests/net_host.sx: on each map, a client that has loaded nothing asks a real host over UDP, loads what it names and is welcomed.
  • tests/bots.sx: the tool follows a server on the test scene and a client sees a bot walk; against a server naming an unknown map it prints why and exits 1.
  • The app itself joined a dedicated server on each map with no --map, and each server printed the join. The test scene was seen drawn. The first map's picture and the Loading words on a joining window were not seen, so those are for a person playing to confirm.

Known limit

A client of this version asking a server older than protocol 13 gets no answer, because that server does not know the ask, so it closes after 10 s with has not answered rather than another version.

Head: eda45c05b1

Tracker: [#4202](https://sak.swipelab.com/tasks/4202) Stacked on [#44](https://git.swipelab.com/sx/hulken/pulls/44): merge that first. Until it lands this PR also shows the map picker's commit. `--join <address>` no longer needs to be told the map: the app asks the host which map it plays before loading anything, and loads that one. ## What changes - **Protocol 13.** A new `ask` and `plays` pair. The answer carries the client's salt and the map's name, and the server keeps nothing of an ask. An ask carries `MAP_NAME_BYTES` unread so its answer is never the larger, which keeps the handshake from being an amplifier. A name that does not print or runs past that length does not decode. - **`Server` and `Host`.** `Server.init` takes its map's name, from `server.sx` and from `Host`, and `Host.start` takes a `GameMap`. - **The app.** `hostsMap` in `main.sx` asks while the window keeps answering, as `join` does, over the same conditioned link. The window now says which map it is loading on every launch, not only after the picker. - **The bots tool** follows the host the same way. ## Decisions - **`--map` on a joiner is refused at launch.** The host chooses the map, so the app exits 2 and says why, and the bots tool no longer takes `--map`. - **A map this build does not have** prints `the server at <address> plays <name>, a map this build does not have` and exits 1. The world-hash refusal stays for a host on the same map from another bake. ## Also fixed The test scene holds no bodies or dummies, so a bot's walk over it read past an empty list of targets. A world with fewer targets than a game holds players now gets a ring of them about the clearing. ## Evidence - `tools/gate.sh fast`: 112 passed, 0 failed. After it, only test comments changed, and `net_handshake` and `bots` passed again. - `tests/net_host.sx`: on each map, a client that has loaded nothing asks a real host over UDP, loads what it names and is welcomed. - `tests/bots.sx`: the tool follows a server on the test scene and a client sees a bot walk; against a server naming an unknown map it prints why and exits 1. - The app itself joined a dedicated server on each map with no `--map`, and each server printed the join. The test scene was seen drawn. The first map's picture and the `Loading` words on a joining window were not seen, so those are for a person playing to confirm. ## Known limit A client of this version asking a server older than protocol 13 gets no answer, because that server does not know the ask, so it closes after 10 s with `has not answered` rather than `another version`. Head: eda45c05b1cbadea6e46dbf13b47d6cf40e37199
Launching the app to host opens a panel listing the maps. The pointer or the
up and down keys move its cursor, and a click, Enter or Space chooses a map,
which the app says it is loading, hosts and plays. `--map <name>` skips the
picker, and names the map a joining app, the dedicated server and the bots
tool load, each taking the first map with none.
A client that has loaded nothing asks the server which map it plays, in a new
ask and plays pair of messages, and loads the map the answer names, the window
answering meanwhile. The ask carries MAP_NAME_BYTES unread so that its answer is
never the larger, and the server keeps nothing of it. A server is built with its
map's name, from the dedicated server and from Host, which takes a GameMap.

The host chooses the map, so `--map` beside `--join` is refused at launch and
the bots tool takes no `--map`. A name this build does not have prints why and
exits 1. The window says which map it is loading on every launch.

The bots tool follows the host the same way. The test scene holds no bodies or
dummies, which left a walk reading past its empty list of targets, so a world
with fewer targets than a game holds players gets a ring of them about the
clearing.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/4202-joining-follows-host:task/4202-joining-follows-host
git switch task/4202-joining-follows-host

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff task/4202-joining-follows-host
git switch task/4202-joining-follows-host
git rebase master
git switch master
git merge --ff-only task/4202-joining-follows-host
git switch task/4202-joining-follows-host
git rebase master
git switch master
git merge --no-ff task/4202-joining-follows-host
git switch master
git merge --squash task/4202-joining-follows-host
git switch master
git merge --ff-only task/4202-joining-follows-host
git switch master
git merge task/4202-joining-follows-host
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sx/hulken!46
No description provided.