Glulx

class textworld.envs.glulx.git_glulx.GitGlulxEnv(*args, **kwargs)[source]

Bases: Environment

Environment to support playing Glulx games.

This environment supports playing text-based games that were compiled for the Glulx virtual machine. The main advantage of using Glulx over Z-Machine is it uses 32-bit data and addresses, so it can handle game files up to four gigabytes long. This comes handy when we want to generate large world with a lot of objects in it.

We use a customized version of git-glulx as the glulx interpreter. That way we don’t rely on stdin/stdout to communicate with the interpreter but instead use UNIX sockets.

Parameters:

request_infos – Information to be included in the game state. By default, only the game’s narrative is included.

close()[source]

Ends the game.

Return type:

None

load(ulx_file)[source]

Loads a new text-based game.

Parameters:

path – Path to the game file to load.

Return type:

None

render(mode='human')[source]

Renders the current state of the game.

Parameters:

mode (str) – The mode to use for rendering.

Return type:

None

reset()[source]

Starts game from the beginning.

Return type:

str

Returns:

Initial state of the game.

step(command)[source]

Performs a given command.

Parameters:

command (str) – Text command to send to the interpreter.

Return type:

str

Returns:

A tuple containing the new game state, a reward for performing that command and reaching this new state, and whether the game is finished or not.

property game_running: bool

Determines if the game is still running.

Return type:

bool