Quest system issues

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
JorisVanEijden
Posts: 114
Joined: Mon Aug 12, 2019 5:02 pm

Quest system issues

Post by JorisVanEijden »

We've had a couple of issues with the questing system lately. Notably with the quest selection window, but there are other occurrences too.

They mostly boil down to two issues:
1. The distinction between loading a quest and starting a quest is too vague.
2. Parsing a quest adds topics to the TalkManager.

I've created a graph showing the call flows to the Questing->TalkManager interface:
QuestingVsTalkManager.png
QuestingVsTalkManager.png (215.04 KiB) Viewed 1836 times
Let's discuss ways to solve these issues.

Some simple first steps would be:
- rename QuestMachine.InstantiateQuest() to StartQuest()
- refactor usages of that method that only need to load (and not start) a quest
- move the creation of topics from the quest resources to the StartQuest method

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Quest system issues

Post by Nystul »

JorisVanEijden wrote: Sat Nov 09, 2019 2:32 pm - move the creation of topics from the quest resources to the StartQuest method
not sure if I understand exactly what you mean.
with topics do you mean quest related talk topics? one thing to consider is that dialog linked talk topics may be hidden by default and can only become available after pc learned about them - so these can by definition not be handled completely on startquest alone, they need to be updated while quest is executed whenever their resource macro gets expanded.
but you may mean just the creation of those - yes, these should be only created once ;)

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Quest system issues

Post by Hazelnut »

I've submitted a PR which allows quests to be partially parsed and used it for the quest lists. This means there are no topics registered with the talk manager to need cleaning up. I should have done this in the first place. It's much quicker and since the list only needs the name, it's a waste to process and initialise the quest.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
JorisVanEijden
Posts: 114
Joined: Mon Aug 12, 2019 5:02 pm

Re: Quest system issues

Post by JorisVanEijden »

Nystul wrote: Sat Nov 09, 2019 9:38 pm
JorisVanEijden wrote: Sat Nov 09, 2019 2:32 pm - move the creation of topics from the quest resources to the StartQuest method
not sure if I understand exactly what you mean.
What I mean is that parsing a quest should not do anything with the global TalkManager.
The messages from the quest resources should be added to the global TalkManager when the quest is started.

User avatar
JorisVanEijden
Posts: 114
Joined: Mon Aug 12, 2019 5:02 pm

Re: Quest system issues

Post by JorisVanEijden »

Hazelnut wrote: Sat Nov 09, 2019 10:07 pm I've submitted a PR which allows quests to be partially parsed and used it for the quest lists. This means there are no topics registered with the talk manager to need cleaning up. I should have done this in the first place. It's much quicker and since the list only needs the name, it's a waste to process and initialise the quest.
This solves a part of the problem by selectively working around it.
But in my opinion adding flags to a method so that callers can determine which methods it should or should not call is not a structural solution.

I see three concerns that are currently interwoven in classes and methods that do more than 1 thing:
1. Load: loading and parsing of quest sources
2. Initialize: creating and verifying the npcs, items, location, topics, etc that are needed by the quest
3. Start: run quest triggers and tasks until completion

Right now QuestListsManager.LoadQuest(QuestData, int) does 1 and part of 2.
QuestMachine.InstantiateQuest(Quest) does 3 and another part of 2
QuestMachine.InstantiateQuest(string, int) does all 3

For my Quest Editor I would also like to be able to instantiate a DaggerfallWorkshop.Game.Questing.Item without needing a global TalkManager instance :)

I think the QuestListManager should be able to create a list of available quests without anything being created in the other global game systems. This needs a better distinction between a Quest (parsed quest source) and a Quest instance (resources and id allocated).
Maybe create a new QuestSource class? These could be parsed from Template textfiles or any other format or system. QuestListManager can keep track of them and make lists and metadata available while QuestMachine can instantiate initialized Quest object instances from them.

Your thoughts?

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Quest system issues

Post by Nystul »

JorisVanEijden wrote: Sun Nov 10, 2019 6:27 am
Nystul wrote: Sat Nov 09, 2019 9:38 pm
JorisVanEijden wrote: Sat Nov 09, 2019 2:32 pm - move the creation of topics from the quest resources to the StartQuest method
not sure if I understand exactly what you mean.
What I mean is that parsing a quest should not do anything with the global TalkManager.
The messages from the quest resources should be added to the global TalkManager when the quest is started.
I think I understand now what you mean - yeah this sounds reasonable

User avatar
JorisVanEijden
Posts: 114
Joined: Mon Aug 12, 2019 5:02 pm

Re: Quest system issues

Post by JorisVanEijden »


Post Reply