Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Announcements, support questions, and discussion for Quest Machine.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by GorkaGames »

Tony Li wrote: Wed Nov 21, 2018 6:17 pm Hi,

Procedural quests are a little complicated to get started with. I added an example to the tutorial assets:

QuestMachineTutorialAssets_WithProceduralChestQuest.unitypackage

To play it, you must also import some free assets from the Asset Store:
The files in are Quest Machine Tutorials / 05 Procedural Quest. The scene is Supplemental Chest Example.

The quest giver will generate a quest to bring him the chest of gold from the mysterious circle.

It uses these assets:
  • DomainType_Circle: Represents the mysterious circle.
  • EntityType_Chest: Represents a chest of gold.
  • Faction_Chest: Represents the chest's faction.
  • Action_Retrieve: The action to move the chest from its current domain to the player's inventory domain.
  • EntityType_QuestGiver: Represents the quest giver.
  • Greed: Drive type.
The first step of procedural quest generation is to make a list of the entities that the NPC knows about. In this case, the NPC watches the Mysterious Circle domain, which contains a chest. So the NPC knows about the chest.

The second step is to run urgency functions on all of the entities. The NPC's faction relationship to the chest is -100. The chest has a Threat urgency function. You can think of it like this: The fact that the chest is out there in the world, and not in the NPC's possession, is a "threat" to the NPC's happiness. So the NPC will choose to make a quest about the chest.

The third step is to choose an action. The NPC will choose the Retrieve action, which removes the chest from the world -- that is, it removes the "threat" to his happiness.

Quest Machine doesn't have an inventory system, so the example action is simplified. In your game, you could define a new action to actually give the chest to the NPC. The action could listen for a message like "GaveToNPC"+"Chest".

The quest giver's Greed drive is +100. Action_Retrieve has a Motive whose Greed is +100. The quest giver will choose this motive because it's similar to his Greed drive.

The last step is to make the plan. The Retrieve action has no requirements, so the plan is only one step.

Once you get the basic quest working, you can make it more complicated. For example, maybe the Retrieve action only works if there is an open chest. To change from a closed chest to an open chest, the player must complete a "Cast Spell" action. To cast the spell, the player must first get the spell scroll. To get the spell scroll, the player must defeat a wizard. Then the plan might consist of these actions:
  • Defeat: Wizard (Effect: adds scroll to world)
  • Get: Scroll (Requirement: scroll is in world. Effect: adds scroll to player)
  • Cast: Scroll (Requirement: player has scroll. Effect: remove closed chest; add open chest)
  • Retrieve: Chest
This is not over complicate things? I mean, I understand that greed for retrieving the chest would be enough to fire the quest. I don't understand why add the thread on "unhappiness".
I say because otherwise everytime to design a quest, you need like double study: Drives, threads....Is not possible to create the quest just with one of them?

Thanks,
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by Tony Li »

Yes, you're correct. I chose the complicated setup because I thought it might be more familiar, since it's very similar to the procedural "kill orcs" quest.

But you could simplify it by writing a new "drive alignment" urgency function. In fact, I might include this urgency function in version 1.1.0.

This urgency function would simply return a value that indicates how well the chest's drives align with the NPC's drives. I'll use normalized values (-1 to +1). For example, if the NPC is greedy (Greed = 1) and the chest of gold has a drive of Greed = 1, then the urgency function would be 1 * 1 = 1.

If the NPC is somewhat greedy (Greed = 0.5), then the urgency function would return 0.5 * 1 = 0.5.

If the NPC is not greedy at all (Greed = 0), then the urgency function would return 0 * 1 = 0. If an urgency function returns 0, the NPC will not generate a quest about the entity.

Let's say there's a chest of gold (Greed = 1) and a chest of silver (Greed = 0.5).

If the NPC is greedy (Greed = 1), then the gold would return 1 * 1 = 1. But the silver would only return 1 * 0.5 = 0.5. This means the gold's urgency function has a higher value, so the NPC will more likely choose a quest to get the gold instead of the silver.

Using this urgency function, you don't need to use factions or the Threat urgency function.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by GorkaGames »

Tony Li wrote: Thu Nov 22, 2018 6:15 pm Yes, you're correct. I chose the complicated setup because I thought it might be more familiar, since it's very similar to the procedural "kill orcs" quest.

But you could simplify it by writing a new "drive alignment" urgency function. In fact, I might include this urgency function in version 1.1.0.

This urgency function would simply return a value that indicates how well the chest's drives align with the NPC's drives. I'll use normalized values (-1 to +1). For example, if the NPC is greedy (Greed = 1) and the chest of gold has a drive of Greed = 1, then the urgency function would be 1 * 1 = 1.

