Jikca is an object oriented interactive fiction framework, persisting objects to a back-end database (MongoDB), and allowing interactive and API-driven manipulation of those objects within the game world. All objects are of some type, often referred to as a class. The root class that all game objects ultimately are a type of is: Object. It is possible to have instances of this base class within the game world; most actual objects will be of a more specific type in order to more strictly define the available attributes/properties, and to allow coding of additional behaviour. Base Objects are… dumb.
Object
Defines the properties and behaviours common to all in-game objects.
Attributes
Attributes are database-persisted values. While there is no direct behaviour as a result of changing attributes, interested other objects will be notified of the change and may perform some action themselves. Attributes fall into two distinct categories: core, defined by Python code within the server itself, and meta, or defined by users within the game world. Core are a fixed set, meta are free-form.
Core attributes are defined by data model schemas within the server.
Core attributes are declared as containing values of specific types, e.g. "name is text, age is a number".
Core attributes are referenced in code through Python's native attribute dereferencing mechanism, the period. E.g. player.name would resolve to the string that is the player's name.
Meta attributes are a free-form mapping of arbitrary string keys (names) to their values, which will typically be strings.
Meta attributes are accessed and assigned through Python's array dereferencing mechanism, square brackets. E.g. player['hair color'] = "brown"
Meta attributes are less efficient to store and especially to search. Any meta attribute that becomes critical should be considered for promotion to a core attribute within the server-side codebase.
Core Attributes
id – ObjectID
An unchanging, persistent ObjectID reference unique to this object.
name – str
An optional identifier more suitable for human consumption and text entry.
location – Reference
A reference to the physical container the object is currently placed within. May be a room (e.g. for dropped objects, exits to other rooms, etc.), player (inventory), or any other object within the game world. All objects, technically, can contain others. (Not all will permit attempts to be stuffed, however.)
This forms the "adjacency list" hierarchical model, modelling object inclusions. (That is, being able to easily query for the children—immediate descendants—of a specific object.) It is very important to note that this does not preserve the order objects are placed within each-other or "dropped", only where the objects were dropped.
Properties
Properties are programmatically defined attributes whose value is determined by the result of executing a function. They may be assignable, in which case a function is run (there is behaviour) to handle the assignment.
ancestors
A read-only collection of every parent from this object up to the universe, essentially defining the path to the object.
contents
Sometimes referred to casually as "children", a read-only collection of every object whose location is this object.
descendants
A read-only collection of every object stored within this object, regardless of the level of nesting. E.g. if the player has a box which contains a ring in their inventory, the descendants of the Player will include the box and the ring.
siblings
A read-only collection of every object within the same container as this object.
Class (Type) Hierarchy
Jikca is an object oriented interactive fiction framework, persisting objects to a back-end database (MongoDB), and allowing interactive and API-driven manipulation of those objects within the game world. All objects are of some type, often referred to as a
class
. The root class that all game objects ultimately are a type of is:Object
. It is possible to have instances of this base class within the game world; most actual objects will be of a more specific type in order to more strictly define the available attributes/properties, and to allow coding of additional behaviour. Base Objects are… dumb.Object
Defines the properties and behaviours common to all in-game objects.
Attributes
Attributes are database-persisted values. While there is no direct behaviour as a result of changing attributes, interested other objects will be notified of the change and may perform some action themselves. Attributes fall into two distinct categories: core, defined by Python code within the server itself, and meta, or defined by users within the game world. Core are a fixed set, meta are free-form.
player.name
would resolve to the string that is the player's name.player['hair color'] = "brown"
Core Attributes
id
–ObjectID
An unchanging, persistent ObjectID reference unique to this object.
name
–str
An optional identifier more suitable for human consumption and text entry.
location
–Reference
A reference to the physical container the object is currently placed within. May be a room (e.g. for dropped objects, exits to other rooms, etc.), player (inventory), or any other object within the game world. All objects, technically, can contain others. (Not all will permit attempts to be stuffed, however.)
This forms the "adjacency list" hierarchical model, modelling object inclusions. (That is, being able to easily query for the children—immediate descendants—of a specific object.) It is very important to note that this does not preserve the order objects are placed within each-other or "dropped", only where the objects were dropped.
Properties
Properties are programmatically defined attributes whose value is determined by the result of executing a function. They may be assignable, in which case a function is run (there is behaviour) to handle the assignment.
ancestors
A read-only collection of every parent from this object up to the universe, essentially defining the path to the object.
contents
Sometimes referred to casually as "children", a read-only collection of every object whose location is this object.
descendants
A read-only collection of every object stored within this object, regardless of the level of nesting. E.g. if the player has a box which contains a ring in their inventory, the descendants of the Player will include the box and the ring.
siblings
A read-only collection of every object within the same container as this object.