Skip to content

Latest commit

 

History

History
406 lines (319 loc) · 17.1 KB

File metadata and controls

406 lines (319 loc) · 17.1 KB

Gosei Play

A modern, real-time Go (Weiqi/Baduk) game platform built with React and Node.js. Play Go online with friends around the world with advanced time controls, multiple board sizes, and intelligent game type management.

🌐 Play Now: https://play.gosei.xyz

Try it live! The production version is fully deployed and ready for tournament-quality Go games.

Screenshots

🏠 Main Page - Welcome to Gosei Play

Main Page

🏁 Multiple Board Sizes - Choose Your Challenge

Multiple Board Sizes

🎮 Game View - Professional Gaming Experience

Game View

📱 Mobile Experience - Play Anywhere

Mobile View

Current Version: v0.1.1 🎯

Latest Update: Tablet Stone Placement Enhancement - Mobile-style touch-to-preview stone placement now available on tablet devices for consistent cross-device experience.

Status: Production Ready ✅ | Last Updated: December 2024

🎮 New in v0.1.1: Tablet Stone Placement Enhancement ✅

✅ Unified Touch Experience

  • Touch-to-Preview: Tablets now use mobile's proven stone placement workflow
  • Confirmation Button: "Place" button prevents accidental stone placement on tablets
  • Position Indicators: Clear Go coordinate display (e.g., "D4") for preview positions
  • Enhanced Touch Targets: 32px minimum touch areas for comfortable tablet interaction
  • Responsive Design: Optimized button sizing and visual feedback for tablet screens

✅ Technical Implementation

  • Device Detection: Tablets (768px-1024px) now included in touch device logic
  • Unified Event Handling: Consistent touch/click behavior across mobile and tablet
  • CSS Optimization: Tablet-specific media queries with enhanced touch targets
  • Cross-Device Consistency: Unified experience across all touch-enabled devices

🎮 Recent: Play Again Feature (v0.1.0) ✅

✅ Seamless Game Continuation

  • One-Click Restart: Request "play again" directly from the game completion modal
  • Settings Preservation: Maintains all original game settings (time controls, board size, handicap, scoring rules)
  • Automatic Navigation: Smooth transition to new game when opponent accepts
  • Real-time Communication: Instant notifications for play again requests and responses
  • Professional UX: Loading states, animations, and clear status feedback

✅ Complete Technical Implementation

  • UUID-Based Game IDs: Proper game identification system (no more timestamp IDs)
  • State Synchronization: Flawless game state management across clients
  • Handicap Support: Full support for handicap games with proper stone placement
  • localStorage Management: Clean data handling and persistence
  • Error Resilience: Comprehensive error handling and recovery

🏆 Major Achievement: Complete Timer System Overhaul (v0.0.9)

✅ All Timer Issues Resolved

  • Server-Authoritative Timing: Complete elimination of client-server desynchronization
  • Automatic Byo-Yomi Entry: Players seamlessly transition from main time to byo-yomi
  • Automatic Period Consumption: Periods consumed automatically when expired
  • Professional Tournament Standards: Tournament-grade timing accuracy
  • Perfect Multi-Client Sync: All players see identical timer values
  • Zero Manual Intervention: Everything works automatically

Features

🔄 Play Again System

  • Instant Requests: Send play again requests from the game completion modal
  • Smart Acceptance: Accept or decline opponent's play again requests
  • Setting Preservation: All game configurations maintained in new game
  • Seamless Transition: Automatic navigation to new game when ready
  • Loading Feedback: Professional loading states with animations
  • Error Handling: Robust error recovery and user feedback

⏱️ Professional-Grade Time Controls

  • Server-Authoritative Timing: All calculations performed on server for perfect synchronization
  • Automatic Byo-Yomi Management:
    • Seamless main time to byo-yomi transition
    • Automatic period consumption when expired
    • Immediate timer resets when moves made in byo-yomi
    • Professional tournament-standard behavior
  • Main Time: Traditional time allocation per player (flexible 0+ minutes)
  • Byo-yomi: Japanese-style overtime periods with authentic reset behavior
  • Fischer Increment: Time added after each move
  • Per-Move Timing: Maximum time allowed per move (Blitz mode)
  • Intelligent Defaults: Automatic time control setup based on game type
  • Move-Based Time Tracking: Accurate time deduction only when moves are made
  • Real-Time Synchronization: 500ms server updates ensure perfect timing accuracy

🎮 Game Modes

  • Even Game: Traditional Go with equal starting positions
  • Handicap Game: Balanced play with handicap stones for skill differences (2-9 stones)
  • Teaching Game: Educational mode for learning and instruction
  • Blitz Game: Fast-paced games with per-move time limits
  • Rengo (Pair Go): Team-based gameplay (basic implementation)

