User Tools

Site Tools


dromed:genies

Genies–Helper AI

:!: This tutorial requires a custom gamesys.

It is commonly known that AI Conversations are a very powerful tool, capable of doing some things that cannot be done any other way (without custom scripting), such as adding links ingame, etc.

When a mission requires the power of the conversation, it has become customary to create a never efficient AI (I usually name it Conv) in a blue room, ready to be called upon at any moment at which it might be needed.

There are, however, two flaws with this system:

The first is that the AI uses a significant amount of system resources, as the AI needs to have its AI→AI Core→Efficiency Settings disabled (otherwise it would only be able to enact conversations when the player was nearby). One AI which is always active is not such a major issue, but in some cases it might be necessary to have multiple conversation-AIs (see below), and with each additional AI the slowdown becomes more significant.

The second problem is that in some cases, the AI’s conversations might be triggered by the player’s actions, which can be unpredictable at best. An example of how this could cause problems is required:

First, imagine that the player has a whistle in his inventory, that, when frobbed, triggers a conversation that adds a ControlDevice link from a lever to a door, waits 5000ms, and then removes the link again.

Next, imagine that the player is also carrying another item, such as a small chest, and that when this item is opened (frobbed in inventory), two items are added to the player’s inventory (by adding Contains links from the Player to them via a conversation).

Now consider what happens when the player blows the whistle, and then opens the small chest immediately afterwards. The ControlDevice link is added, the AI starts its 5000ms wait, but is then given a new order (to add the Contains links), the original conversation is cancelled, and the ControlDevice link is never removed.

Of course, there are other ways of getting around that particular problem, but it makes the point quite clearly.

The best way to solve both of these problems is to utilise a ‘Genie’ AI that is summoned to perform a specific task, and then banished again.

To create such a genie, navigate to Fnord (-130) in the object hierarchy, and create a new archetype named Genie. Configure the properties as follows:

And now, for the most important property: AI→Responses→Alert Response. For the main Genie archetype, just set the Alert Level to (3) High, and the Priority to Absolute (not Very High!). Since the Genie’s alertness is capped at level (3) High, these responses will always be carried out as soon as it is created. Leave everything else blank for the moment.

You also need to make sure that the genie is ‘banished’ again, so add Tweq→Delete, enter 5000 into the Rate field, and add the Sim flag to AnimC. Halt should read Destroy Object. Also add Tweq→DeleteState and set the AnimC to On.

Now, instead of creating a conversation linked to permanent conversation-AI, simply create a new archetype under Genie and add the pseudo-script steps directly to its Alert Response property.

Instead of triggering the conversation, create the appropriate Genie, either by emitting it from an EmitterTrap, or directly through the Create Object receptron.

To make things easier to follow, all Genie archetypes should be given names beginning with G-, for example G-SmallBox1. Remeber that the archetype name must be 15 characters or less if you want to emit it from an EmitterTrap.

No bottles required.

dromed/genies.txt · Last modified: 2007/06/26 17:40 (external edit)