Adaptive Hints by Eric Eve

Version 7

An adaptive hint system based on Menus by Emily Short.

Emily Short's Menus extension includes a mechanism for showing hints, but provides only for static hint menus. In many cases we may want our hint system to adapt to the situation in the game, showing only those hints that are currently relevant.

For example, it may be premature to display a series of hints on "How do I extract the golden egg from the glass goose?" until the player knows that there are such objects as the golden egg and the glass goose. Conversely there is no point in continuing to display this hint once the player has solved the golden egg puzzle. The Adaptive Hints extension builds on Emily Short's Menus extension to allow the author to activate and deactivate hints as appropriate.

To set up a system of adaptive hints, we first need to supply a table of hints for each hint topic, as in the Tabulation example that comes with the Menus extension. For example we might create hint tables like:

Table of Golden Egg Hints
hint     used
"How might you get an object out of a closed glass container?"     a number
"You can't just smash the glass goose, because you might never get it back together again, and Professor Gosling asked you to bring it back in one piece."
"Maybe you could cut the glass with something?"
"It would have to be something sharp and hard."
"Have you wondered what you might do with that diamond?"

Then, to use the Adaptative Hints extension, we need to define a pair of table continuations to contain, first the hints that are going to come into play later in our game, and second, the currently active hints. The first of these tables must be called "The Table of Potential Hints (continued)" and contains just two columns, "title" and "subtable":

Table of Potential Hints (continued)
title     subtable
"How do I extract the golden egg from the glass goose?"     Table of Golden Egg Hints
"How do I unlock the lead door?"     Table of Lead Door Hints
"How do I get past the deranged ostrich?"     Table of Ostrich Hints

The second table, "The Table of Active Hints", is defined in the extension, and allows for up to twenty hints to be active at once. If we need more than this we can define a continuation table, which must be called "The Table of Active Hints (continued)" and must contain four columns: "title", "subtable", "description", "toggle". This table must contain enough blank rows to accommodate the maximum number of hints that may be active at any one time. For example, if we think that we may have a maximum of thirty hints active at some point in our game, we shall need to define a continuation table with an extra 10 rows:

Table of Active Hints (continued)
title     subtable     description     toggle
text     table-name     text     a rule
with 10 blank rows

On the other hand, if we are sure there will never be more than twenty hints active at once, we need not define this continuation table at all.

We next need some mechanism for activating and deactivating hints as required. To this end we can simply use "activate {Table Name}" or "deactivate {Table Name}" as required; for example:

activate the Table of Golden Egg Hints.
deactivate the Table of Ostrich Hints.

The first phrase moves the Table of Golden Egg Hints row from the Table of Potential Hints to the Table of Active Hints, and automatically fills in the toggle column with the appropriate hint toggle rule. The second simply blanks out the row corresponding to the specified table name from either the Table of Active Hints or the Table of Potential Hints (depending which table the row currently resides in). If there is no row containing the table name, then the deactivate phrase will have no effect. Once a hint has been deactivated it is therefore no longer available to be reactivated, since it will almost certainly not be needed again. If for any reason we did need to reactivate a hint we could always choose a blank row in either the Table of Active Hints or the Table of Potential Hints and fill in the appropriate columns; e.g.:

To reinstate (hint table - a table-name) with (hint title - text):
choose a blank row in the Table of Potential Hints;
now the title entry is hint title;
now the subtable entry is hint table.

Activate and deactivate may be used at any convenient place in our code; for example, to make a hint available from the start of the game we might write:

When play begins: activate the Table of Fruit Basket Hints.

During play, it may be more convenient to watch for conditions that require hints to be activated or deactivated rather than adding activate and deactivate phrases to action responses. To this end the Adaptive Hints extension supplies a pair of rulebooks called the hint activation rules and the hint deactivation rules. These are consulted just before the current set of hints is displayed. The hint activation rules are consulted before the hint deactivation rules to ensure that obsolete rules are cleared out even if they have only just become active. To use these rules we might, for example, write:

A hint activation rule:
     if the Goose Vault is visited, activate the Table of Golden Egg Hints.

A hint deactivation rule:
     if the golden egg is handled, deactivate the Table of Golden Egg Hints.

Note that these rulebooks are only consulted when the player asks for hints, since there is no need to bring the list of active hints up to date until the player wants to view it.

Finally, we need a way of displaying hints. This is achieved by invoking the display hints rule, which is what the asking for hints action provided in the Adaptive Hints extension does. The extension defines HINT and HINTS as the commands to display hints. It does not make HELP a synonym for HINTS since some authors may prefer to use HELP for other purposes (e.g. as a synonym for ABOUT or to display a general help menu rather than specific hints). If you want HELP to be a synonym for HINTS you can, of course, simply define:

Understand "help" as asking for hints.

The first time the HINTS command is used the player is given the option of disabling hints altogether. Hints can also be disabled subsequently using the HINTS OFF command. The extension does not provide a HINTS ON command to reverse this process, since this would defeat the object of allowing players to disable hints in the first place.

NOTE: Both this extension and Basic Help Menu by Emily Short define responses to the commands HINT and HINTS. To avoid a clash when you use both extensions, please include Adaptive Hints AFTER Basic Help Menu in your code: Adaptive Hints explicitly defines the commands "hint" and "hints" as something new before assigning them to its own asking for hints action.


A
 Example Escape from an Old House

A short game with several adaptive hints