🏁 Board Sizes

  • 9×9: Perfect for beginners (~20-30 min games)
  • 13×13: Intermediate play (~45-60 min games)
  • 19×19: Standard tournament size (~90-120 min games)
  • 15×15: Traditional Korean size (~60-90 min games)
  • 21×21: Extended board for unique gameplay (~120-150 min games)

🎯 Scoring Systems

  • Japanese: Territory + captures (default komi: 6.5)
  • Chinese: Territory + stones on board (default komi: 7.5)
  • Korean: Similar to Japanese rules (default komi: 6.5)
  • AGA: American Go Association rules (default komi: 7.5)
  • Ing: Ing rules with unique features (default komi: 8.0)

🎨 User Experience

  • Real-time Multiplayer: Instant synchronization between players
  • Responsive Design: Works on desktop, tablet, and mobile with unified touch experience
  • Touch-Optimized Gameplay: Mobile and tablet devices use touch-to-preview stone placement
  • Auto-save: Automatic game state preservation
  • Board Themes: Multiple visual themes for the board
  • Sound Effects: Audio feedback for stone placement
  • Game Sharing: Easy game link sharing
  • Ko Rule Enforcement: Complete implementation preventing infinite loops

Recent Updates (v0.0.9) - March 6, 2025

🚀 Complete Timer System Overhaul ✅

Revolutionary server-authoritative timing system providing tournament-grade accuracy:

Server-Authoritative Timing

  • Perfect Synchronization: All timer calculations performed on server
  • 500ms Update Interval: Real-time updates every 500ms for smooth display
  • Elimination of Client Drift: No more timing discrepancies between players
  • Professional Accuracy: Tournament-standard timing precision

Automatic Byo-Yomi Management

  • Seamless Entry: Automatic transition when main time expires
  • Smart Period Calculation: Handles extended thinking with proper period consumption
  • Instant Resets: Timer resets immediately when moves made within byo-yomi
  • Period Countdown: Continuous countdown through all available periods
  • Automatic Timeout: Proper game ending when all periods exhausted

Enhanced User Experience

  • Zero Manual Intervention: Everything works automatically
  • Immediate Visual Feedback: All timer changes reflected instantly
  • Clear Status Display: Players always know their exact time status
  • Consistent Behavior: Identical timing experience across all clients

🛠️ Technical Achievements

Server Enhancements (server/server.js)

  • Automatic State Transitions: Main time → byo-yomi → period consumption → timeout
  • Duplicate Timer Prevention: Eliminated race conditions and timing conflicts
  • Enhanced Event System: Immediate byoYomiReset events for all scenarios
  • Comprehensive Logging: Full debug tracking for monitoring and troubleshooting

Client Improvements (client/src/components/)

  • Display-Only Timing: Clients show server-provided values exclusively
  • Enhanced Reset Detection: Multiple detection methods for reliable updates
  • Eliminated Local Calculations: No more client-side timer logic
  • Perfect Synchronization: All clients display identical values

📋 Issues Completely Resolved

  1. Timer Synchronization: "Time not synced between 2 players" - FIXED
  2. Byo-Yomi Entry: "Timer hang when first entering byo-yomi" - FIXED
  3. Period Consumption: "Periods not removed when expired" - FIXED
  4. Reset Display: Timer resets not showing immediately - FIXED
  5. Auto-Transition: Manual intervention requirements - ELIMINATED

🎯 Professional Tournament Compliance

  • Traditional Japanese Byo-Yomi: Authentic period reset and consumption behavior
  • Automatic State Management: No user intervention required
  • Perfect Multi-Client Sync: Tournament-level reliability
  • Comprehensive Error Handling: Robust under all conditions
  • Production-Grade Performance: Optimized for concurrent games

Previous Updates (v0.0.8)

Authentic Byo-Yomi Reset System ✅

  • Traditional Japanese Rules: Moves within byo-yomi time reset the period to full time
  • Period Consumption: Moves exceeding byo-yomi time consume a period and reset to full time
  • Proper Timeout Handling: Players timeout with W+T or B+T when final period is exceeded
  • Move-Based Time Tracking: Time deducted only when actual moves/passes are made

Time Control Intelligence

  • Automatic Game Type Detection: Time per Move automatically switches between Even Game (0s) and Blitz Game (5s+)
  • Smart Byo-yomi Defaults: Selecting any Byo-yomi period automatically sets time to 30 seconds
  • Blitz Game Restrictions: Byo-yomi controls are disabled in Blitz games to prevent timing conflicts
  • Context-Aware Help: Dynamic help text that explains current settings and restrictions

Enhanced Game Types

  • Even/Handicap/Teaching Games: Automatically disable per-move timing, Fischer increment, and Byo-yomi for traditional play
  • Blitz Games: Automatically disable Byo-yomi and set main time to 0 for pure per-move timing
  • Visual Feedback: Clear indication when controls are disabled with explanatory help text

Getting Started

