Quickly translated first 10 minutes of the interview:
0:33 Hi Tomas, please introduce yourself.
I am the lead of AI development at Warhorse Studios, among other things.
I came from MatFyz, the Charles University.
Our development of AI at Warhorse started as a cooperation with MatFyz college.
Now I work here full time and I am using this experience for my ??dissertation work.??
We publish some scientific articles, we are trying to solve these problems on a scientific level,
and to pass our experience to scientific community.
I am trying to get Ph.D. out of this.
1:30 Now, about the game, what is the scope of AI?
AI in games is a big topic.
For us it is many things. One is ambient AI, which includes all of those NPC inhabitants,
giving the player an illusion of a living world.
Also it is a low-level AI which takes care for path-finding etc.
Than we have a combat AI which specificaly solves its own situations.
Basically everything that moves, except trees and grass, has some kind of AI. Like quests etc.
2:25 What kind of intelligence would a quests have? I thought it is scripted.
Well, for the most parts, a script is the AI. A scripter writes instructions for the AI system to know what to happen.
Quests are devided to many other quests and they provide some more scripts to the world.
So a quest functions as another entity in this AI web which somehow interact among themselves.
But it is an entity which has some decision mechanism on its own. That is why it is part of AI system in the game.
**3:05 I have seen an picture of your AI editor. It consisted of a little boxes forming a branching tree. **
Is this how you solve everything or is there more to it?
For the ambient ??? …with all those NPCs that we want to control, we use the behavioral tree for decision making.
That is the concept we use. It is basically a general programming language for scripters.
We were considering using ???LUA Launguage??? But decided for behavioral trees.
And we have added ???tree unwrapping?? functionality to it.
Which means that the AI entities receive chungs of code (a script) from the world as they go along.
That is how these entites know what to do and how.
So with adding a new AI entity to the world (e.g. Quest) we also add a new logics to the whole AI system.
You could imagine a program which grows and vanish with kind of the life that NPC lives.
So a scripter writes a quest logics and the NPC may say that it wants to be part of a quest.
That would cause that the code of this NPC receive a new chunk of the code/logics from the quest.
So the NPC receives the knowledge of the world as it needs and that is how it knows what to do.
Maybe a butcher is supposed to commit a crime:
An NPC is given this crime behavior from the quest entity. And incorporates this role to its brain (tree).
5:30 Could you describe how this works in detail? Technically speaking, 1000 NPCs means 1000 of threads? And they all communicate? That sounds naive.
I have some background with operating systems at school.
It is all based on an Idea of one OS running a bunch of NPCs, which are processes.
They are separated. They contain some data and are interacting with the world, as I said before. And It has its own program.
For example it comes to an area. It could ask this location: I want to know how to do the cleaning.
What happens is that the world hieracticaly/topologically looks for the peace of the code for cleaning (or until it fails).
The NPC than copy this code (to its tree) and start to execute it.
So this is how it works.
Wheather it is Smart Object or ???SmartTary???, everyting smart is supplier of AI logics that NPC can get.
7:10 So it becomes a waterfall and learn to flow.
Well, sort of…
In order for NPCs to know what is going on in the world, there is some kind of high level World View with all information.
We have based this on ??connectivists theory?? where between some entities a relationships exists.
Just like I have a releationships with my wife, daughter, work or a place. And this relationships holds some data.
I could have 10 jobs and my willingness to do something has some value from 1-10.
Technically, the NPC has such relationship links all around the world and it can ask logical queries.
Like: I want some work which both I and my friend likes.
It receives some data where to go and what it’s possible to do there.
When it arrives it could ask again for some work that it likes, but something nearby.
Finally it asks that place for the particular ‘behavior’ / peace of logic called the work.
Our entities trusts the system.
In our world everybody is honest and do what they like.
9:05 So there is some graph database under the hood?
In fact, yes. There is ??relation?? database. We made our query language, which looks for logical paths in this graph database.
So NPC can make queries like: I am looking for closest family member which has a sword in inventory and is a brother of another NPC.
And lives in the village.
So this way our scripters make such logical queries (for quests).
9:55 What if there is an NPC which likes to murder others? Would not something like this interrupt other routines and break the system?
In the AI system, we also have interruption events.
And there are different mechanisms how NPCs can communicate with an environment or each other.
There are synchronisation mechanisms and I have talked about messages already…
At the same time NPC can observe - it has some perception.
So when NPC see a dead body, it can choose to react either from the pool (??battery??) of known scripts - it may run away somewhere.
Or it can react contectually based on the location too. Nobody cares about a corpse in battle.
But when this happen in a town, NPC would report the crime to a particular person.
Again, the NPC knows to whom to report because of the message from the area.
Even the query to relationship database can NPC request as behavior.
It can say: I want to react to a crime / murder.
And the location would say: For a crime you have to make such query and than you request next behavior.
So as you have seen on the picture the tree is growing.
It is ??recurive??, meaning the NPC can ask another query based on the previous logic.
11:50 OK. But does it solve the last impulse with the highest priority? Can some new impulse break the system?
For example: I saw a corpse, so I am running away. But than someone else attacks me on the run.
Do I still finish the script and report the murder, or do I react to this attack?
This really depends on scripter. He has some tools to keep this in NPCs memory for later.
The NPC can have links to itself.
It is also important to say that each NPC has sort of a high level plan which reflects what this NPC likes doing.
(Its preffered daily routines).
But it can add to this system, when It wants to do some another thing in the future and with what priority (We call it patches).