Unreal Engine 5 NPC Dialogue Management System / by Nate Marler

I’m excited to announce a blog series of demonstrations and tutorials focused on Unreal Engine game design and audio implementation!

I like to think of myself as game developer who specializes in audio. I believe that learning as much as you can about every discipline of game design makes you a better sound designer. I’ve been building a first person project in Unreal Engine 5, and I am excited to start giving a small glimpse into some of the features and systems. There’s a lot to go over, so I am going to do some deeper dives slowly over time.

Recently, I spent some time experimenting with AI behavior trees and building a custom dialogue management blueprint that allows quick and easy set up of conversations with NPC’s, as well as an option to interact with an in game shop.

To start I built a friendly NPC AI. Depending on which booleans you enable, the unique instance of the NPC has 4 behavior tree modes:
- Wander within a set range
- See and follow the player
-Stop moving to talk to the player when within range
-“Chat” or allow the player to shop when the interact button is pressed.

Next, building upon my existing checkpoint and objective system I set up a conversation blueprint. If the conversation boolean is enabled on the NPC blueprint when the player enters the interaction collider volume and presses “Interact” the NPC blueprint will then check if the player is within the conversation manager volume and grab the corresponding array of dialogue lines.

Once the array of dialogue lines has reached its end, or the player walks away from the NPC’s interaction volume, the conversation widget closes, and the player regains full control of the first person character. If the “Gives Objective” boolean is checked on the NPC, the conversation blueprint also sets a new objective for the player at the end of the conversation.

If the “Is Merchant” boolean is checked on the NPC, the interact button will pull up a shop widget where the player can purchase a set array of items or upgrades.

You can also set the NPC’s name, which is then grabbed by the on screen widgets.

At the moment the game only uses temp test sounds, but over the weekend I was approved for a full WWise license for the project, which releases me from the pesky 200 sound limit.

This week I am going to add the ability to play a unique voice line that corresponds to the dialogue text.

If you made it this far, thanks so much for reading and I hope you enjoyed. Much more to come!