Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Quest Machine: Hand-Written and Procedurally-Generated Quests

Discussion in 'Assets and Asset Store' started by TonyLi, Sep 20, 2017.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Steam Summer Game Festival: The Way of Wrath

    This week during the Steam Summer Game Festival, play a free demo of The Way of Wrath, made with Quest Machine and the Dialogue System for Unity. It's a story-driven, turn-based tactical RPG that uses Quest Machine and the Dialogue System with ORK Framework integration and custom characters for the UMA avatar system.

     
    AGregori likes this.
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Quest Machine 1.2.8 Released!

    Quest Machine 1.2.8 is now available on the Asset Store.

    This update includes some minor bug fixes and updates to Invector and PlayMaker integrations.
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Dialogue System for Unity 90% Off in Power Tools Mega Bundle

    The Dialogue System for Unity, which pairs great with Quest Machine, is 90% off in the Power Tools Mega Bundle.

    You can see the Dialogue System for Unity and Quest Machine working together in games such as Animmal's The Way of Wrath, which was a hugely popular title in Steam's recent Summer Games Festival.

    If you get the Dialogue System for Unity, then you can get Quest Machine (as a separate purchase) for an additional 50% off.

    upload_2020-7-15_8-2-46.png
     
  4. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    How do I determine what version of Quest Machine is in my project?

    and

    What is the recommended update procedure?

    Also, I assume I will need QM v 1.2.8 is I upgrade my Invector TPC Shooter to the latest version. True?
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Menu item Tools > Pixel Crushers > Quest Machine > Welcome Window. Or check the _README.txt file in the Quest Machine folder.

    Just import it on top of your existing install. You can delete the previous if you want, but it's not necessary. Always make a backup before importing anything -- that's just general good practice, not specific to Quest Machine.

    No. In fact, you can download an updated integration that's newer than the one in QM 1.2.8 from the Extras page. However, you might want to update to 1.2.8 to get all the latest improvements and bug fixes.
     
    wood333 likes this.
  6. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hello,

    I have some problems with Quest Machine and Dialogue System.

    My first branch only plays if the quest is not assigned - CurrentQuestState("MyDemoQuest") == "unassigned"

    I give the quest at the end of the conversation with this lua function and it appears in the hud and journal - GiveQuest("QuestGiver","MyDemoQuest"), then I have a second branch that checks CurrentQuestState("MyDemoQuest") == "active"

    The problem is that the second branch never plays while the quest is active. I have tried a couple of things but cant get it to work and access that branch.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @skinwalker - Open a Lua Console or use the Lua entry field at the bottom of the Dialogue Editor's Watches section. Enter:

    return CurrentQuestState("MyDemoQuest")

    Does it return active?

    Can you post a screenshot of your conversation? Just the part up to those two branches will be fine.
     
  8. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Yes it returns Active, but I just found out the problem is elsewhere.

    It's related to my setup, since I have one-line dialogue that always plays when you interact with an NPC -> "How can I help you?" and then you select a bunch of options

    -Let's chat
    -Open shop
    -Duel

    And so on

    I forgot to make a link from Let's chat to the new dialogue branch. Btw, do you know if there is a better way to structure this than having my "Let's chat" option on the interaction dialogue link to 40-50 different conversations and then Im filtering which one to pick based on "CurrentDialogueId" or quest states.

    I also wonder if there will be a performance problem if I have 50-60 links and each one checks a variable (dialogue id) and some quest states.
     
    Last edited: Jul 19, 2020
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @skinwalker - Use Group nodes. (Tick the dialogue entry node's Group checkbox.)

    For example, say you have a series of quests Quest1, Quest2, and Quest3. The player can't get Quest2 until Quest1 is complete. The player can't get Quest3 until Quest2 is complete.

    Set up two group nodes with these Conditions:
    • CurrentQuestState("Quest1") ~= "success" --> Link to Quest1's nodes
    • CurrentQuestState("Quest1") == "success" --> Link to 2 group nodes that check Quest2's state*
    *In these 2 group nodes, do the same check for Quest2. If Quest2 isn't complete, link to Quest2's nodes. If Quest2 is complete, link to Quest3's nodes.

    This way, if Quest1 isn't complete yet, you don't need to check anything about Quest2 or Quest3.
     
  10. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Im not sure I understand this correctly. My entry dialogue is a separate conversation like this:



    All of the Quests are separate conversations for example Quest1 can have 3 branches in 1 conversation (Unassigned, Active, Completed), while Quest2 is a different conversation, I don't know where to set up the groups and all of the conditions and appropriate links.

    I want "Lets talk" button to choose the appropriate dialogue based on player progress (could be quests or next dialogue), it works now but Im afraid if I have 50 links and different conditions on each conversation (like check lua varaible NpcDialogueId, or quest state) it may cause performance problems
     
    Last edited: Jul 19, 2020
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    There are a few things you can do:

    1. Test performance. If it's fine, don't worry about it. While you wouldn't want to evaluation 50 conditions every frame, just once at the beginning of the conversation may be absolutely fine.

    2. Cache values. You can get and store the values in local variables in the <START> node and then check those local variables instead of running the functions again:

    upload_2020-7-19_11-17-2.png

    Note: If you know that the NPC will always have something to say, untick the Dialogue System Trigger's "Skip If No Valid Entries" checkbox. This way it doesn't have to evaluate the conditions once before starting the conversation, and then evaluate them a second time when actually running the conversation.

    3. Use group nodes to cut off evaluation early. Example:

    upload_2020-7-19_11-9-13.png

    In this example, "Let's talk" only does two checks: Is Quest1 complete or not?

    If Quest1 is complete, it will do further checks. But if Quest1 is not complete yet, it won't do any more checks.

    Of course, you can always combine #2 (cache values) and #3 (group nodes) to be even more efficient. Although that might be overkill.
     
    skinwalker likes this.
  12. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Thanks for the good explanation as always, I will give it a try :)
     
  13. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hello,

    I managed to implement the group solution successfully, but right now I have 2 quests per npc and Im wondering how the structure would look if I have say 5 quests. In the first image you posted all of the quest nodes are children of Lets talk, while the 2nd pic has more nesting (quest 3 is a child of quest 2) and Im a bit confused how to continue from there if I had more quest.

    I think the structure would look like this



    It would end up looking like a tree. I wonder what's the difference from that and the first image you posted where all are children of Let's talk

     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    The reason for the tree is simply optimization -- possibly overkill optimization. It only checks 2 conditions at a time.

    If all are children of Let's talk, then it's certainly simpler. But it will check all of the children. The performance difference may not be perceptible, though.
     
    hopeful and skinwalker like this.
  15. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Great, I have one last question since in my game you get different quests based on your character race, but the first couple of them are kinda similar (learn how to fight, save etc). Is it possible to have 1 quest asset called LearnToFight that has 2 branches and only 1 of them is chosen based on player's faction.

    I saw the tutorials and the kill orcs or orc champion example but they are both running at the same time while I need only 1 branch (talk to specific character that teaches you how to fight) to be active at the time based on your faction.
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @skinwalker - You can set it up similarly to this:

    upload_2020-7-20_11-0-59.png

    Add a condition to the Is Elf node to require that the player's race is Elf. If so, it will activate the Explore Forest branch. As soon as Is Elf and Is Dwarf become Active, they'll check their conditions. If the player is an Elf, only the Is Elf branch will become True, which will activate the Explore Forest node.
     
    skinwalker likes this.
  17. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    That works, the problem is that I have an action on the node after the check which instantiates prefab and it runs twice. I have tried adding 2 instantiate actions in that node to test it and indeed it spawned 4 prefabs. If I remove that check node at the top and go from Start to Explore Forest (in your case), it runs once as it should be.
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hmm, it shouldn't run the same action list twice. Using my example, are you using the Is Elf node's Active actions or True actions? If you're using the Active section, try moving it to the True section.
     
  19. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    I was actually using the Explore Forest Active section, but even with True section of Is Elf it runs it twice for some reason.
     
  20. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Maybe because Im checking player race with Lua function and it runs every 1 second and it keeps checking even if the node's conditions are met, which is weird.
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I'll check it out and reply back soon.
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I don't think that's it. As soon as the Lua condition becomes true, it will stop the timer. Also, you can set the Lua Variable quest condition's Frequency To Check to zero to only check once, without using a timer at all to poll every second. Presumably the PC's race variable is set ahead of time, so you only need to check once.

    Would it be possible for you to send reproduction steps or a reproduction project to tony (at) pixelcrushers.com?
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks, @skinwalker - I sent you a patch. The fix will be in QM 1.2.9.
     
    hopeful likes this.
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    (I'm posting some info here rather than a PM because it might be useful for other Quest Machine users.)

    You can use the Quest Editor to configure actions to run when a quest node becomes active. For example, using the Elf/Dwarf example screenshot above, when the "Explore Forest" node becomes active, it could instantiate an EnemyElf prefab.

    The Instantiate action occurs when Explore Forest first becomes active.

    Let's say you save and load the game. At the point when you save, Explore Forest is already active. So when you load the saved game, Explore Forest is already active, so it doesn't run the Instantiate action again.

    If you want the instantiated EnemyElf to also reappear when you load the saved game:
    1. Add a SpawnedObject component to the EnemyElf prefab.
    2. Add a SpawnedObjectManager component to a GameObject in the scene. Assign a unique Key.
    3. Assign the EnemyElf to the SpawnedObjectManager's Spawned Object Prefabs list.
    When you spawn the EnemyElf, its SpawnedObject component will register with the SpawnedObjectManager.

    When you save the game, the SpawnedObjectManager will record that the scene has a spawned instance of EnemyElf. (It will also record its position.)

    When you load the game, the SpawnedObjectManager will re-instantiate the EnemyElf in that saved position.

    A Quest Machine user asked why the Explore Forest node doesn't re-run its active actions when reloading the game.

    In many cases, the developer doesn't want to re-run the actions -- for example if it gives the player gold or experience points or a special weapon to use in the quest. Otherwise the player could reload repeatedly to give himself unlimited gold, XP, or items.

    You can add a script to the quest giver that listens for "Quest State Changed" messages. Example:

    Code (csharp):
    1. using PixelCrushers;
    2. public class SpawnSomething : MonoBehaviour, IMessageHandler
    3. void Awake()
    4. {
    5.     MessageSystem.AddListener(this, QuestMachineMessages.QuestStateChangedMessage, new StringField("Explore Forest");
    6. }
    7.  
    8. void OnDestroy()
    9. {
    10.     MessageSystem.RemoveListener(this);
    11. }
    12.  
    13. void OnMessage(MessageArgs messageArgs)
    14. {
    15.     if ((QuestNodeState)messageArgs.firstValue == QuestNodeState.Active)
    16.     {
    17.         // Instantiate the elf prefab here.
    18.         // (Alternatively for more flexibility, get the quest's actions list and execute it.)
    19.     }
    20. }
     
    skinwalker likes this.
  25. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hello,

    I have something that I have no idea how to fix. It's related to Quest Giver. Let's say that you have 5 quests in the quest giver list, you complete 3 of them so it has only 2 now and then save, later on you decide to add 5 more quests.

    Now the Quest Giver has 10 quests in the editor, but when you load your save the quest giver has only 2 quests - 3 are completed so they arent showing but what's more worrying is that the 5 new quests that I added aren't there either - they get overridden by the old save file.

    In my project with monthly releases we add new quests every month and I dont want to make players restart their game every month. I can send a demo project to replicate it if you want, but its pretty easy to spot on.

    I dont know why the quest giver component saves the quests it offers, they can change at anytime or what most likely happens is the size of the list will increase during development.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    In many cases -- such as procedurally generated quests -- you definitely want to save the quest giver's list. I can add a checkbox to change that behavior so it can pull in new hand-written quests. However, that might be too simplistic to handle all situations. I'll think over the best way to add this. In the meantime, if you're in a pinch you can override the QuestGiver.ApplyData method.
     
  27. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Let me know when you make that change, since my game is only using handwritten quests
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Will do. I'll plan to make it this weekend and send you a patch in PM.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    @skinwalker - I sent you the patch.

    In the next release, Quest Giver and Quest Journal components will have a new checkbox in Save Settings called "Add New Quests Since Saved GAme". If ticked, any new quests that were added after the game was saved will be added when loading the saved game.
     
  30. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I just updated QM from 1.2.4 to 1.2.8 by updating on top. No errors in console. 2d physics enabled. Running demo.
    I cannot pick up quests? Pop up quest giver comment windows do work, and I can kill rabbits and crush barrels, but I cannot get a quest? Journal opens but has no entries. Quest giver indicator is exclamation point.

    SOLVED: originally I had 2 errors. Fire 1 and Fire 2. Turns out your script requiring the inputs is case sensitive, because unity (or another asset) did have fire 1 and fire 2 inputs set, but with small case "f". I removed the errors by changing the name to upper case in the inputs Fire 1 and Fire 2. The next trick was the existing fire 2 (now "Fire 2") had no positive button setting, but "Fire 1" did, leading me to assume they were both set up. On reexamination, I saw the missing positive setting for Fire 2, I fixed that, and now all inputs are functioning as expected.
     
    Last edited: Aug 6, 2020
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Glad you got it straightened out! One possibility is that another complete project asset overwrote the default Unity input settings.
     
    wood333 likes this.
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Quest Machine 1.2.9 Released!

    Version 1.2.9 of Quest Machine is now available on the Asset Store. This version contains miscellaneous improvements and bug fixes as well as updates for several third party integrations.

    Reminder: Quest Machine is currently 50% in the Discounts & Dragons Sale.

    Release Notes
    • Added: QuestGiver/QuestJournal/QuestListContainer Add New Quests Since Saved Game checkbox.
    • Improved: InputDeviceManager has option for keyboard input to switch to keyboard mode.
    • Improved: EnableOnStart now has public property for component to enable.
    • Fixed: Timing issue in which active quests assigned to QuestJournal at design time might not appear in HUD until UIs are repainted.
    • Fixed: Bug where node's actions could be run twice when parent changes to True state.
    • Fixed: When deleting the last quest in QuestJournal/QuestListContainer Quests list, quest inspector now clears.
    • Dialogue System: Added Allow Original UI During Conversations checkbox.
    • Invector: Updated for 2.5.3.
    • Opsive Controllers: Updated interaction script to work with UCC multiplayer.
    • ORK: ORK Give Exp action can now give rewards to any stat type; fixed inspector bug in ORK Icon quest content.
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Quest Machine 50% Off

    Reminder: Quest Machine is 50% off in the Discounts & Dragons Sale.

    If you're already a Dialogue System for Unity or Love/Hate user, Quest Machine includes integration with both, as well as integration packages for many major assets including Opsive & Invector character controllers, Emerald AI, ORK Framework, PlayMaker, uMMORPG, and more.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    GDC recently made Daniel Brewer & Rez Graham's GDC 2018 talk available on YouTube:

    Knowledge is Power: An Overview of Knowledge Representation in Game AI


    If you're using Quest Machine's procedural quest generation features, their talk is a great overview of how games provide world state information to AI agents. Quest Machine uses smart objects, entity information, and task planning to generate new quests at runtime based on the current state of the game world.

    Of course, you can always write your quests by hand in the node-based visual editor, and mix and match hand-written quests with procedurally-generated ones.

    Reminder: Quest Machine is currently 50% off in the Asset Store's Discounts & Dragons Sale.
     
    skinwalker likes this.
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Reminder: Today is the last day of the Discounts & Dragons sale. If Quest Machine is on your list, get it before midnight PDT to save 50%.
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Quest Machine 1.2.10 Released!

    Version 1.2.10 is now available on the Asset Store! This version adds support for Opsive's Ultimate Inventory System. The integration will be available on opsive.com with Opsive's next update of their assets.

    Release Notes:
    • CHANGED: QuestJournal Remember Completed Quests checkbox is now observed. You may want to tick it on your player/quester QuestJournals.
    • Added: QuestGiver/QuestJournal/QuestListContainer Add New Quests Since Saved Game checkbox.
    • Improved: When QuestGiver only has unofferable quests, now shows unofferable text if available; otherwise shows no quests to offer text.
    • Improved: Added Quest HUD Hide If No Tracked Quests checkbox.
    • Improved: InputDeviceManager improved mouse movement tracking to determine when to switch to mouse mode.
    • Fixed: Bug where node's actions could be run twice when parent changes to True state.
    • Fixed: Timing issue in which active quests assigned to QuestJournal at design time might not appear in HUD until UIs are repainted.
    • Fixed: "Return to X." journal entry in generated quests now has period at end.
    • Dialogue System: Added Allow Original UI During Conversations; added custom lua functions to "..." dropdown menus.
    • Save System: Added option to automatically unload any additively-loaded scenes when changing scenes.
    • Save System: Fixed AutoSaveLoad save issue when quitting application.
    • Invector: Updated for 2.5.3.
    • Opsive Character Controllers: Updated interaction script to work with UCC multiplayer.
    • Opsive Ultimate Inventory System: Added support.
    • ORK: Fixed inspector bug in ORK Icon quest content; ORK Give Exp action can now give rewards to any stat type.
    • Rewired: InputDeviceManagerRewired now recognizes negative button input as well as positive.
     
    skinwalker likes this.
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Ultimate Inventory System Integration Available

    Up-to-date integration for Opsive's Ultimate Inventory System is now available on Opsive.com.
     
    skinwalker likes this.
  40. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    The Invector integration video tutorial has an instruction to uncheck the "use instance" box in Third Person Controller - Grounded. There is no such box in the current Invector Shooter asset. Should I ignore this?
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @wood333 - Yes, you can ignore that step. Invector moved it around in different versions and then eventually got rid of it.
     
    wood333 likes this.
  42. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Quick Question on the Data Base. How many do I need? Is one enough for a project or do I need more?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Just one is fine. The databases are only used to fill Quest Machine's internal list of quests when it starts up. So it makes no difference whether you have 1 database with 1000 quests, or 1000 databases with 1 quest each.
     
    wood333 likes this.
  44. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    In the QM tut 1 the Quest Journal is placed on the Player. In the Invector integration tut the Quest Journal is placed on its own game object. Which is better? Is there a reason to prefer one over the other?
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @wood333 - This is a holdover from the way the Invector controller used to work. Either way is fine. Conceptually, I prefer to have the Quest Journal on the player, since the player is the one doing the quests.
     
    wood333 likes this.
  46. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I am having an issue with the save system. When I hit the load button, I get a second copy of my Player dropped from above the ground, so I have two. If I load again, I have four. Any thoughts on this?
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    If you're using Invector, make sure you've turned off Use Instance on the player and the inventory UI. Each scene should load a fresh copy. The stats will be transferred from the save system.
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Quest Machine 1.2.11 Released!

    Quest Machine 1.2.11 is now live on the Asset Store with a highly-requested addition: scene-based UnityEvents!
     
  49. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    The problem was not with Invector but with the Inventory Pro "Player's Collections" component on the Player. It has a check box for Don't Destroy on Load that was checked by default. I unchecked it, and QM save/load is performing as expected.
     
    TonyLi likes this.
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670