Liar’s Dice: A cross-platform multiplayer game
One of my favorite recent projects is a fully functional, pirate-themed Liar’s Dice web game. But the real treasure here isn’t just the gameplay—it’s the architecture behind it. Instead of relying on a centralized server to handle game state and matchmaking, I built this entire experience to run completely peer-to-peer directly in the browser!
Here’s a deep dive into the tech stack and the challenges solved during development.
The Tech Stack
- Framework: React / TypeScript
- Build Tool: Vite
- Networking: WebRTC via PeerJS
- Styling: Custom CSS for that authentic pirate aesthetic
Links: Play Web Version | Open Source Repo (Apache 2.0) | Google Play App Link | ios (coming soon)
Peer-to-Peer Networking with WebRTC
The standout technical feature of this project is its serverless multiplayer architecture.
Using PeerJS (a wrapper around WebRTC), players can host a lobby directly from their browser. When a host creates a game, they generate a unique connection code. Other players enter this code to establish a direct, real-time data connection.
This means:
- Zero Server Costs: Game state is managed entirely by the host’s browser.
- Low Latency: Data travels directly between players, bypassing intermediaries.
- High Privacy: No game data or user information is stored in a database.

Complex Game State Management
Liar’s Dice is a game of hidden information. Every player starts with 5 dice, which are kept secret. Managing this state securely while ensuring everyone stays synchronized was a fun challenge.
- The Bidding System: Players must continuously raise the bid (e.g., “three 4s” -> “four 4s” or “three 5s”). The UI dynamically prevents invalid bids by validating user input against the current game state before broadcasting the action to the network.
- Wild 1s: The logic accounts for “1s” acting as wildcards across all players’ hands, complicating the validation math when a player finally calls “Liar!”.
Responsive & Mobile-Friendly
A party game needs to be playable at a party! The entire UI was built from the ground up to be completely mobile-friendly. Players can keep their phones hidden like a real dice cup, making their bids with intuitive touch controls.
Downloadable Game Logs
A game of guessing and chance leads to the occasional squabble among my friends when playing, as such the app tracks every bid, challenge, and dice loss. At the end of a match, players can download the full game logs in both plain text and JSON formats to settle any lingering disputes over who actually bluffed the best.
Cross-Platform Monetization
Because Liar’s Dice is deployed as both a web application and a native mobile app (using Capacitor), the architecture supports a dual-monetization strategy:
- Web Version: Utilizes Buy Me a Coffee (I call it Buy Me an Ale in this case) with Stripe for the final payment integration.
- Mobile App (iOS/Android): Integrates native AdMob for serving ads via the
@capacitor-community/admobplugin, while also utilizing RevenueCat (@revenuecat/purchases-capacitor) to make it so you can remove the ad banner for $5.
Still Reading?
I have another article on some of the graphic design and marketing I’ve been doing for this game that might catch your fancy.
