What it is
TextWorld is an open-source project by microsoft on GitHub. It is a text-based game generator and an extensible sandbox learning environment for training and testing reinforcement learning (RL) agents. You can generate text-based games with `tw-make`, then play them yourself in the terminal with `tw-play`, or interact with a game through a Gym-like API in Python. The project uses generated text-based games to train and test RL agents. The README says it supports Python 3.9 to 3.12 on Linux and macOS, and Windows users can use Docker. When generating a game, you can customize the number of rooms, the number of objects and the minimum number of commands needed to win.
Highlights:
- `tw-make` lets you set the number of rooms (`--world-size`), interactive objects (`--nb-objects`) and the minimum quest length in commands (`--quest-length`)
- A Gym-like Python API, plus example Jupyter notebooks
- Add `--viewer` while playing to follow the game state in your browser
- A Docker image on DockerHub and a VS Code extension (syntax highlighting for `.twl` and `.twg` files)
How to use:
- First, run `pip install textworld` to install it.
- Then run `tw-make custom --world-size 5 --nb-objects 10 --quest-length 5 --seed 1234 --output tw_games/custom_game.z8` to generate a game.
- Finally, run `tw-play tw_games/custom_game.z8` to play in the terminal. The README says `tw-play` only supports Z-machine game files (.z1 through .z8 formats).
Who it's for:
Developers and researchers who study reinforcement learning and need a text-based game environment for training.
Before you start:
- You need Python 3.9 to 3.12 on Linux or macOS, and Windows users go through Docker. The native components need system libraries: on Debian or Ubuntu run `sudo apt update && sudo apt install build-essential libffi-dev python3-dev curl git`, and on macOS run `brew install libffi curl git`.
- The visualization tools need `pip install textworld[vis]` and a Chrome or Firefox webdriver.
- The page does not state the cost. Check the official website for costs.
- The README lists the MIT License for TextWorld, Artistic License 2.0 for Inform7, GPL v2.0 for Jericho, GPL v3.0 for Fast Downward and the MIT License for Git. Refer to the official website for license information. Content belongs to the original authors.
Based on the project's public documentation. Not tested by AI Inspiration World.