技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度技术分析:halogenandtoast/ArkhamHorror

项目背景与痛点

《Arkham Horror: The Card Game》是Fantasy Flight Games推出的一款卡牌游戏,具有复杂的游戏规则和多样的卡牌组合策略。然而,官方并未提供一款浏览器端的非正式版。halogenandtoast/ArkhamHorror项目正是为了填补这一空白,提供了一个遵循官方规则的浏览器版本。该项目的意义不仅在于给玩家提供一个便捷的平台,而且为游戏爱好者提供了一个新的游戏交互体验,同时也是对开源社区的一次有力支持。

核心技术揭秘

项目的核心竞争力在于其技术架构设计及实现方式。其使用的JavaScript栈搭建了一个高扩展性、高性能的游戏逻辑系统。前端采用了现代的响应式设计,后端则构建在一个稳定且可扩展的服务层之上。

技术架构层面分为前端、后端和服务层,整体结构如下:

graph LR A[用户界面] --> B[前端逻辑] B --> C[用户输入] C -->|"触发"| D[后端服务] D --> E[数据处理] D --> F{"规则校验"} F -->|"通过"| G[游戏逻辑] F -->|"失败"| H[非法操作提示] G --> I[结果反馈] I --> J[前端渲染结果]

用户的输入首先会触发前端逻辑,经过前端初步处理后发送到后端服务进行进一步的数据处理和游戏规则校验。校验通过后,交由游戏逻辑处理单元进行处理,之后结果会反馈到前端渲染,呈现给用户。

后端设计:采用了RESTful API与前端交互,提供了一套完整的游戏规则校验和数据处理接口。这种设计有助于维持前后端的独立性,同时也提供了良好的扩展性。

前端逻辑:在整个用户交互层作用明显。通过使用React作为前端框架,项目实现了高度的组件化和模块化,使得前端页面可以在几乎不显著延迟的情况下实时响应用户的操作,提升用户体验。

功能亮点与差异

亮点:

  1. 全方位游戏支持:项目覆盖了游戏中的所有必要要素,如卡牌的生成、规则的执行、玩家的状态等,均进行了高度复现。
  2. 性能和稳定性:项目通过严谨的架构设计和高效的代码实现,提供了流畅且稳定的用户体验。
  3. 社区参与度:GitHub项目本身也是社区驱动,多方参与者共同提供优化方案,不断改进和完善游戏体验。

差异: 相比传统的桌面应用或是其他同类卡牌游戏平台,《halogenandtoast/ArkhamHorror》强调在浏览器端的体验及便捷性。它可以不受平台限制,便于移动设备访问和游戏,拓展了玩家的互动方式。

应用场景与落地建议

  • 应用场景:适合喜欢游戏中策略元素的玩家,或是对新版游戏有兴趣但不希望购买实体游戏卡牌的群体。此外,这也十分适合用于在聚会中快速分享和体验游戏。
  • 落地建议:投入实际使用前需确保良好的网络环境和硬件配置,以保证游戏的流畅性。此外,项目虽遵循官方规则,但由于是非官方版本,维护和迭代的稳定性需有所警惕。

综合评价

优点:

  • 灵活的交互设计:提供了移动端友好的游戏体验。
  • 干净的模块化架构:易于扩展和维护。

缺点:

  • 依赖非官方规则库:可能在规则更新或扩展包支持上滞后于官方产品。
  • 社区驱动的不定性:开源项目在持续更新和功能支持上的稳定性需持续关注。

综上所述,halogenandtoast/ArkhamHorror项目提供了一个优化且符合现代玩家需求的游戏平台,具备良好的用户交互和支持。然而,其作为非官方产品所可能带来的一些问题也需开发者和用户引以重视。

关于

GitHub 原始描述(英文)

An unofficial rules-compliant browser based version of Arkham Horror: The Card Game. Not produced, endorsed, or supported by, or affiliated with Fantasy Flight Games.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
970
价值分
288
活跃状态
活跃

语言占比

CSS
Dockerfile
HCL
HTML
Haskell
JavaScript
Makefile
Nix
PLpgSQL
Python
Ruby
Shell
TypeScript
Vim Script
Vue

README

Arkham Horror LCG

Screenshot

The goal of this project is to implement a web version of Arkham Horror with as many of the rules implemented as possible.

Warning

This is very much a work in progress. Things may break at any time, but if they do, please file a bug.

