[HOWTO] How To: Debug Procedural Quest Generator

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
Tony Li
Posts: 20705
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Debug Procedural Quest Generator

Post by Tony Li »

When a QuestGeneratorEntity procedurally generates a quest, it follows these steps:

1. Makes a list of all QuestEntities that it sees in its QuestDomains (such as Domain_Forest). It records a WorldModel containing a list of Facts such as <3 EntityType_Orc in DomainType_Forest>.

2. Computes an urgency value for each Fact.

3. Chooses one of the Facts with the highest urgency value. This is the goal target.

4. Examines the Actions assigned to the Fact's EntityType (e.g., Action_Kill). Based on the Action's Effects, it chooses an Action that will reduce the WorldModel's total urgency. For example, Action_Kill will remove the quest target from the world model. If more than one action will accomplish the goal, it will choose the action whose Drives best match the QuestGeneratorEntity's drives. Taking Action_Kill, for example, since the quest target will no longer contribute to the WorldModel's total urgency, it is a good choice. This is the goal action.

5. Determines any prerequisite actions that the player must complete in order to be able to do the goal action. This is the plan, which the QuestGeneratorEntity turns into a quest.

To start debugging your generator, tick the Quest Machine GameObject's Debug Settings > Debug and Debug Quest Generator checkboxes.

Then play the scene so the QuestGeneratorEntity will try to generate a quest. In the Console window, look for a log containing "WORLD MODEL", such as:

Code: Select all

WORLD MODEL: (observer:Knight)
Domain:Forest, EntityType:Wolf, Count:2
   Urgency:52.34568
Domain:Forest, EntityType:Orc, Count:3
   Urgency:170.8642
Domain:Forest, EntityType:Barrel, Count:1
   Urgency:0
Domain:Field, EntityType:Carrot, Count:13
   Urgency:0
Domain:Field, EntityType:Rabbit, Count:2
   Urgency:0
MOST URGENT: Domain:Forest, EntityType:Orc, Count:3, Urgency:170.8642
CUMULATIVE URGENCY: 223.2099
This will show the world model and each Fact's urgency value. It will choose the goal target from the Facts with the highest urgency values. (Orc in this case.)

Then look for a log that contains the word "Goal", such as:

Code: Select all

Quest Machine: [Generator] Knight: Goal: Kill 3 Orc
This is the goal action.

From there, you should see in the Console window that it generates a plan and checks RewardSystems to assign quest rewards.
Post Reply