davedotluebke / old-skool-text-game

Coding project used to learn Python
5 stars 4 forks source link

Features: scenery-like functionality for objects #183

Open davedotluebke opened 4 years ago

davedotluebke commented 4 years ago

Scenery objects allow us to add descriptive elements to rooms in a lightweight fashion. One can easily create a scenery object to add to a room, which the player can "look at" or "examine" for descriptive text, and the add_response() method allows lightweight verbs that simply print a response when called on the scenery object. It would be nice to support similar functionality for generic objects. For example, if the long description of a sword includes, "Crude orc-runes have been carved into the metal with a stone," the player should be able to type "look at runes" or "read runes". Today this is difficult since the only object the parser knows about is the sword; the wizard has to use a workaround such as adding "runes" to the possible names of the sword, and then overloading the look_at() function.

I propose to support a list of descriptive features for every object. Each feature has a list of names and adjectives, which the parser will know about, and can have a set of verb-response tuples similar to Scenery objects.

If this works well we could consider replacing scenery objects for rooms, though that would likely be more trouble than it is worth.