Case Study - Multiplayer Card Game

Uno400

A real-time SwiftUI multiplayer card game built on Firebase without a custom server.

Uno400 is a distributed multiplayer game where Firebase handles live room synchronization while the host device acts as the game arbiter. The project combines optimistic card play, idempotent writes, event-sourced repair, bot players, and clean MVVM separation to keep gameplay responsive under network instability.

Uno400 real-time game table

Clean MVVM

SwiftUI views stay stateless while ObservableObject view models own UI state and orchestrate service calls.

Host Arbiter

One connected device acts as the source of truth for trick resolution, scoring, turn advancement, and bot play.

Idempotent Writes

UUID-keyed pending plays and last-applied guards prevent repeated snapshots from double-applying a card.

Product moments

Synchronized multiplayer play
Real-Time Table

Synchronized multiplayer play

Firebase Realtime Database keeps the shared room state live while each player writes only to their own node.

Instant card feedback
Optimistic Play

Instant card feedback

Cards leave the hand immediately on tap, then roll back only if Firebase rejects an invalid play or stale turn.

Quick table setup
Room Flow

Quick table setup

Anonymous sessions, reusable identity storage, and room state make it easy to create, join, rejoin, and continue games.

Shareable invites
Deep Linking

Shareable invites

Custom uno400 invite links let players share room codes through WhatsApp and return directly into the game.

Multiplayer loop

The game stays responsive while Firebase snapshots, host processing, and repair checks happen behind the scenes.

01
Join Room
02
Play Card
03
Host Resolves
04
State Repairs

Built with

Swift 5.9SwiftUIMVVMFirebase Realtime DatabaseFirebase Anonymous AuthCombineKeychainXCTest

The game logic service is pure Swift and Firebase-free, which keeps card validation, trick resolution, scoring, and repair behavior unit-testable with XCTest.

Engineering highlights

Event-Sourced Recovery

The host can reconstruct hands from a baseline deal and append-only trick log when snapshot order or reconnects cause drift.

Self-Healing State

Hand counts and full-deck validation catch corrupted state before scoring and repair it without a custom server.

Debounced Observers

Burst Firebase callbacks are collapsed into one UI update, with room fingerprinting to skip redundant renders.

Transparent Bots

AI players submit through the same Firebase protocol as humans, so the rest of the system does not need bot-specific paths.

No custom server

Uno400 uses Firebase as the transport layer while the host device owns game authority, host reassignment, bot turns, replay protection, and integrity repair.

Host-as-arbiter architecture
Available for new partnerships

Let's build something remarkable.