garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/paired-gestures.md

raw


topic: paired gestures triggers: [core/src/greet.rs, simulator/src/state/greet.rs, simulator/src/net/greet.rs, systems/player/greet.rs, systems::greet, Greeting, OfferGreeting, GreetingOffered, AcceptGreeting, GreetingStarted, "Emote::Handshake", "Emote::HighFive", partner_at, pair_up, ClipPartner, spawn_clip_partner, handshake, highfive, "high five", "protocol 49"] updated: 2026-11-15

Greeting another avatar: a handshake and a high five

Asked for by the owner as "more interaction with other avatars" (2026-11-15). One avatar offers, the other accepts, and the sim starts both bodies at once. Wire protocol 49: OfferGreeting / AcceptGreeting from clients (kinds 128, 130), GreetingOffered / GreetingStarted from the sim (129, 131), and Emote::Handshake / HighFive (plus Throw, a plain emote). The clips are in makehuman-avatars.md.

Where it lives

How it goes

  1. A taps B's avatar; B's person card has "Shake hands" and "High five". Pressing one sends OfferGreeting and closes the card; A's prompt line reads "Shake hands — waiting for B".
  2. The sim checks and sends B GreetingOffered. B's prompt shows "Shake hands with A [E]" and a ✕, above anything else it would offer. E accepts on a keyboard; on touch the button is the way — the same prompt the bench and the ball use, so there is one place to look. With several offers open, the nearest offerer's is shown. ✕ (or doing nothing) lets it lapse: nothing is sent, so the offerer is not told "no".
  3. On AcceptGreeting the sim checks again, stands the two where the clip needs them, turns them, and sets both avatars' emote to the greeting with one sequence for the pair (past both their own), in one call under the world lock. The next snapshot shows both starting to everyone, so every viewer plays them in step; each of the two also gets GreetingStarted with the yaw to face, which the client takes as its facing at once.

What the sim checks

Everything, from its own positions — never the client's word:

Placement: the sim moves them, point-symmetric

Both avatars play the same clip — one subject's side of a two-person take — and the sim stands them point-symmetric about the middle between them: each sees the other at partner_at in its own frame, and they face opposite ways. Then each right palm, at half the partner offset, lands on the same spot halfway between them, by construction (the_palms_meet_halfway). The offset is twice the palm's reach at the moment of contact, measured on the default man by human-pack --add-clip (handshake: 0.85 m apart, partner 18° to the right; high five: 0.81 m, 31°); the takes' own subjects stood 0.74 m and 0.9 m apart. greetings_meet_halfway (the pack's test) holds the pack to those numbers.

The sim moves both positions (accept_greeting, about their old middle, along the line between them, at most ~0.85 m each from 2.5 m apart), rather than each viewer drawing a display offset as a seat does. Chosen because: the offset would have to be unwound when the gesture ends — two people sliding apart again after shaking hands — where a move leaves them standing where they shook; nothing separates where they are from where they are drawn (the thing the seat's offset needed policing for, sitting-down.md); and it needed no new wire field or draw code: remote viewers glide both over by their usual smoothing, and the local client's reconciliation eases its own avatar the same way. The cost is that slide: up to ~0.8 m over about a second with the feet still, which a step clip would hide and none is cut.

What lost: each viewer computing the pair's layout from both avatars' positions (needs a partner id on the wire, and the unwind above); one clip per subject (A plays A's side, B plays B's) — the exact take, but it needs a role on the wire and twice the clips, and the point-symmetric layout already makes the right hands meet; facing straight at each other with the clip's own heading — the hands would then miss sideways by about twice the palm's offset to the right (0.26 m for the handshake).

Limits