pyfiction, a universal API for text-based games
Project description
Python API for all kinds of text-based games.
Introduction
Text-based games, more commonly known as interactive fiction (IF), come in various formats and use different interpreters that aren’t often compatible with each other.
The goal of pyfiction is to wrap the functionality of different IF simulators and to provide a universal API for text games for research purposes.
Pyfiction also includes sample agents that can learn to play the supplied text games.
Requirements
Python 3.6 (older versions might work but they aren’t tested, Python 3.5 tested briefly)
text-games submodule for games ‘Saving John’ and ‘Machine of Death’
keras, tensorflow and their dependencies for launching the example agents
selenium and chromedriver for running the HTML-based games
h5py for saving and loading models
pydot for visualising model graphs
Installation
To install the latest published version, simply run:
pip install pyfiction
To install the bleeding-edge version from this repository, run:
git clone --recursive https://github.com/MikulasZelinka/pyfiction cd pyfiction pip install -e .
Interface
pyfiction provides a simple agent-environment interface for text-game environments.
Examples
To run any example (from the game list below or from this list), simply run:
python file.py
on these files:
An SSAQN (siamese state-action q-network) agent [3] learning to play multiple games at once,
Interactive testing of state-action Q-values of the above agent trained on the supported games,
or on one of the supported games below.
Currently supported games
The following links lead to training experiments of the SSAQN agent on the supported games:
Cat Simulator 2016 [HTML-based]
Star Court [HTML-based]
The Red Hair [HTML-based]
Transit [HTML-based]
Additionally, the plan is to integrate the individual games to the OpenAI Gym, see the pull request and the text_games branch for details.
Adding new games
TODO.
Adding new HTML-based games is straightforward; refer to the already implemented games (such as Cat Simulator 2016) and to the differences between their implementations in the games and simulators folders for inspiration.
It is only necessary to a) parse the available state and actions and b) identify and numerically annotate the endings.
TODO
Better documentation for adding new games.
Update SSAQN agent to tensorflow 1.5.
Tests.
References
[1] Language Understanding for Text-based Games Using Deep Reinforcement Learning
[2] Deep Reinforcement Learning with a Natural Language Action Space
[3] Using reinforcement learning to learn how to play text-based games (Master thesis; defended in 09/2017)
Status
Version 0.1.3, Alpha
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
Built Distribution
File details
Details for the file pyfiction-0.1.3.tar.gz
.
File metadata
- Download URL: pyfiction-0.1.3.tar.gz
- Upload date:
- Size: 8.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93be613bae3dd6226e90cd06bbc80d915c747f05a02d0604e4895683a59eb924 |
|
MD5 | ab38d7105586823b5e213e4e30988509 |
|
BLAKE2b-256 | 0f37e39d6c221fbf7881ae32ea7df23be23c8d982c9338f6ed456eb87b1cced2 |
File details
Details for the file pyfiction-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: pyfiction-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 8.0 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 093806de38bbfd96299f6228ae71e1c191d09b233069f466c2ac2d99625e9089 |
|
MD5 | a7ff547bb1b333d49b232d9623c2a423 |
|
BLAKE2b-256 | fd95c157308b6f3037f5632a270904a60b4de70d3d5158906a0ccb5c9e64f891 |