Skip to content

MasterYoav/Hnefatafl

Repository files navigation

Hnefatafl Icon

Modern Hnefatafl (Vikings Chess) built with OpenClaw.

Kotlin ChatGPT

Game Overview

Hnefatafl is an asymmetric Norse strategy game:

  • Blue Team (Defenders) protects the King.
  • Red Team (Attackers) attempts to capture the King.
  • The King wins by escaping to a corner.

This implementation targets a modern "Tahoe 26" macOS-like visual style with responsive board scaling and configurable themes.


Tech Stack

Language: Kotlin 2.1
UI: Compose Multiplatform (Desktop)
Architecture: Shared game logic + shared UI + desktop host
Build: Gradle Kotlin DSL
Quality: ktlint + detekt + unit/integration tests
Packaging: Compose Native Distributions (DMG / EXE / DEB)
CI/CD: GitHub Actions release workflow

Rules Implemented

  • 11x11 board with correct initial spawn layout
  • Orthogonal movement (rook-like), no jumping
  • Only King may enter corner squares
  • Pawn capture by sandwiching (including edge capture rule in this project)
  • King escape win: reaches any corner
  • Attacker win: king surrounded on 4 sides
  • Turn-based flow + undo + match win counters

Install & Play (No Java Required for End Users)

For players, use packaged releases from GitHub Releases:

  • macOS: .dmg
  • Windows: .exe / .msi
  • Linux: .deb
  • Android: .apk (debug + release-unsigned)

These bundles include required runtime components.

Download

  1. Open GitHub Releases for this repo.
  2. Download the installer for your OS.
  3. Install and launch Hnefatafl.

Developer Setup

./gradlew verify
./gradlew :app-desktop:run

Android Build & Run

# Validate desktop/shared quality gates first
./gradlew verify

# Build Android debug APK
./gradlew :app-android:assembleDebug

# Build Android release APK (unsigned)
./gradlew :app-android:assembleRelease

APK outputs:

  • Debug: app-android/build/outputs/apk/debug/app-android-debug.apk
  • Release: app-android/build/outputs/apk/release/app-android-release-unsigned.apk

Notes:

  • Android uses the same gameplay and settings system as desktop.
  • Transparent background mode is intentionally hidden on Android.
  • Image background mode is available, but image picking is currently disabled on Android host (desktop-only picker for now).

Build native package for your current OS

./gradlew :app-desktop:packageDistributionForCurrentOS

Output is generated under: app-desktop/build/compose/binaries/main/


Release 1.0 Workflow

Tag-based release is configured via GitHub Actions (.github/workflows/release-desktop.yml).

git tag v1.0.0
git push origin v1.0.0

This builds platform-native installers and attaches them to the GitHub Release, including Android APK artifacts.


Repository Structure

  • shared/logic — rules engine + tests
  • shared/ui — shared Compose UI + settings system
  • app-desktop — desktop window host, native integrations (file/color pickers, window controls)
  • app-android — Android app host activity + APK packaging

Status

Current milestone: v1.0 release candidate

Core gameplay, modern UI, customization, and desktop packaging are in place.

About

a modern way to play the old vikings chess.

Resources

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors