Quest Machine Job Board Questions

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

Quest Machine Job Board Questions

Post by Tony Li »

A Quest Machine user asked some questions about procedural quest generation.
- How can I generate quests based on the player’s reputation?
- How can I generate multiple quests and display them as if they were notices on an announcement board for example. (List of quests, like the quest journal but with a different background)
- How can I set which items (it’s a scriptable object that we have) the quest will use during its generation.
I'm starting this thread for discussion of those questions.

For the UI:
  • Set up a separate quest dialogue UI for the notice board. The easiest way is to create a Canvas, add an instance of the Quest Dialogue UI prefab, and customize that instance's appearance.
  • Add a Quest Giver component to the notice board. Assign your customized quest dialogue UI instance to the component's Dialogue Content > Quest Dialogue UI field.
You can test your UI with a hand-written quest so you don't have to also get quest generation working at the same time.


General Quest Generation:

By default, quests use items that are represented by Quest Entity GameObjects in the scene. The Quest Giver monitors one or more Quest Domains, which are trigger areas in the scene. When generating a quest, it creates a "world model" containing information about Quest Entities that are in Quest Domains. A piece of information in the world model (such as "3 axes in the armory") is called a Fact.

If your items aren't represented by GameObjects in the scene, you can assign a C# method to QuestGeneratorEntity.updateWorldModel. After creating a world model from the Quest Entities in the scene, it will call your C# method, which can add new facts from other sources such as your Scriptable Object(s). For example, you could add a fact "George the Forester is in the Forest."

The quest generator will then compute an "urgency" value for each fact. Finally, it will generate a quest based on one of the most urgent facts. If George returns high urgency if he lacks axes, the quest generator will generate a quest to reduce the urgency of this fact (e.g., deliver axes to George).

The subject of the fact (George in this case) should have Quest Actions that can reduce the urgency, such as "Deliver Axes". Quest Actions can have requirements, such as "Player Has Axes".

Other entities in the world model can also have Quest Actions. For example, a forge in the armory could have the action "Craft Axe" with the effect "Player Has Axes". This action could have the requirement that the player has Iron Ore.

Similarly, a Mine entity could have an action with the effect that the player has Iron Ore.

Using this information, the quest generator can string together some actions:
  • Starting condition: Player doesn't have ore or axes.
  • Action 1 - "Harvest Ore" on Mine. Effect: Add Ore to player.
  • Action 2 - "Craft Axe" on Forge. Effect: Remove Ore from player + add Axes to player.
  • Action 3- "Deliver Axes" on George. Effect: Remove Axes from player + Add axes to George. George's urgency is reduced.
If there's no requirement on where to get the axes (e.g., forge them, loot them from monsters, steal them, etc.), you could adjust the "Deliver Axes" action so it just waits for the player to deliver n axes to George, without worrying about any prerequisite steps.


Reputation:

The reputation part is going to require a little scripting. I recommend writing a custom urgency function. From a gameplay perspective, George is only urgent if he lacks axes and if the player is a good blacksmith. If George lacks axes but the player doesn't know blacksmithing, there's no sense assigning any urgency because the player can't do anything about it.
Post Reply