Learn More

Text Games: A Colossal (Research) Adventure!

Text Games (or, Interactive Fiction, or Text-based Virtual Environments) are interactive virtual worlds that users observe and act upon using words instead of pixels. They have a long history, with many of the earliest games (such as the iconic Zork) being text-based games. Games are turn-based, with each turn consisting of the user receiving some observation from the environment (for example, “You are standing in an open field west of a house, with a boarded front door. There is a small mailbox here”), and responding with an action they would like to take (such as “open mailbox”). This continues for some (typically large) number of steps until the game finishes.

For artificial intelligence researchers, text based games are an interesting research paradigm — particularly in that their requirement for world knowledge and complex multi-step reasoning tends to make them extremely difficult for contemporary agents to solve. For example, this review article shows that, after years of active research by the artificial intelligence community, the best text game agents are only able to solve about 12% of Zork, even though it was authored in 1977.

What text games exist for research?

Text game research is typically divided into two areas: (1) research on interactive fiction environments, which are essentially popular games from the past (such as Zork), and (2) research on purpose-built research environments, that help teach or measure an agent’s ability to perform (for example) specific kinds of common-sense or scientific reasoning. Here are a few places to get started:

Jericho (https://github.com/microsoft/jericho) provides a Python framework to load interactive fiction games such as Zork that were written in the most popular historical format called Z-machine. This format was developed by Infocom in the 1980s, and is still used today.

TextWorld (https://www.microsoft.com/en-us/research/project/textworld/) is a framework for Python that allows creating research-oriented games, that themselves compile down into Z-machine code. Many popular benchmarks are implemented in TextWorld, including CookingWorld (a cooking game), and TextWorld Common Sense (a game where you must put household objects back in their common-sense locations). A special version called TextWorldExpress (https://github.com/cognitiveailab/TextWorldExpress) includes streamlined versions of these games that can run as fast as 1 million steps per second!

ScienceWorld (https://sciworld.apps.allenai.org/) and other specialized simulators are designed to simulate higher-fidelity text based environments. ScienceWorld contains 30 different games centered around common elementary science tasks (like boiling water, building electrical circuits, or identifying dominant versus recessive genes), with simplified engines for simulating thermodynamics, electricity, chemistry, friction, and life processes. A visualization of the ScienceWorld environment shown below. You can try a ScienceWorld task on HuggingFace spaces, or by installing the environment for Python using pip.

Where do I start?

There’s no better way to start than by installing an environment and playing yourself, to get a feel for the complexity, elegance, and challenges of text-based interactive simulated environments. After that, please explore the quickly-expanding body of research on interactive environments on the Text Game Research List.

Many different types of research contributions are possible. Some are particularly interested in building new simulators, or constructing new text games / interactive text environments to benchmark agents’ reasoning abilities. Constructing text games can be effortful — though generally much less so than for 2D or 3D games — and as such, there is active research in automatically building virtual worlds. Constructing virtual agents that explore virtual environments to accomplish a task is becoming a modern vehicle for evaluating reasoning, as agents require many of the same abilities as complex question answering systems, but also the ability to observe, reason, and interact with an environment across long periods of time to arrive at a solution to a given task. These are only a few of the possible research directions possible with interactive text-based games.