Item
s are interactable elements in the game, which are used to set goals, record whether something is done and manipulate other elements in the game.
Every item is associted with a .item
file. A .item
file is simply a json file with the following structure -
{
name: "string",
desc: "string",
char: "string",
need_input: boolean,
collectable: boolean,
answerhash: "[string]",
media_path: "[string]",
code_file: "[string]"
}
name
, desc
are self explanatorychar
is the display character of the item. If not specified, it defaults to ‘?’. It can be set to None
for invisible items.need_input
tells the game engine whether an input bar is to be displayed when the item is interacted withcollectable
tells the game engine if the item is to be put into the [Pocket][#pocket] when interaction is successfulanswerhash
is an optional parameter which is the correct “answer”. See moremedia_path
is an optional parameter which gives information about the media that is associated with the item. See morecode_file
is an optional parameter which gives the path to the .py
file that is run when the item interation is successful. See morePocket is a list of items that are “collected” by the user. This can be used to record what the user has seen, or to retain items which may be useful for the user to progress in the game. Pocket items can be reinteracted with. Items can be marked as collectable in the .item
file or can be added manually via code file.
The game always initializes with no items in the Pocket
.
The function
Pocket.append(item)
Pocket.remove(item)
The following section describes how an item interaction works.
title
desc
need_input
media_path
is non-emptyanswerhash
. If matched, interaction ends with success else, interaction continues.need_input
, then interation is not successfulcollectable
, then item is added to Pocketcode_file
is non empty, code_file
is runPocket
code_file
is non empty, code_file
is runThis parameter holds the hashed version of the “corret answer”. We store it as a hashed value because it is technically possible for the source code to be shared to the participants.
To hash your answer, do
import hashlib
answer = "the actual answer here which is case-sensitive"
print(hashlib.md5(answer.encode()).hexdigest())
and then copy the output to this parameter
Items can have some kinds of media associated with them. Generally these are pictures or links to websites.
Every media_path
entry should look like this
mediatype::path/to/media
Supported mediatypes are:
image
- shown as a popup in a Pillow framelink
- a link to something on the internetexternal
- playing the media is relegated to the OS and the default player is requested to play the media.Every item can be associated with a python file which will be evaluated on item interaction success. To manipulate objects in the game, you can use the game
object