The DRS system is a tool that taps into all other systems to allow the developer to nest complex dialogue and story within their games in an interface that consolidates all the connected data. You can pass events externally, or even nest the dialogue directly inside of the DRS tool itself, and see the execution order of your events in real-time.
The Dynamic Response System is explained in the written tutorial below, and also in the video master class embedded here. It covers how to execute various events through dialog and overall gameplay.
In this tutorial, you will learn to set up a simple scenario and to use the basic Dynamic Response System (DRS) functions.
We are going to set up a small scene where a Non-Player Character (NPC) comments on the action of a player triggered by pressing a key on the keyboard. This will send a DRS signal via a simple Flow Graph script.
We will add a Response to a signal in the DRS widget and then add a SpeakLine action to this Response so that we can actually get a dialog feedback. After completing these steps, you will iterate on the scenario by adding a Condition to the Response and debugging your data.
Please note that in this section, the GameSDK Sample Project is used. The assets in this Tutorial can be accessed only if it is downloaded. Please visit the Asset Database to download the GameSDK project.
After this step, whenever the designated key (g) is pressed, a signal will be sent to the NPC. However, you won’t get any response from the entity since no Response has been linked to the signal yet.
For linking a Response to a signal, please go through the next step.
You can create a new Response by executing either one of the following methods:
The DRS tool combines multiple functionalities, such as:
The DRS workflow requires the user to utilize different options on the main tabs of the tool to modify the various aspects of a dialog flow.
The Responses tab should be used to create Responses to a given signal.
The Responses panel can be accessed by clicking the respective tab on the bottom-left corner of the panel:
You can view the recent signals by selecting the Recent button on the top-left corner of the Signals panel. It reveals the list of all signals sent by the game so far.
The association between a signal and a Response is done only through the filename, meaning a Response that is saved in the file sg_button_pressed.response is linked to the signal sg_button_pressed. Renaming the file would associate it with another signal.
New Responses will be saved in YOUR_PROJECT_FOLDER\Assets\libs\DynamicResponseSystem\Responses. If it's not available already, you need to create a project folder to save your responses. Within this folder, you can create sub-folders and move your .response files into them to keep the responses sorted. Make sure you do not end up with multiple response files for the same signal name.
Click on the signal that you want to create a respond for; in our test-scenario, this would be sg_button_pressed. Then click on the Create response for signal button. This will create a new Response which is associated with this signal.
Alternatively, you can create a new Response file in the Files tab by typing its name into the name field and clicking the Create new button next to it.
Switch to the Files tab to see the newly created Response file sg_button_pressed.response. Don't forget to save the file by right clicking the Response and clicking Save.
With the current setup, the Response should have already been executed for each time the sg_button_pressed signal is sent by the game. But the response currently does nothing, so you won’t be able to notice it. Executing a response usually comprises of three functions that are outlined below:
For adding an Action to a Response, please continue to the following step.
This step explains the process of adding an Action to a DRS Response.
Now that an Action is assigned to the Response, you can add a Condition as mentioned in the next step.
In this step, you will learn about adding a Condition to a Response and modifying it.
As you can see in the image, the SpeakLine action was only executed the second time the Response was triggered. This is because when the assigned key was pressed for the first time, the Random condition was not met due to the 50 Probability value.
After adding a Condition and an Action to the Response, you can now follow the steps explained in the next section to learn how to add a dialog line to the Response.
This tutorial explains how to add a dialog line to the Dialog Line database.
As mentioned in Step 3, a warning appears when the assigned key is pressed. This is because the line that you are referring to in the SpeakLine action is not available in the Dialog Line Database yet. Instead of specifying all properties that are needed for the text line in the SpeakLine action, you can just use the line ID in the Dialog Line Database. The database then holds all information for that line such as subtitles, audio assets, and animations. This is particularly helpful when grouping the actual data together, instead of splitting it into several Actions. It also helps later on with localization.
A single line can have multiple variations, which means even if you execute the same SpeakLine action twice, the actual line that is spoken can be different. This is a fast way to add variations on a line. For example, you can simply add three variations, by right-clicking the line and selecting the Add line variation option. Note that the first variation is already stored within line, so you need to add two more.
There are different properties that you can define for each line. For now, just add the text you want to display in the column Subtitle.
Before you can test your new setup, double check if the SpeakLine action in the Response is actually linked to the newly created line.