-
Notifications
You must be signed in to change notification settings - Fork 40
Game file structure
Terminal Quest works by setting up the desired file structure in the home folder (in the directory .linux-story) and then allowing the user to run a limited number of commands on it.
We edit the file structure in two places. We allow the user to initialise the Terminal Quest from any challenge they desire, each of which may need a different file structure. However, there are also times while the user is playing where we need to add or remove files for the purpose of the story (e.g. when the bell rings).
When starting Terminal Quest from a specific challenge, we use default_trees.yaml to create the correct file system.
The id of the file is taken from this directory, which contains all the ascii art used in the game.
This yaml controls which files are copied across to the filesystem depending from which challenge and step we are launching from.
Example:
alarm, chair, computer, desk:
challenges:
- challenge: 1
step: 1
path: "~/my-house/my-room"
bed_my-room:
name: "bed"
challenges:
- challenge: 1
step: 1
path: "~/my-house/my-room"
As used in default_tree.yaml
There are several parameters in the yaml that can be parsed:
-
name:
this changes the name of the file to whatever is specified. If this is not specified, the ID name is used. -
directory:
if this is set to True, then the item in question is a directory, otherwise, it is assumed it is a file which can be found in the story_files directory. -
challenges:
this specifies the behaviour for specific challenges.
Within the challenges option are the following options:
-
challenge:
the challenge this rule starts for. -
step:
the step this rule starts for. The rule will continue until it is revoked in a later rule. -
exists:
if this is set to False, then the file no longer exists starting from that challenge/step. -
path:
the full game path of the parent directory. -
permissions:
the permission number you want to apply to the file/directory, e.g. 0755 to make a file executable.
Sometimes, you want the file structure to change while the user is playing the game. In this case, we change it within the relevant Step class. There are two relevant static variables:
-
story_dict
for the creation and copying of files form the story_files directories -
deleted_items
to remove specified file in the game.
For example:
deleted_items = ["~/town/east/shed-shop/Eleanor"]
story_dict = {
"Eleanor": {
"path": "~/town/east"
}
}
As used in challenge 26
Adding these as static variables in the Step class in will give the appearance that the Eleanor file has moved from ~/town/east/shed-shop to ~/town/east.