| name | snap-spectacles-sync |
| description | Load when the user is building multiplayer / Connected Lenses on Snap Spectacles โ Sync Kit, SessionController, SyncEntity, networked prefabs, host migration, latency-tolerant UX, or asks "how do users share this lens." Don't load for single-user lenses โ use snap-spectacles-build. |
| license | MIT |
| metadata | {"author":"HKTITAN","version":"1.0.0","graph":true,"depends":["snap-spectacles-build"]} |
Spectacles Sync Kit โ Connected Lenses
Sync Kit is the multiplayer layer for Spectacles. It abstracts the network โ sessions, networked state, RPC-like events โ so your script can be "networked" by attaching a SyncEntity. The complexity isn't the API surface; it's the design decisions about who owns what state, how conflicts resolve, and what the UX does when the network blinks.
When to load
Triggers:
- "Spectacles multiplayer"
- "Connected Lenses"
- "How do users share this lens"
- "SyncEntity broken"
- "Networked prefab instantiation"
- "Host migration on Spectacles"
Don't load for:
- Single-user lens basics โ use [[../snap-spectacles-build/SKILL]].
- Snap Cloud (database / backend) โ use [[../snap-spectacles-ai/SKILL]] (Snap Cloud lives there because it's often paired with AI / persistence).
- Phone companion bridges โ use [[../snap-spectacles-mobile-kit/SKILL]].
Decide first
The architecture decisions before code:
- State model. What's per-user (local, never networked) vs shared (every peer sees the same)? Mis-classifying once is a refactor.
- Authority model. Host-authoritative (one user owns state; others read), peer-authoritative (everyone owns their own object), or hybrid? See [[references/host-vs-peer]].
- Conflict resolution. What happens when two users edit the same thing at once? Last-write-wins is the default; sometimes wrong. See [[references/conflict-resolution]].
- Latency budget. What does your UX feel like at 100 ms? At 500 ms? Connected Lenses can have variable latency โ design for the worst-likely.
- Discovery model. How do users find each other's session? Snapcode? Voice "join my session"? See [[references/connected-lens-onboarding]].
Map of content
Foundations
- [[references/session-controller]] โ SessionController as the entry point; current session, peers, lifecycle.
- [[references/session-lifecycle]] โ joining, leaving, reconnecting; what your code should do at each phase.
- [[references/host-vs-peer]] โ authority models; host migration.
Networked state
- [[references/sync-entity]] โ SyncEntity: making any script networked.
- [[references/storage-properties]] โ auto-synced state inside SyncEntities.
- [[references/networked-events]] โ fire-and-forget messages across peers.
- [[references/instantiator]] โ instantiating prefabs across the whole session.
Hard problems
- [[references/ownership-model]] โ who owns this entity; how ownership transfers.
- [[references/conflict-resolution]] โ race conditions, last-write-wins, deterministic merges.
- [[references/latency-patterns]] โ designing UX that tolerates lag; optimistic updates; rollback.
UX
- [[references/connected-lens-onboarding]] โ how two users actually find each other and start a session.
Verify
Before claiming a multiplayer lens is shippable:
Smoke test
If this skill loaded correctly, the agent should answer:
- What's a SyncEntity and what does adding it to a script do? (Expected: SyncEntity converts a script into a networked entity that distributes Storage Properties and Networked Events across peers; cites [[references/sync-entity]].)
- What happens when the session host disconnects mid-game? (Expected: depending on configuration, host migrates to another peer; relevant state preserved if it was shared via Storage Properties; cites [[references/host-vs-peer]] and [[references/session-lifecycle]].)
- Two users edit the same SyncEntity at once. What does the network see? (Expected: last-write-wins by default; deterministic merge requires custom logic; cites [[references/conflict-resolution]].)
Sibling skills
- [[../snap-spectacles-build/SKILL]] โ single-user lens basics.
- [[../snap-spectacles-sik/SKILL]] โ interactions on top of which Sync Kit operates.
- [[../snap-spectacles-mobile-kit/SKILL]] โ phone-side bridging that sometimes pairs with Sync Kit.
Sources