Skip to content
jaeyeomPublic

About

A web-based Sokoban game built as a personal challenge in June 2024.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Sokoban

Overview

A web-based Sokoban game built as a personal challenge in June 2024.

Sokoban is a classic puzzle game where the player pushes boxes onto target locations. The player can only push boxes (not pull), and can only push one box at a time.

The Challenge

This game was developed under the following constraints (only initial commit):

  1. No graphical user interfaces - Development done entirely in a text terminal. Graphical resources could be searched on the browser, but image editing was done in terminal only.
  2. Android phone only - All development was done on an Android phone using Termux.
  3. Separate cloud backend - The server is intentionally hosted in Europe (far from the development location) and communicates via an API.
  4. Persistent game state - Game progress is stored in Google Cloud Storage.
  5. One day implementation - The entire project was implemented in a single day.

GitHub Copilot was used during development, but no other agentic coding tools were used.

Features

  • Classic Sokoban gameplay with multiple levels
  • Keyboard controls (arrow keys, wasd, or Vim-style hjkl)
  • Touch input support (tap on screen quadrants to move)
  • Undo functionality
  • Level reset
  • Cloud-based game state persistence

Controls

Keyboard

KeyAction
Arrow keysMove
w / a / s / dMove
h / j / k / lMove (Vim)
uUndo
nNext level
rReset

Touch

Touch the screen to move the player:

  • Left side of screen: Move left
  • Right side of screen: Move right
  • Top of screen: Move up
  • Bottom of screen: Move down

Technology Stack

  • Backend: Go
  • Frontend: Phaser 3 (JavaScript game framework)
  • Storage: Google Cloud Storage
  • Build: Webpack with Babel

Project Structure

sokoban/
├── cmd/
│   └── webserver/       # Go web server
├── data/
│   ├── app/             # Frontend application
│   │   ├── src/         # Source files
│   │   └── dist/        # Bundled output
│   ├── assets/          # Game assets (tileset)
│   ├── index.html       # Main HTML page
│   └── levels.txt       # Level definitions
├── logic/               # Game logic
└── storage/             # Storage implementations

Running the Game

Locally

  1. Google Cloud ADC

    You need gcloud application-default authentication for local development.

    gcloud auth application-default login
        
  2. Build the frontend:
    cd data/app
    npm install
    npx webpack --mode development
        
  3. Run the server:
    go run ./cmd/webserver
        
  4. Open in browser: http://localhost:8080/game/your-game-id

App Engine Deploy

A push to main deploys after CI passes. The Deploy workflow writes app.yaml from app.yaml.example, rebuilds the frontend, and runs make deploy.

Add these GitHub Actions secrets before merging, or the first deploy fails:

  • GCP_PROJECT_ID
  • GCP_WORKLOAD_IDENTITY_PROVIDER
  • GCP_SERVICE_ACCOUNT
  • GCP_BUCKET, the value that replaces your-bucket-name.appspot.com

The deploy service account needs App Engine Admin, Storage Admin, Cloud Build Editor, Artifact Registry Reader, and Service Account User on the App Engine runtime account. Use Workload Identity Federation so GitHub has no long-lived key: https://github.com/google-github-actions/auth

To deploy from a machine, copy app.yaml.example to app.yaml, set the bucket name, install the frontend dependencies, and run make deploy.

About

A web-based Sokoban game built as a personal challenge in June 2024.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages