extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Svelte 61.0%
TypeScript 33.7%
CSS 3.6%
JavaScript 1.1%
HTML 0.3%
Astro 0.1%
Other 0.2%
42 7 0

Clone this repository

https://tangled.org/goose.art/cloud-go https://tangled.org/did:plc:hsqwcidfez66lwm3gxhfv5in/cloud-go
git@tangled.org:goose.art/cloud-go git@tangled.org:did:plc:hsqwcidfez66lwm3gxhfv5in/cloud-go

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

Go Game with AT Protocol Integration#

A SvelteKit application that implements the game of Go using the Wgo library, with AT Protocol OAuth authentication and custom lexicons to record game state and moves on the decentralized network.

Features#

  • AT Protocol OAuth: Login with your Bluesky account
  • Custom Lexicons: Game state stored as AT Protocol records
    • boo.sky.go.game - Game records
    • boo.sky.go.move - Move records
    • boo.sky.go.pass - Pass records
  • Wgo.js Integration: Professional Go board rendering and game logic
  • Real-time Updates: Firehose subscription for network-wide game updates
  • Multiple Board Sizes: Support for 9x9, 13x13, and 19x19 boards
  • Local Caching: SQLite database for fast queries

Implementation Status#

This is a demonstration project showing the architecture for integrating a Go game with AT Protocol. The core implementation includes:

Completed:

  • SvelteKit application structure
  • Custom AT Protocol lexicon definitions for games, moves, and passes
  • SQLite database schema with Kysely
  • Wgo.js board component integration
  • Game creation and joining UI
  • Move recording logic
  • Pass functionality
  • Game state management

⚠️ Partially Implemented:

  • OAuth authentication (structure in place, needs full AT Protocol OAuth client setup)
  • AT Protocol record creation (URIs generated, but not actually written to network)
  • Firehose subscription (placeholder implementation provided)

📝 Notes:

  • The application demonstrates the data structures and flow for AT Protocol integration
  • OAuth and record creation are simplified for demo purposes
  • To fully implement, you'll need to properly configure NodeOAuthClient and AtpAgent
  • The Node version (v17.9.0) is below the recommended 18+, which may cause some warnings

Getting Started#

Prerequisites#

  • Node.js 18+ recommended (project currently on v17.9.0)
  • npm or pnpm

Installation#

  1. Clone the repository

  2. Install dependencies:

    npm install
    
  3. Copy the environment file:

    cp .env.example .env
    
  4. Edit .env and update the SESSION_SECRET to a random string:

    DATABASE_PATH=./data/app.db
    SESSION_SECRET=your-random-secret-here
    PUBLIC_BASE_URL=http://localhost:5173
    

Running the Development Server#

npm run dev

The application will be available at http://localhost:5173

Building for Production#

npm run build
npm run preview

How to Play#

  1. Login: Click login and enter your Bluesky handle (e.g., yourname.bsky.social)
  2. Create Game: Choose a board size and create a new game
  3. Wait or Join: Either wait for another player to join your game, or join an existing waiting game
  4. Play: Take turns placing stones on the board
  5. Pass: Click the Pass button if you want to pass your turn
  6. Game End: The game ends when both players pass consecutively

Project Structure#

/src
  /routes
    +page.svelte              # Home page with game list
    +page.server.ts           # Server-side data loading
    +layout.svelte            # Layout wrapper
    /auth
      /login/+server.ts       # OAuth login initiation
      /callback/+server.ts    # OAuth callback handler
      /logout/+server.ts      # Logout handler
    /game/[id]
      +page.svelte            # Game board view
      +page.server.ts         # Game data loading
    /api
      /games
        +server.ts            # Create game API
        /[id]
          /join/+server.ts    # Join game API
          /move/+server.ts    # Record move API
          /pass/+server.ts    # Record pass API
  /lib
    /server
      auth.ts                 # OAuth client setup
      db.ts                   # Database configuration
      firehose.ts             # Firehose subscription
    /components
      Board.svelte            # Wgo board component
  hooks.server.ts             # Server hooks
/lexicons                     # Custom lexicon definitions
  boo.sky.go.game.json
  boo.sky.go.move.json
  boo.sky.go.pass.json
/static
  oauth-client-metadata.json  # OAuth client metadata

Architecture#

Technology Stack#

  • Frontend: SvelteKit 5 with TypeScript
  • Go Engine: Wgo.js (v3.0.0-alpha.10)
  • Authentication: AT Protocol OAuth (@atproto/oauth-client-node)
  • Data Storage: AT Protocol records with custom lexicons
  • Database: SQLite with Kysely query builder
  • Real-time: AT Protocol Firehose (placeholder implementation)

Custom Lexicons#

The application defines three custom AT Protocol lexicons:

  1. boo.sky.go.game: Represents a game between two players
  2. boo.sky.go.move: Represents a stone placement move
  3. boo.sky.go.pass: Represents a pass action

All game data is stored as AT Protocol records, making it decentralized and portable.

Known Limitations#

  • The firehose implementation is a placeholder - full implementation would require WebSocket connection to AT Protocol relay
  • No automatic scoring - game ends on two consecutive passes but doesn't calculate winner
  • OAuth session management is simplified for development (should use proper encryption in production)
  • No time controls or undo functionality
  • Real-time updates require page refresh

Future Enhancements#

  • Automatic territory scoring
  • Game chat/comments using AT Protocol
  • Game history and replay functionality
  • Time controls (byo-yomi, Fischer)
  • Player ranking system
  • SGF (Smart Game Format) export
  • Game analysis tools
  • Spectator mode

Contributing#

This is a demonstration project showing AT Protocol integration with a game application. Feel free to fork and extend!

License#

MIT