If the NPC is somewhat greedy (Greed = 0.5), then the urgency function would return 0.5 * 1 = 0.5.

If the NPC is not greedy at all (Greed = 0), then the urgency function would return 0 * 1 = 0. If an urgency function returns 0, the NPC will not generate a quest about the entity.

Let's say there's a chest of gold (Greed = 1) and a chest of silver (Greed = 0.5).

If the NPC is greedy (Greed = 1), then the gold would return 1 * 1 = 1. But the silver would only return 1 * 0.5 = 0.5. This means the gold's urgency function has a higher value, so the NPC will more likely choose a quest to get the gold instead of the silver.

Using this urgency function, you don't need to use factions or the Threat urgency function.
Great, I like more this approach, please tell me how can I do or get the new "drive alignment" urgency function.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by GorkaGames »

ok, everything works fine now but.....

I've set up a very easy "kill" quest where there are 3 entities (enemies) that are into the domain.
Once I kill them I get the reward, everything fine.....
But I come back to the quest giver and she is giving me again the same quest another 3 times (even when there are no more entities on the domain, I have also check this on the component in run time).

Settings:
- Generate quest on start (true)
- Max quests: 3
- Requiere return to complete.

Am I missing anything?

EDIT:
If I change to:
- Generate quest on start (false)
- Max quests: 1

Then works fine but.... the UI with the Quest Indicator doesn't show up so It seems that the quest giver doesn't have any quest to give you

Another thing I've seen is that if there are more than 2 quest givers only one is showing the UI Quest Indicator....... I`ve got for instance one for manual quests and another for procedural, and even when both have quests to give to the player when game starts, only one of them shows it.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by Tony Li »

Hi,

Here is the Drive Alignment urgency function that will be in version 1.1.0:

QM_DriveAlignmentUrgencyFunction.unitypackage

I updated the example scene:

QuestMachineTutorialAssets_WithProceduralChestQuest_2018-11-22.unitypackage

The QuestGiverEntity and Chest have drive Greed=100. The Chest's urgency function is now Drive Alignment.
GorkaGames wrote: Thu Nov 22, 2018 6:55 pmI've set up a very easy "kill" quest where there are 3 entities (enemies) that are into the domain.
Once I kill them I get the reward, everything fine.....
But I come back to the quest giver and she is giving me again the same quest another 3 times (even when there are no more entities on the domain, I have also check this on the component in run time).
If the entities (enemies) were disabled and not destroyed, the quest domain probably still has them in its list. The DriveAlignmentUrgencyFunction.unitypackage above also has an update to the QuestEntity component that removes them from the domain's list when they're disabled.
GorkaGames wrote: Thu Nov 22, 2018 6:55 pmAnother thing I've seen is that if there are more than 2 quest givers only one is showing the UI Quest Indicator....... I`ve got for instance one for manual quests and another for procedural, and even when both have quests to give to the player when game starts, only one of them shows it.
That shouldn't happen. In the Demo scene, all of the quest givers have indicators. Make sure each quest giver has its own Quest Indicator Manager component and its Quest Indicator UI field points to a prefab or to a unique instance in the scene. They shouldn't share Quest Indicator Manager components or Quest Indicator UIs.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by GorkaGames »

If the entities (enemies) were disabled and not destroyed, the quest domain probably still has them in its list. The DriveAlignmentUrgencyFunction.unitypackage above also has an update to the QuestEntity component that removes them from the domain's list when they're disabled.

No, they are destroyed, and they don't appear afterwards at the quest domain list, but the quest keep showing up on the quest giver, I have check it out 3 or 4 times. Can you please test it and replicate it?

Thanks.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by Tony Li »

Have you tried the patch in the file above? I think it might fix the issue.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by GorkaGames »

I think there is a bug on the last (or previous one) update that you sent me.
Now I can't assign a Domain on the Quest Generator Entity at the Quest Giver. It doesn't accept any script on the editor.
Therefore the Quest Giver doesn't give me any quest now.... :(

Thanks,

PS: I switched to 2018.3.11 yesterday, just in case.....
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by Tony Li »

I'm downloading 2018.3.0b11 now. I just tested 2018.3.0b10 with Quest Machine 1.1.0b2 and QM_DriveAlignmentUrgencyFunction.unitypackage. I can assign a DomainType asset to the Quest Generator Entity's Domain Type field, and I can assign scene objects with Quest Domain components to the Domains list. Can you provide more details or a screenshot?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Machine Tutorials: Dialogue System Integration, Procedural Quests

Post by Tony Li »

Update: No issues in 2018.3.0b11 either. Please let me know how to reproduce the issue, or post screenshots if possible.
Post Reply