Page 1 of 2

Quest Debugging

Posted: Tue Aug 27, 2019 7:33 am
by JorisVanEijden
I'm working on a tool to aid in quest debugging.

The dftemplate quest format that DFU uses comes from QBN & QRC files decompiled by Donald Tipton's template engine.
This decompiler left out all the data of which the purpose was not known at the time, and got the purpose of some of the data wrong. This causes some confusion and makes fixing quests in DFU involve some guesswork.

My tool uses the information from ... _QBN_Files to dig out every last byte from the daggerfall QBN files.

This still leaves some data unknown though. I'd like to try to figure out some more. For this I need to be able to load quests in Daggerfall Classic at will and preferably dig into some npc info with a console or debugger.

What kind of tools are available for this purpose? How do I use them?
How for example do I start quest R0C10Y00 to verify some npc factions without having to play through the game?

*edit: fixed hacking-guide link to jump to the relevant portion

Re: Quest Debugging

Posted: Tue Aug 27, 2019 7:49 am
by Nystul
Kender wrote: Tue Aug 27, 2019 7:33 am My tool uses the information from to dig out every last byte from the daggerfall QBN files.
One note: while developing DFU I think we identified some of the info there as partly incorrect or wrong, e.g.:
%hnt macro is not as claimed there "Direction of location." instead it is just a hint (a references to a text record with a specific id) depending on the context of use of %hnt

Re: Quest Debugging

Posted: Tue Aug 27, 2019 8:05 am
by JorisVanEijden
I'm only using the info that DFU does not use, that is the QBN files.
I try to stay as close to DFU as possible with item, faction, etc lists.

The quests have been translated from QBN to TEMPLATE to DFU and each translation step has misunderstandings and mistakes.
A better understanding of the original QBN format and easy access to the data that TEMPLATE left out can help identify and resolve these.

Re: Quest Debugging

Posted: Tue Aug 27, 2019 10:25 pm
by Interkarma
Welcome to the forums. It's always good to have another data adventurer in our midst. :)

A quick primer for quest debugging is below. I recommend you also grab TheLacus' Visual Studio Code template to help write custom quests for isolated testing. You can start and stop quests while the game is running.

LeftShift+Tab - Cycles quest deugger display state.

[ and ] - Cycle through active quests.

` (backquote/tilde) - Opens console.

enddebugquest - Tombstones the quest currently selected in debugger.

endquest [UID] - Tombstones quest of specific ID.

startquest [filename] - Starts quest of filename in StreamingAssets/Quests. If the quest requires a questor, click on an NPC before starting quest and they will be used as the active questor.

purgeallquests - Dumps everything running on the quest machine.

Something to keep in mind is that Daggerfall Unity is a superset of classic Daggerfall. I see the classic quest system and its quests as a legacy baseline only. I am just as happy for quest issues to be solved by re-scripting as I am incremental fixes to the action behaviour.

Classic quests are also famously buggy in and of themselves. I don't in any way see them as a pristine baseline worthy of being tied down to. We have fixed hundreds of issues present in classic quests that are no longer present in DFU, and expanded the quest system capabilities far beyond what classic was remotely capable of. I place far more value in what happens in DFU in the future than trying to perfectly emulate decades-old bytecode. To put it another way - classic quests have to come forwards into a new framework, not the another way around.

I only mention this so it's clear what my goals are, and you don't spend time on changes that will be at odds with those goals. But I do welcome any help and clarity to improve action emulation that isn't heading towards a refactor of the quest system. A good example is this recent PR (are you JorisVanEijden on git?). Information like that is perfect and helps improve understanding. If that's the kind of thing you're about here, then bring it on. :)

Re: Quest Debugging

Posted: Wed Aug 28, 2019 5:28 pm
by JorisVanEijden
Yes, I'm Joris. I'll synchronise my github, discord and forum accounts to avoid confusion.

I completely understand your position and agree with it. I never intended to change the way DFU quest engine works. That would not be a productive time expenditure.

When I started debugging quests I could not understand or follow the TEMPLATE syntax and what it was supposed to do (still find it hard to read, even after going through the entire documentation).
So since I could not understand what the quest was supposed to do I could not figure out if there was a bug in DFU or in a quest or "as intended".
I then went to the classic bytecode, found it easier to follow and got hooked on decompiling it.
Now I find it very useful in assisting me in figuring out bug reports for quests. Not for making DFU replicating classic 100%.

For debugging I was asking about daggerfall classic. I was looking at this bug report for S0000501.
and think I've figured out the issue and a solution, but I'd like to verify if the quest does indeed reward you with a random item with shocking enchantment ("%it of shocking" according to my tool's decompilation of S0000501)
But I have no way to easily get this quest and play through it in classic :(

Re: Quest Debugging

Posted: Wed Aug 28, 2019 5:49 pm
by Jay_H
Your help is extremely welcome :) I was quick to misinterpret "new debugger" as "start from scratch" so I'm glad we're all on the same page now, in spite of my error.

I'll see if I can trigger the Lord K'avar quest. It's not hard to get in classic, it's just... mind-draining. One of my first requests for DFU was to disable it permanently :lol: Then we'll see if the item is Shocking.

Re: Quest Debugging

Posted: Wed Aug 28, 2019 7:07 pm
by Jay_H
No go. I just got an Unrestrainable Common Symbol, for Free Action.

Re: Quest Debugging

Posted: Fri Aug 30, 2019 5:50 pm
by JorisVanEijden
Thanks for checking Jay.
That gave me a different idea, which would have involved you checking if S0000502 rewarded you with a something "of Force Bolts".
Fortunately for you I managed to edit the _TUTOR__ quest to give me the item in question ;)

Which allowed me to verify that these are the subclasses of the magic items (class 4):

Code: Select all

 0 "Silent %it",
 1 "%it of the Wise",
 2 "%it of Wildfire",
 3 "%it of Force Bolts",
 4 "Shining %it",
 5 "%it of the Sealed Door",
 6 "%it of Undeniable Access",
 7 "%it of Venom Antidote",
 8 "%it of Life Stealing",
 9 "%it of Wizard's Fire",
10 "Leaping %it",
11 "%it of Water-walking",
12 "%it of Magicka",
13 "Never Tiring %it",
14 "%it of Featherweight",
15 "%it, the Protector",
16 "%it of Shocking",
17 "Cursing %it",
18 "%it of Far Silence",
19 "%it of Venom Spitting",
20 "Blazing %it of Fireballs",
21 "Frosty %it of Ice Storms",
22 "%it of Lightning",
23 "Deadman's %it",
24 "Healing %it",
25 "%it of the Orc Lord",
26 "Unrestrainable %it",
27 "%it of Iron Will",
28 "%it of Nimbleness",
29 "Torgo's %it",
30 "%it of Fortitude",
31 "%it of Friendship",
32 "%it of Good Luck",
33 "%it of Oblivion",
34 "%it of Toxic Clouds",
35 "%it of Paralysis",
Still need to figure out the "%it" part. It looks like a random item, but from which list?

Re: Quest Debugging

Posted: Fri Aug 30, 2019 6:04 pm
by Jay_H
Lines up perfectly. Looking great :)

Re: Quest Debugging

Posted: Sat Aug 31, 2019 7:16 am
by JorisVanEijden