Features

  • Multiplayer up to 4 players
  • Multiplayer solitaire
  • Tarot Readings
  • Deck import from ArkhamDB and arkham.build

Finished Content

Player Cards

  • All player cards before 2026

Campaigns

  • Night of the Zealot
    • Return to Night of the Zealot
  • The Dunwich Legacy
    • Return to The Dunwich Legacy
  • The Path To Carcosa
    • Return to The Path To Carcosa
  • The Forgotten Age
    • Return to The Forgotten Age
  • The Circle Undone
    • Return to The Circle Undone
  • The Dream-Eaters
  • The Innsmouth Conspiracy
  • Edge of the Earth
  • The Scarlet Keys
  • The Feast of Hemlock Vale (Beta)

Side Stories

  • The Curse of the Rougarou
  • Carnevale of Horrors
  • Murder at the Excelsior Hotel
  • Guardians of the Abyss (Beta)
  • The Blob That Ate Everything
  • War of the Outer Gods (Beta)
  • Fortune and Folly
  • The Midwinter Gala
  • Film Fatale

I just want to try this out on my computer

Linux Users

Install Docker, then run:

curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/install.sh | bash

This creates an arkham-horror/ directory, downloads the required files, generates a database password, and starts the app. Open http://localhost:3000 when it’s done.

The script will ask if you want to download game images (~2.9 GB). If you skip this step, the app loads images from the CDN automatically — no extra setup needed.

Windows Users

  • Install Docker, specifically the version of Docker known as Docker Desktop.
  • Install a “terminal only” version of Ubuntu that can be run inside of Windows, for which the easiest available method is to install from the Microsoft Store. You may choose any Linux distro other than Ubuntu if you know what you are doing.
  • In Docker Desktop, go to Settings > Resources > WSL Integration and enable integration with Ubuntu Linux distro that you installed in the previous step. This allows us to access Docker from inside Ubuntu.
  • Start the Ubuntu terminal and run:
    curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/install.sh | bash
    
  • The app should start being served at http://localhost:3000, if nothing went wrong.
  • Every time you want to start the app, you can use docker compose up
  • If you get around to figuring out how to use Docker Desktop, you could also press buttons to start and stop the app instead of typing commands to run it.
Things that can go wrong

If the app doesnt start at all, or it starts but you cannot create a user account, or any other issue due to Murphy’s Law, you have to check the logs of the Docker container to find the error messages. In Docker Desktop, you can access this by clicking on the arkham-horror “compose stack” found in the Containers list.

Possible problems:

Problem Solution
Error involving docker-credential-desktop.exe Try restarting your computer
When clicking on the “REGISTER” button, the error password authentication failed is logged Stop the app using docker compose down and then refetch the app using docker compose pull

Manual setup (alternative)

If you prefer not to use the install script, you’ll need four files:

mkdir -p arkham-horror/config arkham-horror/scripts arkham-horror/frontend/public/img
cd arkham-horror
curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/docker-compose.yml -o docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/setup.sql -o setup.sql
curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/scripts/fetch-assets.sh -o scripts/fetch-assets.sh
# Generate a strong password
openssl rand -base64 32 > config/postgres_password.txt
docker compose up -d

The app automatically detects whether local images are present:

  • No local images (default after install) → images load from the CDN automatically
  • Local images present (after running the fetch service) → images served locally

To fetch images locally, use the fetch-images Docker service. Once fetched, restart with docker compose restart web and the app will switch to local images.

# English only (~1.3 GB) — portraits, tokens, icons, card images
docker compose --profile fetch-images run --rm fetch-images en

# English + a specific language (recommended for non-English play)
docker compose --profile fetch-images run --rm fetch-images en+fr   # French
docker compose --profile fetch-images run --rm fetch-images en+es   # Spanish
docker compose --profile fetch-images run --rm fetch-images en+ita  # Italian
docker compose --profile fetch-images run --rm fetch-images en+ko   # Korean
docker compose --profile fetch-images run --rm fetch-images en+zh   # Chinese

# A single language's card translations only (English assets still load from CDN)
docker compose --profile fetch-images run --rm fetch-images fr

# Everything (~2.9 GB)
docker compose --profile fetch-images run --rm fetch-images all

Images are stored in frontend/public/img/ and mounted into the container. After fetching, run docker compose restart web to pick them up.

