Skip to content

botcheddevil/FogOfWar

Repository files navigation

Ultra-Optimized WebSocket Chess System

A highly optimized chess system demonstrating extreme efficiency in state management and real-time gameplay, capable of supporting 10,000+ concurrent games on minimal hardware.

Key Features

  • Ultra-Efficient State Management

    • Complete board state in 25 bytes
    • Session management in 18 bytes
    • Move deltas in 2 bytes per move
    • Total game footprint ~143 bytes
  • Scalability

    • 10,000+ concurrent games on a single $5 VPS
    • Minimal memory footprint (~1KB per active game)
    • Optimized WebSocket implementation
    • Low-latency move processing
  • Technical Implementation

    • Custom binary protocol for state transmission
    • Efficient move validation
    • Real-time game state synchronization
    • Memory-optimized data structures

System Architecture

State Compression

  • Board state encoding using bitwise operations
  • Piece position compression algorithm
  • Move delta optimization
  • Session state minimization

Network Protocol

  • Custom WebSocket frame optimization
  • Binary state transmission
  • Minimal overhead handshaking
  • Efficient game session management

Performance Metrics

  • Memory usage: ~1KB per active game
  • Network bandwidth: <150 bytes per game session
  • Move latency: <50ms average
  • CPU usage: Supports 10,000+ concurrent games on 1 CPU core

Getting Started

Prerequisites

node >= 14.0.0
npm >= 6.0.0

Installation

# Install server dependencies
npm install

# Install client dependencies
cd ../client
npm install

Running the System

# Start the server
npm run start

License

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

About

Ultra-Optimized WebSocket Chess System

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors