yinxusen / autoplay

A learning environment for interactive fiction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autoplay: a learning environment for interactive fiction

Autoplay is a learning environment for creating agents that play text-based games. Supported games include the popular Zork series and other z-machine interpretable files (specifically the .z5 format). These games are provided as part of this repository.

This repository uses a modified fork of Frotz, a z-machine interpreter maintained by David Griffith. A python interface for Frotz is included as well, which allows games to be run in parallel and controlled using python.

By default, several independent repositories are cloned during setup to create this environment. Generally an agent will require the ability to part-of-speech tag text, so the Natural Language Toolkit (NLTK) is installed. We found word2vec to be a valuable tool, so an interface for that is installed as well.

A note: our interface for word2vec uses a part-of-speech tagged corpus, so it cannot be swapped out with a normal word2vec .bin file. The corpus used is a copy of Wikipedia from January 2016.

Setup

I. The following script will install Frotz, textplayer (Frotz interface), NLTK, word2vec, and scholar (word2Vec interface) in the autoplay folder.

$ chmod +x setup.sh
$ ./setup.sh

II. Download a copy of the scholar dependencies, extract, and move the files to autoplay/scholar. See the scholar Github page for more information on use.

Agents

A number of agents are included with this code. The agents included are: a basic navigational agent and a more sophisticated noun-verb processing agent.

We won the IEEE CIG 2016 Text-based Adventure Competition! Our autoplay-compatible agent is provided here.

Usage

Automated

Running the main file will run a number of agents on separate processes. The example below will run 5 agents on Zork I.

$ python autoplay.py zork1.z5 5

Running the code without at least two additional parameters will result in the available games being displayed.

$ python autoplay.py zork1.z5
Needs more parameters. Try 'python autoplay.py zork1.z5 5'.
Current games include:  Advent.z5 Adventureland.z5 Balances.z5 BrandX.z5 ...

Human

There are two ways to play the games, either to get more intuition about the formatting of the text, or for fun.

From the autoplay folder (text reformatted for agents):

$ python play.py zork1.z5

From the textplayer folder (direct interface with Frotz):

$ frotz/dfrotz games/zork1.z5

About

A learning environment for interactive fiction

License:GNU General Public License v3.0


Languages

Language:Python 97.7%Language:Shell 2.3%