View on GitHub

ZTree

A python graphing tool to construct network graphs of Z-Games

Download this project as a .zip file Download this project as a tar.gz file
display mode 0 Display mode 0 shows every node present in the game and links objects to their parents. Passing in the sibling flag will also display sibling relations between nodes. display mode 1 Display mode 1 shows all the rooms in the game with directional edges drawn. Nodes that aren't legally interpreted as rooms but can be moved to will be displayed as just text. display mode 2 Display mode 2 shows all the objects in the game and their relations (e.g., if a pen is inside a drawer inside a desk). display mode 3 Display mode 3 shows all objects inside their respective room with directions between rooms drawn. Somewhat experimental. Objects with no valid room as drawn as text with no node.

About

ZTree is a python graphing tool that constructs network graphs of Z-Machine games (http://inform-fiction.org/zmachine/). It is packaged with a slimmed-down version of Mark Howell's ZTools to dump the game files. A helper script can be found in the "Scripts" directory and is supposed to be run from there like so:

./dump_game ../Games/awaken.z5

Dumps of the following games are already provided (as they were used for testing):

These dumps (specifically the object files) are then passed into the ZTree.py parser like follows:

python ZTree.py -o ../Dumps/awaken.z5_object_dump -n 1,2,3,4,6,19,20,21,22,23,118,125 -d 1

python ZTree.py -o ../Dumps/Adventureland.z5_object_dump -n 2,4,6

python ZTree.py -o ../Dumps/happy.z5_object_dump -n 1,2,4,6,19,20,21,22,24 -d 3

ZTree then uses Matplotlib to display an interactive version of the networked graph of nodes.

Usage options are as follows:

usage: ZTree.py -o <object_file> -n <node1,node2,node3>

ZTree version 1.0 - maps Infocom story files into a directional graph. By Nathan Tucker.

    -o, --objects   path to object file (from infodump -o)
    -s, --siblings  display sibling relations (default false)
    -n, --nodes comma-separated list of nodes to ignore
    -d, --display   display all nodes(0), only rooms(1), only objects(2), objects in rooms(3)

example: ZTree.py -o ../Dumps/awaken.z5 -n 1,4,6,118,125

The different display modes are shown above.

Source

ZTree is licensed under the Apache License, so feel free to play around with the source. It uses the following resources from the following sources:

Future Development