Skip to content

feat: door state persistence + multiplayer sync #255

Description

@nickmeinhold

Context

Phase 5 of prompt spell doors (#213). Doors stay open across sessions and sync to all players in real-time.

Scope

Firestore Persistence

  • Door state per room: rooms/{roomId}/doors/{doorId} → {unlockedBy, unlockedAt, challengeCompletions}
  • Challenge progress per user: users/{uid}/spellProgress → attempts, completions, per-school stats
  • Doors stay open permanently once unlocked (first wizard opens the path for everyone)

Multiplayer Sync (LiveKit)

  • Door unlock event broadcast on data channel (topic: door-unlock)
  • All connected players see door open animation in real-time
  • Late-join: door states loaded from Firestore on room join (already-opened doors render as open)

Edge Cases

  • Collaborative doors: N players must each solve a different challenge before door opens
  • Progress counter sync: "2/3 incantations spoken" updates for all players
  • Offline unlock: if Firestore write fails, optimistic local unlock with retry

Depends on

Part of

Prompt spell doors (#213)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions