Task #22: the joining player can open the store
Cause: the open path itself worked. A real two-process run with an E key event opened the shed's menu when P2 stood at the counter. What failed in play was reach: - The partner's game never showed the counter's "[E / X] Shop" prompt. CoopSession._gather_node resolved only the workbench and gather points, so P2's replicated focus was null at the counter. P2 couldn't tell where the 2.2 m reach around the counter's invisible point was. - The host took P2's press on the first tick after the input record arrived, before its copy of P2 had eased to the position in that same record. It dropped the press silently if the lagging copy was out of reach. Walking in at 5 or 9 m/s and pressing E at 2.1 m (inside the reach on P2's screen) failed 3/3. The host's copy was 2.31-2.66 m out. Fixes: - The snapshot's focus now resolves the ShedCounter (_focus_node), so the prompt shows. - The host keeps a partner's interact press pending for 0.3 s (Interactions.PRESS_WINDOW) until a counter in reach takes it. - Interact while the partner's shop menu is open closes it on the partner's machine, and that press is taken back (RemoteControls.Sender.take_back), so the host never reopens it. - When the host completes P2's "buy", it sends a "bought" event. Once P2's farm state has the upgrade, the partner's panel emits bought (UpgradePanel.confirm_bought). As in solo, the new weapon goes into P2's hand and the jingle plays. Still paid from P2's pouch, then the shed. - CoopSession.PROTOCOL 4 -> 5. Tests: test_coop _shops covers both shops opening on the client only, the prompt, interact closing, a press taken while the host's copy is 3.8 m out still opening, an early press not opening later, and a client weapon buy paid from P2's pouch and the shed and equipped on both farms. coop_smoke now opens and closes the shed by day with E key events, both standing and on arrival at a run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
287b6ac6cc
commit
315e6890f7
7 changed files with 305 additions and 23 deletions
25
game/COOP.md
25
game/COOP.md
|
|
@ -59,6 +59,10 @@ a knock alone doesn't open it) and stays open for 0.4 s after you stop. Talking
|
|||
distance.
|
||||
- **Shared:** the shed, upgrades, structures, and the vacation itself. Either player can gather,
|
||||
build, repair, buy upgrades, and start the day.
|
||||
- **Shops open on your own screen.** By day, walk up to the Supply Shed's counter (or the work
|
||||
area's bench, once you have it) until "[E / X] Shop" (or "Upgrades") shows, and press E / X.
|
||||
- E / X again, Escape / B, walking off, or nightfall closes it.
|
||||
- A weapon you buy goes into your hand.
|
||||
- **Your pouch is your own.** The materials HUD shows yours.
|
||||
- What you gather goes into your pouch.
|
||||
- Only you walking into the Supply Shed banks it: your friend standing there doesn't.
|
||||
|
|
@ -104,6 +108,18 @@ it acts.
|
|||
Messages that may be lost (snapshots, input) stay under 1,100 bytes. GD-Sync splits datagrams at
|
||||
1,200. Nothing depends on any one of them arriving, and removals are reliable.
|
||||
|
||||
The partner's shops:
|
||||
- **Opening.** The host's copy of the partner's scarecrow trails the partner's own by a few
|
||||
ticks: the input goes out 20 times a second, and the copy eases toward it. So the partner's
|
||||
press of interact waits on the host for up to 0.3 s for that copy to reach a shop's counter,
|
||||
instead of being lost when it was made on arrival. The host then tells the partner's game to
|
||||
open that shop's menu.
|
||||
- **Closing.** Interact again closes the menu on the partner's machine, and that press is never
|
||||
sent.
|
||||
- **Buying.** A purchase goes to the host, which pays it from the partner's pouch and the shed.
|
||||
The partner's game then counts it as bought there, as in solo: a new weapon goes into the
|
||||
partner's hand.
|
||||
|
||||
### Data use (GD-Sync's allowance)
|
||||
|
||||
Online, every byte goes through GD-Sync's servers, and plans are sold by data transfer (the free
|
||||
|
|
@ -141,12 +157,17 @@ message on both sides.
|
|||
the partner moving, gathering, and shooting (and its pick of weapon), each player's own pouch
|
||||
(gathering, the shed, paying, the shared capacity, goop to the killer, leaving), the host's stabs and
|
||||
pumpkin bombs drawn on the partner's farm (harmless there), enemies, loot, and shots arriving, the fall rule
|
||||
and Retry, a crowd with dropped packets, message sizes, and either side leaving.
|
||||
and Retry, a crowd with dropped packets, message sizes, and either side leaving. It also covers
|
||||
the partner's shops: the prompt, either shop's menu opening on the partner's farm only and
|
||||
closing on interact, a press the host gets before its copy of the partner is at the counter,
|
||||
and a weapon bought into P2's hand.
|
||||
- **`game/tools/coop_smoke.gd`** plays a real GD-Sync LAN game between two processes on one
|
||||
machine. The partner joins by address, since broadcasts don't loop back on every machine;
|
||||
`--discover` uses the network announcements instead. `--online` plays through GD-Sync's
|
||||
servers (needs the keys): the partner finds the host's lobby in the online list. Give both
|
||||
sides the same `--host-name`, so an old lobby from an earlier run isn't picked by mistake.
|
||||
sides the same `--host-name`, so an old lobby from an earlier run isn't picked by mistake. By
|
||||
day the partner opens and closes the Supply Shed's menu with the E key: standing at the
|
||||
counter, then pressing on arrival at a run.
|
||||
- **`game/tools/net_budget.gd`** measures the traffic for the GD-Sync data allowance: it plays
|
||||
whole days and nights over a loopback link that packs every message the way GD-Sync does
|
||||
online, and reports what each side sends to the server, by message kind and by phase, plus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue