Skip to main content

Play ai dungeon from your terminal

Project description

AI Dungeon CLI

This is basically a cli client to play.aidungeon.io.

This allows playing AI Dungeon 2 inside a terminal.

I primarily did this to play the game on a DEC VT320 hardware terminal for a more faithful experience.

For more context, read the accompanying blog post.

AI DUngeon on a VT320

Installation

pip

PyPI version fury.io

$ python3 -m pip install ai-dungeon-cli

Of for unstable release from the source code:

$ python3 -m pip install .

Arch Linux

Package is on AUR.

$ git clone https://aur.archlinux.org/ai-dungeon-cli-git.git
$ cd ai-dungeon-cli-git
$ makepkg -si

Running

In either way, you first need to create a configuration file.

If installed with pip:

$ ai-dungeon-cli

Or from source:

$ cd ai-dungeon-cli
$ python3 -m pip install -r requirements.txt
$ ./ai_dungeon_cli/__init__.py

Please note that it is recommended to do it in a virtual env in order to not mess up with the main Python env on your system.

Configuration

Create a file config.yml either:

  • in the same folder in your home folder: $HOME/.config/ai-dungeon-cli/config.yml
  • in the same folder as the sources: ./ai-dungeon-cli/ai_dungeon_cli/config.yml

Authentication (mandatory)

ai-dungeon-cli supports 2 ways to configure user authentication.

Either precise a couple of credentials in conf:

email: '<MY-USER-EMAIL>'
password: '<MY-USER-PASSWORD>'

Or sniff a Authentication Token and use it directly:

auth_token: '<MY-AUTH-TOKEN>'

To get this token, you need to first login in a web browser to play.aidungeon.io.

Then you can find the token either in your browser localStorage or in X-Auth-Token Request Header of the POST inputs requests made while playing.

Either way, developer tools (F12) is your friend.

Prompt

The default user prompt is '> '.

You can customize it with e.g. :

prompt: 'me: '

Dependencies

Please have a look at requirements.txt.

Limitations and future improvements

Right now, the code is over-optimistic: we don't catch cleanly when the backend is down.

A better user experience could be achieved with the use of the curses library.

For now, only the /quit and remember actions are supported. I need to enable the others (/revert, /alter...).

It would also be nice to add support for browsing other players' stories (Explore menu).

Implementation details

We fallback to a pure ASCII version of the splash logo if we detect an incompatible locale / terminal type.

Support

As you might have heard, hosting AI Dungeon costs a lot of money.

This cli client relies on the same infrastructure as the online version (play.aidungeon.io).

So don't hesitate to help support the hosting fees to keep the game up and running.

Author

Jordan Besly @p3r7 (blog).

Contributors

Major contributions:

  • Idan Gur @idangur: OOP rewrite of game logic
  • Alberto Oporto Ames @otreblan: packaging, submission to AUR

Minor contributions:

  • Robert Davis @bdavs: pip requirements
  • @Jezza: suggested login using creds

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai-dungeon-cli-0.1.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distributions

ai_dungeon_cli-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

ai_dungeon_cli-0.1.3-py2-none-any.whl (8.3 kB view details)

Uploaded Python 2

File details

Details for the file ai-dungeon-cli-0.1.3.tar.gz.

File metadata

  • Download URL: ai-dungeon-cli-0.1.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for ai-dungeon-cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4ff2f526c9a17a9591ae1a33a2b48f061350b3f4f0bf45e3e186f924a883e2cd
MD5 a7669f191bf757ec50edb87972b8519a
BLAKE2b-256 42c2976afe8332fecf30c5f52602949e1ed0899fee38ee33aecd42ee5911161a

See more details on using hashes here.

File details

Details for the file ai_dungeon_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ai_dungeon_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for ai_dungeon_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2f94bf0fcea3f03a750d1f530f0e1230b1e4a5bdbeb13789762cb015568c28
MD5 de952ad3db18b9d7589392779938be93
BLAKE2b-256 e3f7a664e7ca0c0f554d719d5802e52c3f99830129665c5946fa1891a4da7554

See more details on using hashes here.

File details

Details for the file ai_dungeon_cli-0.1.3-py2-none-any.whl.

File metadata

  • Download URL: ai_dungeon_cli-0.1.3-py2-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for ai_dungeon_cli-0.1.3-py2-none-any.whl
Algorithm Hash digest
SHA256 98896eea1683e8f126d2edea208a6626b91991a359f40591c5b1ee8766f1130c
MD5 cac20a5b7a4b6759c6ee5a8664a5302e
BLAKE2b-256 462eaa42ea159202b8d1ed033f3dc676d013be3b7931da8642a8580042ab59bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page