Skip to main content

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 version 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

Clone the repository and install the library using:

git clone --recursive https://github.com/MikulasZelinka/pyfiction
cd pyfiction
pip install [--user] -e .

Interface

pyfiction provides a simple agent-environment interface for text-game environments.

agent-environment interface

Simple RL interface [4]. In pyfiction, the agent calls the corresponding functions of the game environment:

  • state, actions, rewards = game.read() (left branch),
  • game.write(action) (right branch).

Examples

To run any example (from the game list below or from this list), simply run:

python file.py

on these files:

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:

Adding new games

TODO.

Status

Version 0.1.0, Alpha

Project details


Download files

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

Files for pyfiction, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pyfiction-0.1.0-py2.py3-none-any.whl (75.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size pyfiction-0.1.0.tar.gz (64.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page