Skip to main content

Colossal Cave Adventure over Gemini

A faithful port of the classic 350-point Colossal Cave Adventure (Crowther & Woods, 1977) served over the Gemini protocol. Players explore the cave, solve puzzles, and collect treasure — all through a Gemini client.

Built with xitzin (a Gemini web framework) and nauyaca (a Gemini server).

Features

  • Full 350-point game with all rooms, items, puzzles, and encounters from the original
  • Player authentication via Gemini client certificates
  • Per-player game state persisted in SQLite
  • Dwarf and pirate encounters with faithful AI behavior
  • Structured logging with optional fingerprint hashing for privacy

Quickstart

Requires Python 3.13+ and uv.

# Install dependencies
uv sync

# Generate TLS certificates (required for Gemini)
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
  -days 365 -nodes -keyout key.pem -out cert.pem \
  -subj "/CN=localhost"

# Start the server
ADVENTURE_CERTFILE=cert.pem ADVENTURE_KEYFILE=key.pem uv run adventure

Then connect with any Gemini client to gemini://localhost:1965/.

Configuration

All settings are read from environment variables prefixed with ADVENTURE_:

Variable Default Description
DATABASE_URL sqlite:///./adventure.db SQLite database path
HOST localhost Bind address
PORT 1965 Bind port
CERTFILE — Path to TLS certificate (required)
KEYFILE — Path to TLS private key (required)
LOG_LEVEL INFO Logging level
LOG_FILE — Log to file instead of stdout
JSON_LOGS false Output logs as JSON
HASH_FINGERPRINTS true Hash client fingerprints in logs for privacy

Project Structure

src/adventure/
├── engine/          # Synchronous, pure-Python game logic
│   ├── world.py     # Immutable data structures (Room, Obj, Word, Hint, World)
│   ├── state.py     # Mutable GameState (position, inventory, lamp, dwarves, score)
│   ├── loader.py    # Parses the 12-section advent.dat into a World
│   └── commands.py  # Command dispatch: movement, items, puzzles, combat, scoring
├── routes/          # Xitzin route handlers
│   ├── play.py      # Game routes (require client certificate)
│   └── home.py      # Public pages: /, /help, /about
├── templates/       # Jinja2 .gmi templates for Gemtext responses
├── app.py           # App factory
├── config.py        # Configuration from environment variables
├── logging.py       # structlog setup
├── models.py        # SQLModel entities (Player, SavedGame)
├── session.py       # Load/save/reset game state from DB
└── users.py         # Player upsert by fingerprint
data/
└── advent.dat       # Original game data file

Development

# Run tests
uv run pytest

# Lint and format
uv run ruff check src/ tests/
uv run ruff format src/ tests/

# Type check
uv run ty check src/

Credits

  • Original game: Will Crowther (1976) and Don Woods (1977)
  • Data file format: Public domain
  • Parsing reference: Brandon Rhodes' python-adventure (Apache 2.0)

License

MIT

Metadata

Release files for adventure-gemini 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adventure-gemini 0.1.5
File Size Uploaded Provenance Actions
adventure_gemini-0.1.5.tar.gz 49.7 kB With provenance Details for adventure_gemini-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adventure-gemini 0.1.5
File Interpreter ABI Platform Actions
adventure_gemini-0.1.5-py3-none-any.whl Python 3 none any Details for adventure_gemini-0.1.5-py3-none-any.whl

Total release size: 104.8 kB

Release files / adventure_gemini-0.1.5.tar.gz

Download URL adventure_gemini-0.1.5.tar.gz
Size 49.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6994dfb64cfbc6494d980c0d94c5b5c1e2b2ca1629bcd1ab61030606b2098993
BLAKE2b-256 checksum
How to use checksums
d5cd37ef05d5a5a042527890ad59f8b41ce4e3a786295571467b54edc1be6036
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / adventure_gemini-0.1.5-py3-none-any.whl

Download URL adventure_gemini-0.1.5-py3-none-any.whl
Size 55.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3ad5b5b6cf0589ece10f69e43b883c3b50c53b9594920bcff71c2f148fb6afa
BLAKE2b-256 checksum
How to use checksums
e21c7bdcf4eacb6e3ddf6e0ded7a6d3d82feee258bc16be1064189a4abe3aeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Security for adventure-gemini 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for adventure_gemini-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page