YouTube SummarySee all summaries
Watch on YouTube
Publisher thumbnail
The Game Dev Cave
15:4611/25/24
Software Dev

6 Remembering Dialogue options

11/25/24
Summaries by topic
English

This podcast details how to implement a dialogue system with memory functionality in a game using Unreal Engine's Behavior Tree and Dialogue systems. The process involves creating variables and structures to store choices, looping through choices to remember, and then utilizing a selector node to load saved choices into the Behavior Tree, ensuring character dialogue progresses based on previous player interactions.

Choice Memory Variable

00:01:27 A new integer map variable called 'Choice Memory' is created to store the choices made by the player in the dialogue system. This map uses integer keys corresponding to choices (e.g., Choice 1, Choice 2) and integer values representing the choice's result. This structure allows the dialogue to remember and react to past player decisions.

Blackboard Key Selector

00:03:29 A 'Blackboard Key Selector' array called 'choices to remember' is introduced to control which choices should be saved and loaded. This feature provides flexibility, allowing developers to selectively remember specific choices or skip certain ones depending on the gameplay context and scenario.

Struct for Blackboard Key with Index

00:04:54 A custom struct called 'Blackboard Key with Index' is made to enhance the functionality of the 'Blackboard Key Selector' array. This struct combines a 'Blackboard Key Selector' with an integer 'Choice Index', allowing developers to specify which key corresponds to a specific choice. This approach simplifies the management of choices during the save and load process.

Remember Choices Task

00:07:51 A custom Behavior Tree task named 'Remember Choices' is created to load the saved choice data from the 'Choice Memory' map. This task fetches saved choices from the map using the index specified in the 'Blackboard Key with Index' struct and sets their values in the Blackboard, enabling the Behavior Tree to continue the dialogue based on the saved choices.

Selector Node to Load Saved Choices

00:07:25 A selector node is implemented in the Behavior Tree to manage the initial load of saved choices. It includes the 'Remember Choices' task which executes only once at the beginning of the Behavior Tree and sets a 'remembered keys' Blackboard key to true to prevent repeated execution. This structure ensures that the saved choices are loaded only when the Behavior Tree begins.