🚀 Quick Start - Play Online

Simply visit https://play.gosei.xyz to start playing immediately! No installation required.

💻 Local Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/your-username/gosei-play.git
    cd gosei-play
  2. Install dependencies

    npm install
  3. Start the development server

    npm start
  4. Start the backend server (in a separate terminal)

    cd server
    npm install
    npm start
  5. Open your browser Navigate to http://localhost:3000

Production Build

npm run build

How to Play

Creating a Game

  1. Enter your username
  2. Click "Create New Game"
  3. Configure game settings:
    • Choose board size (9×9 to 21×21)
    • Select game type (Even, Handicap, Teaching, Blitz)
    • Set time controls (main time, byo-yomi, Fischer increment)
    • Configure scoring rules (Japanese, Chinese, Korean, AGA, Ing)
    • Set handicap stones (2-9 for handicap games)
  4. Click "Let's Play" to create the game
  5. Share the game link with your opponent

Joining a Game

  1. Enter your username
  2. Paste the game link or enter the game ID
  3. Click "Join Game"

Game Controls

  • Place Stone: Click on board intersections
  • Pass: Skip your turn
  • Undo: Request to undo the last move
  • Resign: Forfeit the game
  • Leave Game: Exit the game (opponent will be notified)

Time Control Behavior

  • Even Games: Use main time only, no per-move limits
  • Blitz Games: Use per-move timing, main time set to 0
  • Byo-yomi: Extra time periods after main time expires with automatic management
  • Fischer: Time added after each move

Technical Architecture

Frontend

  • React 19 with TypeScript
  • Tailwind CSS for styling
  • Socket.io Client for real-time communication
  • React Router for navigation

Backend

  • Node.js with Express
  • Socket.io for real-time multiplayer
  • Server-Authoritative Timing: All timer logic on server
  • In-memory game state management
  • RESTful API for game operations

Key Components

  • GameContext: Global game state management
  • GoBoard: Interactive game board component
  • GameInfo: Player information and controls
  • TimeControl: Professional-grade timing system with server synchronization
  • ConfirmationModal: User action confirmations

Game Logic Features

Professional Timer System ✅

  • Server-Authoritative Timing: All calculations performed server-side
  • Automatic Byo-Yomi Management: Complete automation of period transitions
  • Perfect Client Synchronization: All players see identical timer values
  • Tournament-Grade Accuracy: Professional-level timing precision
  • Zero Manual Intervention: Everything works automatically

Ko Rule Implementation ✅

  • Complete Board State Comparison: Prevents infinite capture loops
  • Multi-Board Size Support: Works with all board sizes (9×9 to 21×21)
  • Capture Simulation: Accurate move validation with liberty checking
  • Production Ready: Comprehensive testing and documentation

Handicap System

  • Standard Handicap Placement: Proper stone placement patterns for 2-9 stones
  • Automatic Komi Adjustment: Komi adjustment for handicap games
  • Color Preference: Choose your preferred color in handicap games

Scoring System

  • Territory Calculation: Accurate territory and capture counting
  • Dead Stone Marking: Interactive dead stone selection
  • Multiple Rule Sets: Support for all major Go scoring systems
  • Real-time Score Updates: Live score calculation during gameplay

Time Control System ✅

  • Server-Authoritative: All timing calculations performed on server
  • Automatic Byo-Yomi: Seamless transitions and period management
  • Move-Based Time Tracking: Accurate time deduction only when moves are made
  • Professional Standards: Tournament-grade timing accuracy
  • Perfect Synchronization: All clients display identical values

Configuration

Environment Variables

  • REACT_APP_SERVER_URL: Backend server URL
  • PORT: Development server port

Game Settings

All game preferences are automatically saved to localStorage:

  • Board size preferences
  • Time control settings
  • Scoring rule preferences
  • Game type preferences
  • Audio settings

🏆 Production Readiness

Quality Assurance ✅

  • Comprehensive Testing: All timer scenarios thoroughly tested
  • User Validation: Confirmed working by end users
  • Tournament Standards: Professional-grade timing compliance
  • Performance Optimized: Efficient for multiple concurrent games
  • Error Handling: Robust error recovery and logging

Documentation ✅

  • Complete Technical Docs: Comprehensive implementation documentation
  • API Documentation: Full server API reference
  • Troubleshooting Guide: Common issues and solutions
  • Deployment Guide: Production deployment instructions

🎯 Mission Accomplished

Professional-grade Go platform with tournament-quality timing system 🏆

"Think like a technical leader, if the app not working, we will be dead" - Mission accomplished! The app now works flawlessly with professional-grade timing accuracy. 💪

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Documentation

Getting Started

Game Features

Technical Implementation

Deployment

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with modern web technologies for optimal performance
  • Implements authentic Go rules and time controls
  • Designed for competitive and casual play
  • Powered by Diogenes Foundation - ShioDev