AI behaviors for a story ?

How would one go about creating behaviors for a story?
let’s assume we have these:

(1) player needs to follow an npc (the npc will lead to a specific position and also say some things on the way)
(2) Player will fight together with npc
(3) Said npc will sit and wait until player finish quest A

and around 20 more.

How would one implement such a thing?

My initial thought is to create multiple behavior trees, one for each scenario. Each behavior tree needs a blackboard and a controller though, so it’s kind of a lot. I think?

Any better options?

I think you can use a single BT and switch using boolean or integer (per quest), for example if the integer is set to 1 then the NPC will walk and talk, when the NPC reach the location you switch the int to 2 and the NPC will start to fight, and so on.

in this way you need 1 BT for character/quest.

Another possible solution is to separate the logic, you can create a default combat BT for all the NPC, and also a default one for sit and wait logic, and a default one for the walking and talking, then you can expose the variable and customize it for the various quest (if they are similar), in this way you only have 3 customizable BT / BB and you only need to change the movement destination and the enemy target without need to create 20 BT.

If the quest are very similar each other i’m sure that build a system like this will save you a lot of time and work later.

But maybe there is a better method, this is just my 2 cent.

kalaus - thanks for your idea!

It sounds like a good idea, I’m still hoping for a better idea though;

Waiting to here more ideas :slight_smile:

I was thinking about making quest system, and my idea is to use attachable actors (or components for it) that are invisible to player (as human playing game).
When Hero gets quest, it will spawn component on his character blueprint, this component will keep sate of progress in quest.
Then it is simple matter of checking if player has some item in inventory. Or dialog produced some outcome.

Now about part of quest system that your idea is about.
This is great talk on the topic: AI-driven Dynamic Dialog through Fuzzy Pattern Matching - YouTube

Some things to consider:
If your goal is to make trully RPG game than you will have thousands of lines of dialogs. At some point you may want to localize it to another language. For those dialogs you probably need a writer or two, those people will faint when you tell them to create behavior tree. Bts are quite counter intuitive at first, you need to learn how to think with them to make any real results. So you should make system that is usable by non programmers. But all that is explained in speech. However for prototyping BTs look like fastest way to create single quest.

Nawrot - It sounds like a good idea, but I don’t really see how it’s connected to the question…
It sounds like you’re talking about a quest system with missions and dialogs; I was talking more about the behavior, and of the NPCs rather than the player.

Although I’m probably missing something or just didn’t understood you correctly, if you could explain again/more?

There is part of speech with those 2 robots game, i think you want something like this.

You want about 30 different behaviors. (that “and about 20 more”)

I would make each separate behavior into separate tree. Then use some plain blueprint to decide which tree needs to be used.
Or idea from that speech that decides what to do, then simple tree to execute task.

But if you are creating some serious RPG game, think from beginning about how you will maintain that code 2-3 years from now. Will you remember how each part ot Btree works? That is reason i suggest “wasting” a bit of time and coding proper system for quests and ai. Something with json or other text files. Something that you can modify without changing code and remembering which variable does what.