To switch back to CDN at any time, add this to the web service environment in docker-compose.yml:

    environment:
      - ASSET_HOST=https://assets.arkhamhorror.app

Updating

Use the upgrade script. It auto-detects your install type (Docker or git checkout), refreshes control files, pulls the latest images, applies database migrations, recreates the containers, and re-syncs local images if you have them.

Run it from anywhere:

curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/upgrade.sh | bash

Or, from inside your install directory (or a git checkout):

./upgrade.sh

Options (environment variables):

Variable Purpose
ARKHAM_INSTALL_DIR Install directory to upgrade (default: arkham-horror). Set this if you installed somewhere else.
ARKHAM_IMAGE_TARGET Force an image-sync target (e.g. en, en+fr, all) instead of auto-detecting from what’s already on disk.
# Upgrade an install in a custom directory
ARKHAM_INSTALL_DIR=~/games/arkham curl -fsSL https://raw.githubusercontent.com/halogenandtoast/ArkhamHorror/main/upgrade.sh | bash

# Force re-syncing English + French images
ARKHAM_IMAGE_TARGET=en+fr ./upgrade.sh

Local dev

Dependencies

  • Stack for GHC
  • Node
  • Postgresql
  • Sqitch (optional: for migrations)

Local Setup

Running via Docker

The image is setup to use an external database passed via the DATABASE_URL environment variable. Follow the steps below to setup the database and then run the following commands

docker build -t arkham .
docker run -t -i -e PORT=3000 -e DATABASE_URL="postgres://docker:[email protected]:5432/arkham-horror-backend" -p 3000:3000 arkham
Backend

Run stack setup in the backend directory, then run stack build --fast (note: this will still take a long time)

Frontend

Run npm install in the frontend directory

Images

Image assets (~2.9 GB) are not stored in the git repository. They are hosted on CloudFront and the app loads them from the CDN by default in both development and production — no extra setup needed.

If you need local copies (e.g. for offline development), use the fetch script (requires aws CLI and curl):

make fetch-images     # Everything (~2.9 GB)
make fetch-cards      # English card images only (~755 MB)

# Or use the script directly:
./scripts/fetch-assets.sh en        # All English/static images (~1.3 GB)
./scripts/fetch-assets.sh en+fr     # English + French (recommended for French play)
./scripts/fetch-assets.sh en+es     # English + Spanish
./scripts/fetch-assets.sh en+ita    # English + Italian
./scripts/fetch-assets.sh en+ko     # English + Korean
./scripts/fetch-assets.sh en+zh     # English + Chinese
./scripts/fetch-assets.sh fr        # French card translations only

If you only have Docker (no local AWS CLI), use the Docker-based targets instead:

make fetch-images-docker    # Everything via Docker (~2.9 GB)
make fetch-cards-docker     # English card images only via Docker

# Or run directly with the same targets as above:
docker compose --profile fetch-images run --rm fetch-images en
docker compose --profile fetch-images run --rm fetch-images en+fr
docker compose --profile fetch-images run --rm fetch-images fr

To use local images instead of CDN in local dev, create frontend/.env.development.local:

VITE_ASSET_HOST=

To revert to CDN, remove the file or set VITE_ASSET_HOST=https://assets.arkhamhorror.app.

If you add new images, sync them to S3 and regenerate the manifest:

make sync-and-manifest

To install a git hook that warns if you forget to update the manifest:

make install-hooks
Database

Create the local database:

createdb arkham-horror-backend
cd migrations
sqitch deploy db:pg:arkham-horror-backend

If you do not have sqitch you can cat migrations/deploy/* to see the create table statements and run them manually, you will want to specifically run the users and arkham_games create table statements first.

Running the server

  • start the backend with cd backend && make api.watch
  • start the frontend with cd frontend && npm run dev

Homebrew content

Want to build your own campaign, scenario, or custom content? See Writing homebrew content — a hands-on guide to adding cards, campaigns, traits, actions, tokens, and more without touching the base game.

The information presented in this app about Arkham Horror: The Card Game™, both textual and graphical, is © Fantasy Flight Games 2024. This app is a fan project and is not produced, endorsed, or supported by, or affiliated with Fantasy Flight Games.

All artwork and illustrations are the intellectual property of their respective creators. All Arkham Horror: The Card Game™ images and graphics are copyrighted by Fantasy Flight Games.

评论

暂无评论