Skip to end of metadata
Go to start of metadata


In this tutorial, you will learn to set up a simple scenario and to use the basic Dynamic Response System (DRS) functions.

You are going to set up a small scene where a Non-Player Character (NPC) comments on the action of a player by pressing a button on the keyboard. This will send a DRS signal from Flow Graph.

To do so, you can add a response to this signal in the DRS widget and then add a SpeakLine action to this response so that you 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 Marketplace to download the GameSDK project.

Step 1: Sending a DRS Signal From Flow Graph

The Dynamic Response System is event driven, therefore it only reacts to signals that are sent to the system. In this example, the signal is sent from Flow Graph, but it could also come from code, script or any other part of the game logic. For more information about Flow Graph and it's functions, please refer to the Flow Graph section.
  1. Create an empty level by selecting File → New and name it, for instance, DRS_tutorial.
  2. Next, add an NPC by selecting Legacy Entity → AI → Characters → Human.

  3. To avoid the Character shooting at you, change the Faction Setting to Civilian.
  4. Create a new Flow Graph for this entity by right-clicking on it and selecting Create Flow Graph.
  5. Name the Flow Graph, e.g. DRS.
    As a starting point for your Flow Graph logic, add a Debug:InputKey node by right-clicking an empty space and choosing Add Node → Debug → InputKey, or by pressing Q and typing its name on the search field.
    This node creates an output when you press a specific key on the keyboard or a button on the Controller.
  6. Assign a key or button to the node; e.g. g.
  7. Add a DynamicResponse:SendSignal node to the Flow Graph which will be used to send a signal.
  8. Set previously added NPC which should receive the signal by right-clicking the Choose Entity field and selecting Assign SelectedEntityalternatively, you can choose Assign Graph Entity without selecting the entity itself as the current graph is already attached to the NPC entity.
  9. Define a specific name for the signal by typing it in the Signal Name field; e.g. sg_button_pressed.
  10. To complete the setup, connect the Pressed output of the Debug:InputKey node to the Send input of the DynamicRespone:SendSignal node.

After this step, whenever the designated key (g) is pressed, the signal will be sent to the NPC. However, you won’t get any response from the entity since no response has been linked to this signal yet.

For linking a signal with a response, please go through the next step.

Step 2: Creating a Response

You can create a new Response by executing either one of the following methods:

  • Create a new response and manually specify the signal that it should be linked to.
    This approach is useful when you are prototyping responses for signals which are not actually in the game yet.
  • Check the list of signals that are recently sent by the game, then add a new response to one of these signals.
    This approach is usually the preferred workflow as the game sends the variables and signals to the DRS, letting the narrative designers to pick these up to create interesting responses easily.

Initial Steps

The DRS tool combines multiple functionalities, such as:

  • Displaying the current state of DRS variables.
  • Displaying all available dialog lines.
  • Displaying Debug functionality.

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 via 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 Signal panel. When this tab is activated, it reveals a list of all signals sent by the game so far.

If this list is empty, make sure the game is running and you pressed the key that you specified in Flow Graph at least a couple of times. The list is not updated automatically, so you need to press the Update button at the bottom left of the window. If your signal does not show up in the list, check the initial Flow Graph setup and use the debug functionality to see if the DynamicResponse:SendSignal node is executed correctly.

The association between signal and response is done only through the filename, so a response saved in the file sg_button_pressed.response is linked to the signal sg_button_pressed, so renaming the file would associate it with another signal. 

New responses will be saved into YOUR_PROJECT_FOLDER\Assets\libs\DynamicResponseSystem\Responses. If not already created, 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 them sorted. Make sure you do not end up with multiple response-files for the same signal name.

Creating a Response

  1. Click on the signal that you want to respond; in your 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.

  2. Switch to the Files tab to see the newly created response file sg_button_pressed.responseDon't forget to save the file by right clicking the response and clicking Save.

    In order for a response to be deleted, it must be saved first.
  3. 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:

  • Checking all the conditions (If there are any assigned to the response).
  • Executing all actions (Only if the conditions were met and if there are any actions assigned to the response).
  • Executing the best follow-up response (if there is one, when all the actions are completed).

For adding an action to a response, please continue to Step Three.

Step 3: Adding an Action to a Response

This step explains the process of adding an action to a DRS response.

  1. You can add an action by selecting Add from the Actions dropdown list. By default, this will create a SpeakLine action with li_sg_button_pressed written in the Line field. This indicates that it is a line associated with the sg_button_pressed signal.

  2. After you add the response to the signal, you can also edit the text that you want to display by editing the Line field under Actions menu.
    The SpeakLine action has the following properties:
    Line: Specifies the LineId that should be spoken. in fact, this refers to a line from the dialog line database; but for now, leave the text as it is or simply type the text that you want to display.
    SpeakOverride: Specifies the actor who should say this line. If you don't specify anything here, it will be the current actor; which, in this case, is the entity that was attached to the Flow Graph setting.
  3. Now, in game mode, you can test the setup by pressing the specified key (g):
You can ignore the Missing part in front of the text for now. It appears to notify the user that a dialog line that is not specified in the dialog line database is being used. This can be fixed later in this tutorial.
If the outcome of this setting looks different to this, it might be useful to open the DRS widget again and take a look on the right side of the Response tab. This window displays the execution history for the currently selected signal(s). It displays when the signal was executed, conditions that were checked, the outcome for the conditions (true/false) and the actions that were executed. For more information about this widget, please see the Execution Info section.

Now that an action is assigned to the Response, you can add a condition as mentioned in the next step.

Step 4: Adding a Condition to a Response

In this step, you will learn about adding a condition to a response and modifying it.

  1.  First, add a Condition to a Response by choosing either Insert or Add from the Conditions context menu; 
    For example, the Random condition can be used to define the execution frequency by setting the Probability value:

    This property defines the chances of the condition to be met. When you set this value to 50, the condition will only be met half the time, which results in the SpeakLine action to be called with a 50% chance when the specified key is pressed and the signal has been sent. This is a good example to demonstrate how conditions influence the outcome of a response.
  2. When you press g to send the signal a couple of times, the signal history should look as follows:

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.

Step 5: Adding a Dialog Line 

This tutorial explains how to add a dialog line to the Dialog Line database.

As mentioned in Step 3, a warning that states the dialog line you are trying to use in the SpeakLine action does not exist in the database 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 LineID 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. 

  1. In order to add a new line to the database, you need to select the Dialog Line Database tab in the Dynamic Response System widget and right-click on the empty space and select Insert Line to create a new line. The ID of the new line needs to be the same as the one that you indicated in the SpeakLine action and it needs to be a unique line; e.g. li_my_test_line.

  2. 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 select Add line variation option. Note that the first variation is already stored in the 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 

    You can archive the same result by splitting the different variations into different lines, and do the randomization on the response; this is just an optimization in the workflow.

    Before you can test your new setup, you please double check the SpeakLine action in the response, is actually referencing our newly created line.

  3. If you now test the setup in the game, you should get an output like this:

    Since the variation is picked at random, it might be a different line for you.
  4. You can now start playing around with these tools. You can add a talk animation to your lines or add an audio trigger, provided that these files are available in the current project:

On This Page