Sequence Multiplayer Board Game

Real-Time Cross-Platform Strategy Game with Go WebSockets & Min-Max AI

📱 Flutter (Dart) ⚡ Go (Golang) WebSockets 🤖 Min-Max AI Bot 🎮 Multiplayer Matchmaking 💾 Supabase Auth
🎮

Play Instantly Online or Download Android APK

Challenge players globally in synchronized multiplayer rooms with live emotes or play offline against an intelligent AI bot.

🎮 Play Online ↗ 📥 Android APK

Executive Summary

Sequence is a full-featured, cross-platform digital adaptation of the popular strategic board-and-card game. Players draft cards from their hand to place colored marker chips onto matching board squares, aiming to complete two horizontal, vertical, or diagonal lines of five chips before their opponent. This implementation bridges high-speed WebSocket networking in Go with a responsive Flutter frontend and an offline Min-Max AI engine.

The Technical Challenge

Digital board games require strict state consistency and instantaneous feedback. Specifically, this project tackled three core engineering challenges:

  • Bidirectional Synchronization: Maintaining synchronized 100-tile board states across distributed web and mobile clients without race conditions or out-of-order moves.
  • Special Card Mechanics: Handling two-eyed Jacks (wildcards capable of claiming any unoccupied square) and one-eyed Jacks (anti-wildcards capable of removing an opponent's chip, provided it is not part of a completed sequence).
  • Responsive Offline Gameplay: Delivering a challenging single-player mode that computes moves in real time on mobile hardware without cloud dependencies.

System Architecture & Networking

The application is split between a high-throughput Go WebSocket backend server and a Flutter client targeting Web and Android:

[Frontend Clients] Flutter Mobile (Android APK) & Flutter Web Application
    ↓ Bidirectional WSS (JSON Events)
[Go WebSocket Hub] Concurrent Client Registry & Goroutine Dispatcher
    ↓ Room State Mutex
[Room Engine] Matchmaker, Move Validator, Card Deck Manager, Sequence Evaluator
    ↓ Async Event Broadcast & Persistence
[Supabase / PostgreSQL] User Authentication, Match History, Elo Ratings & Player Stats

AI Opponent: Min-Max Algorithm with Heuristic Pruning

For offline single-player mode, I engineered a specialized AI bot using the Min-Max algorithm with alpha-beta pruning:

  • Board Matrix Evaluation: The evaluation function assigns weights to lines of 2, 3, and 4 connected chips, with exponential bonus scores for completing a 5-in-a-row sequence.
  • Defensive Interception: The algorithm evaluates the opponent's pending sequence threats and prioritizes blocking 4-chip runs unless an immediate winning move is available.
  • Wildcard Optimization: One-eyed and two-eyed Jacks are held for maximum leverage, removing opponent pivot tiles or sealing critical diagonal intercepts.
  • Mobile Execution: Optimized in Dart to execute search depth computations in under 80 milliseconds, ensuring instantaneous bot responses without battery drain.

My Role & Implementation Highlights

As the Lead Full-Stack & Mobile Engineer, I delivered:

  • Flutter Canvas & CustomPainter: Built a custom 10x10 responsive game board with smooth tile animations, card dealing transitions, and dynamic sequence completion highlights.
  • Go WebSocket Server: Architected the Goroutine-based server handling room creation, player matchmaking via PIN codes, connection heartbeats, and spectator mode.
  • Turn-Based State Machine: Designed strict state validation ensuring moves are rejected if the player's card doesn't match the board tile or if a chip is illegally placed.
  • Sound Effects & Emotes: Added interactive in-game emote reactions, haptic feedback on mobile, and turn notifications.

Measurable Outcomes

  • Cross-Platform Parity: Complete feature and game rule parity across Flutter Web and Android APK builds.
  • Real-Time Network Sync: Go WebSocket payload dispatch delivers immediate move broadcast across active player connections.
  • Zero Cloud AI Dependency: Players can complete full games against the AI bot offline with zero internet connectivity.

Read the technical architecture breakdown on the blog: Building a Real-Time Multiplayer Board Game with Flutter & Go WebSockets or check out Full-Stack Development services.