Quest Hub Forums

For all talk about quests. Creating, testing, bugs, and development progress.
Locked
User avatar
Interkarma
Posts: 2885
Joined: Sun Mar 22, 2015 1:51 am

Quest Hub Forums

Post by Interkarma » Sun Jun 11, 2017 11:12 pm

Quest Hub Forums

Welcome to the Quest Hub! This new forum is for all discussion around questing in Daggerfall Unity. Please use this forum to discuss writing quests, bugs in quest system or quest scripts, development progress, and so on.

Following is a primer on the quest system in Daggerfall Unity.


Scripting Quests

Daggerfall Unity has adopted Donald Tipton's scripting format created for the Template v1.11 quest decompiler/compiler. As Bethesda never released official quest editing tools, Template has become the de facto standard for creating quests in Daggerfall. Template's scripting language is plain-text and mostly easy to understand.

Click here to to download Template v1.11.
Click here to view the Template scripting language documentation online.

Some caveats on Template as a tool:
  • Template was created by a community member, it is not an official tool. As such it contains bugs and inaccuracies.
  • You will need to run Template in a 16-bit command line (so DOSBox, Win9x, or 32-bit versions of Windows XP/7/etc. which still have the 16-bit command shell available.
  • Template's documentation can be confusing sometimes. If you have a question about the scripting language, please create a thread and ask.
  • It is theoretically possible to compile the same quest script in both Daggerfall and Daggerfall Unity to compare behaviours. But this can be problematic as Template often cannot re-compile its own decompiled scripts. This means that patience and perseverance is a must for anyone testing script behaviours in classic Daggerfall.
Fortunately, you won't need to touch Template's command-line if you don't want to! All of the quests have already been decompiled for you and are available in source code and builds. But if you want to create new quests or help test questing in Daggerfall Unity, you will need to understand the scripting language from the documentation linked above.


Quest Scripts in Daggerfall Unity

You will find all of the quest scripts already decompiled in the Assets/StreamingAssets/Quests directory. These are just .txt files containing both the QRC and QBN parts of a quest. You can also view these online (ignore .meta files) or find them in the DaggerfallUnity_Data folder of your build.

There are several data tables which link reserved quest symbols back to classic Daggerfall. These can be found in Assets/StreamingAssets/Tables, your DaggerfallUnity_Data folder, or online.


Starting Quests

At this time, quests can be launched in one of three ways:

From the FIghters Guild
Visit any Fighters Guild across the Illiac Bay and speak to the usual quest giver. He will provide you with a random quest from a curated pool.
fighters-questor.jpg
fighters-questor.jpg (24.3 KiB) Viewed 1242 times
From the Unity Editor
If you're working with Daggerfall Unity's source project, you can set a quest to start automatically from the StartGameBehaviour component. You can even specify a save game to load so everything just starts up where you need it when you hit Play. In the example below, Daggerfall Unity will load game #24 and start quest S0000977.
start-game-quest.PNG
start-game-quest.PNG (16.5 KiB) Viewed 1429 times
From The Console
To start a quest inside a running game, open the console with ` (backquote key) and enter command "startquest questname". For example:
startquest-ingame.PNG
startquest-ingame.PNG (19.06 KiB) Viewed 1429 times

Quest System Progress

For a snapshot of quest system development progress, refer to the Quest System Status page.

This page will be updated over time as more actions and conditions are built. If an action or condition has not been started on this page, please do not expect it to work in Daggerfall Unity.

If an action or condition is marked as complete, and still does not function as expected, please create a thread to report this as a bug. At this time, use the Quest Hub to report bugs in quest system or scripts.

User avatar
Interkarma
Posts: 2885
Joined: Sun Mar 22, 2015 1:51 am

Re: Quest Hub Forums

Post by Interkarma » Sun Jun 11, 2017 11:43 pm

Quest Debugger

Note: At time of writing, this feature is only a few days old is very incomplete. It can still be a useful tool however. The quest debugger is currently only available from source and is always enabled right now. It will be available in a new test build soon.

The quest debugger is a HUD overlay showing real-time quest information while you play the game. Here's a screenshot of it in action with the _TUTOR__ tutorial quest.
quest-debugger-tutorquest.jpg
quest-debugger-tutorquest.jpg (144.37 KiB) Viewed 1425 times
The elements above are the QuestName, Status, Tasks, and Timers. Here's a summary for each element.


QuestName
The name of the quest you just launched. Note that Daggerfall can have multiple quests of the same name running at once. Internally, Daggerfall Unity stores quests by a unique ID, but this is not visible in the debugger overlay. A way to disambiguate same-name quests will be added in the future.


Status
This shows whether quest is running or complete. If a quest ends, the debugger will continue to show quest information so you can work out why it ended (if that was unexpected). However a quest will not update any further once finished.

Step-through execution is planned for this tool at a later date. While step-through debugging is enabled, the Status line will show the next line of quest source about to be executed.


Tasks
A quest Task is a block of operation containing one or more conditions or actions. A Task has a state of either set or unset. This can also mean true/false depending on the Task. An unset task is not executed by the quest machine (unless it has an enabling trigger condition).

Take the following bit of code as an example:

Code: Select all

_S.01_ task:
    daily from 05:00 to 19:00 
This task is called _S.01_ (which internally becomes Symbol "S.01"). Its only command is the "daily from" trigger condition which sets S.01 true when between 5am and 7pm and false all other times of day. Other tasks can then use S.01 in a conditional statement like so:

Code: Select all

_S.03_ task:
    when not _S.01_
    create foe _wraith_ every 21 minutes indefinitely with 50% success
This task will spawn enemy wraiths when not between 5am and 7pm. This example is culled from the quest which spawns ghosts and wraiths in Daggerfall at night. If you want to see the whole source, check out quest S0000977.

The quest debugger shows set/true tasks in green and unset/false tasks in gray.


Timers
Timers (Clocks) are declared by a quest and started when needed. Once started, a Timer will count down to 0 in game-time. This means time will not count down while game is paused or inactive. You can control speed of time passing using the "set_timescale" console command. When completed, a Timer will execute (set) a Task of the same name.

The Timer heading also shows the current world time. In the screenshot above it is 22:21 or 10:21pm. A timer is gray when not started, green once started, and red once complete.

At this time, the quest debugger only shows a single quest (whichever one was started first). It will be expanded over the coming weeks.

User avatar
Interkarma
Posts: 2885
Joined: Sun Mar 22, 2015 1:51 am

Re: Quest Hub Forums

Post by Interkarma » Mon Jun 12, 2017 12:12 am

Testing: "Quest Script" Or "Quest System"

When testing and debugging quests, it is necessary to think in terms of which system is operating to better identify bugs.

Errors in Quest Scripts will lead to failed compilation or incorrect execution of a script, just like in any programming language.

For example, a very common scripting error allows the player to end a Fighters Guild quest by clicking on the quest giver again immediately after accepting the quest. In affected quests, this will cause the quest to end early and player to receive a reward without doing anything.

The good news is that Daggerfall Unity is open source and the community can work through fixing quest scripts over time to remove all of these problems. But please don't start fixing scripts just yet, because the quest system itself is still being written.


Errors in the Quest System are different to logic problems in the script. If a script is perfect and something still goes wrong, it's very likely something in the quest machine itself needs to be fixed.

In order to execute these quest scripts in Daggerfall Unity, I need to fully implement more than just a compiler. The execution environment needs to be programmed with all conditions and actions, and they have to behave as closely to classic behaviour as possible. This process is still ongoing at this time, so exclusions and bugs are to be expected right now.

I'm still working through some of the subtleties of quest execution flow and how certain behaviours operate. If you do start testing quests ahead of where I'm up to, please just keep the following in mind:
  • Check the Quest System Status to see if a command has been implemented. If not, the quest will not operate as scripted, even if it appears to compile OK.
  • If you're testing a particular action against classic, please reduce to the smallest possible script to reproduce the expected behaviour. The same goes if you're reporting a bug - show me the fastest way possible to reproduce so I can fix it.
Overall, testers who take on the quest system will need to be comfortable with some programming concepts and have a good problem-solving mind. Questing is a challenging system not just from a development point of view, but for testers as well. Your help testing is extremely valuable however, and I appreciate the work of anyone who is able to take this on and contribute.

User avatar
Interkarma
Posts: 2885
Joined: Sun Mar 22, 2015 1:51 am

Re: Quest Hub Forums

Post by Interkarma » Mon Jun 12, 2017 1:16 am

Contributing

If you'd like to contribute to Daggerfall Unity's quest system, there are a few ways you can help.


Build A New Action

If you're an advanced developer and familiar with Daggerfall Unity's codebase, you might be able to help by creating a new action or condition for the quest system. If you decide to do this, please open a new thread in Quest Hub first so we don't have multiple people trying to work on the same thing. This also starts a dialog to discover any potential bottlenecks or problems ahead of time.

You can examine existing action code as a starting point. The JuggleAction serves as an example that was also covered in a blog post a while back. If you have any questions around how an action should work, please ask in the thread you create and I will try to help.

Aside from new actions/conditions - please do not send me PRs into the core quest system without discussing with me first. I'm still working through some things and have all the blocks stacked "just so". I also want to be responsible and involved with how all quest systems interface with game world. Pulling ahead of where I'm ready to be right now only creates more work for me. That's not to say I don't want help, just check with me first if it's something I'm ready for. :)


Test Actions/Conditions

If you'd like to test actions for accuracy, you will be able to do so from the next 0.4.25-based test build onwards (next test build release date to be announced). You will not need a copy of Unity, just a working build of Daggerfall Unity. You can create a new quest script and place it in the DaggerfallUnity_Data\StreamingAssets\Quests folder and launch from startquest console command at runtime (see posts above for more details on starting quests).

I recommend creating the most minimal quest possible to test expected behaviour. You can start with larger quests and strip them down to bare bones. Make sure the behaviour you're testing has actually been implemented by looking at the Quest System Status page.

If you discover a problem, please start a new thread with the repro script and an outline of unexpected behaviour. You can also email me this to me if you don't want a forum account. I prefer on the forums however, it keeps all the information together.


Test Main Quest Execution

If you aren't comfortable with programming or scripting at all, that's still OK! Sometime in the near future it will be possible to start playing through the main quest in Daggerfall Unity. This will align with the next stable build release candidate (hopefully) sometime this year.

I'll write up a more detailed outline for gameplay testers once the code hits this state. Thank you for your patience. :)

Locked