[FINISHED] DOT Fuzzy Logic AI Engine Pre-Alpha (Open Source)

Oh, yeah bulldozer haha. I misspoke. And we fixed the issue, turns out the Bulldozer CPUs had a bit of a caching issue (Driver side. We already reported the bug to AMD). The work around wasn’t very hard.

And yeah going open source wasn’t a hard decision :stuck_out_tongue: We needed more programmers than we scavenge to work on this. its a lot easier when they find you.

I posted this on reddit, might as well share it here as well:
In other news the next version of DOT is already deep in development :smiley: Thanks to solely r/gamedev, our development team has grown from 2 volunteer programmers to 6 within a week, all actively contributing.

We’re picking up a LOT of speed. The amount of work that I thought would take a month was completed in a single week, and we’re at the point where we’re adding more features left and right. (ie: NPCs have fully fledged memories now, we’ve start on a REST interface for multiplayer games, we’re improving our knowledge based inference engine tremendously)

That is great news!

Congrats on the increased speed and momentum for DOT. :smiley:

Cannot wait to use this :slight_smile:

I have few comments about plugin.

Entity, should not be based on ACharacter. You are creating something that is hard to extend and implement in other game projects. Instead it should be ActorComponent, which can be easily attached to any actor.
As we are on it, Character or Pawn is not good place to place any kind of AI related stuff to begin with. At best it should derive from AIController, but Component based approach would still be best.

The same goes for DOTWorld it also can be ActorComponent, which then in turn can be added to GameMode, or other actor.

I’m not sure what Advertisment is supposed to do, so I can’t comment what it should be.

tl;dr version. Inheritance is way overrated. Especially in game development, where various classes needs somehow similar but different functionality, and you end up with inheritance tree, that start to look more like circles (;.

I could refactor code probably somewhere around weekend, if you guys don’t get it before then and if you want those changes.

Other than that, it’s really awesome work. Emergent AI system is just must have for any open world RPG,

And yeah if you could do that it’d be awesome. I’ll go into more detail later over what advertisements are (it’s not very clean cut)

I did a really good job on reddit describing what the final version of DOT is going to be able to do as well as a lot of the challenges its facing. Pasting it here now:

We actually haven’t had a chance to get our technical writter to work on a full fleded document of everything it does.
If you want a TL;DR (Because I can go on for hours) the alpha is going to basically be like a dungeon master for an RPG game. You give it a list of your main characters, and their attributes, as well as a few key conflicts that happen in their plotline, and DOT files in the blanks and lets you play through the story it generates.

So I may create 5 main characters and say that one kills the king, DOT will work out everything that will hapen up until that point and then just let an AI simulation run after the plot point has been hit.
All that the prealpha version does is simulate what happens after your story is over. The alpha version can do simple conflicting plot lines (Two people want to be kings) and the beta version will be able to do extremely complicated conflicting plotlines (An entire army is invading a city while 5 factions fight over who wants to be king).
Think of it as a novel writing AI if you want :stuck_out_tongue:
We actually have a very clear idea of how to implement this :smiley:

A full document about 20 pages long should be ready sometime by the end of this month

It doesn’t connect up plot points before hand. It does emergent AI simulations while the player is exploring the world for the story. So it will simulate AI interactions in the background and how their actions eventually propagate to the player.

Problems with DOT

It works really well for open world games where they have like 50 hours of play time and can have DOT running on a background thread.

Since DOT is being designed for single player games primarily, we have the ability to drop LODs when the player isn’t near a certain area. And for scenarios where it isn’t just single player can offload computations to other players connected. While AAA games could do this, it would be looked down upon. Indie studios like our
own have an easier time getting away with this :stuck_out_tongue:

Stuff like this hasn’t really been done client side, as these are more MMO -esk AIs. These type of systems are use to large amounts of RAM and lots of CPU cores.

There are of course faults in this, as the player can continuously pull the game away from its storyline, and there really isn’t much you can do to bring them back without it feeling horribly artificial. Since LODs are dropping, NPCs that weren’t meant to die can be killed off. This can cause weird plotholes occasionally, but if you’re in a world with 50K NPCs, its usually hard to notice this (I should add that we really only have to recalculate an NPC every 10 minutes or so, since advertisements like “Go to work” would take about that length). And of course, since computation is distributed among players, you can either have a single small server act as the central copy for everyone (But doesn’t do any computation itself) or you can run into the issues of doing p2p networking. Once again, this is usually isn’t as looked down upon when the studio is indie.

We haven’t figured out a way to prebake this from start to finish without just having players run through it and record the world’s AI interactions.

How some of it works

It isn’t mad-libs based. So if I create a plotpoint that says the king will always die, it won’t be a mad-libs where I just fill in the name for who kills the king. Its more of an NPC is created that is motivated to kill the king, and if the plot point fails (ie: The NPC gets killed), then the story digresses until the king gets killed.

Imagine a case like this:
An NPC is motivated to kill the king -> He dies along the way -> The king hears of his failed assassination attempt, and increases security -> The local inhabitants are angered by the excessive security and begin to rebel against the King -> The locals now have the motivation to kill the king.

This also does not manage pathfinding what so ever. Managing pathfinding would be far too much, as its more of a per game basis. Some games need flying NPCs while others don’t. It would make things too chaotic.

Performance

In tests this works. We haven’t done anything large scale yet, and we’ve only tested very linear plot lines. Its also insanely CPU expensive, but as I mentioned before we have VERY large time period to spread these computations over. We try to use every piece of hardware available to the player to help with this blunt though. We’re using their APU, their second GPU if they have SLI/Crossfire (Since more deferred rendering engines can’t utilize a second GPU anyway [And deferred rendering seems to be really popular right now]). We’re even working on a basic clustering API so the player can offload these computations to other nearby processor (We did some tests with the player offloading some basic NPC calculations to their Galaxy S5. It worked really well :D).

A high end computer has no issue running this SDK. The X99 processor we did some earlier testing on had zero problems peaking at 500K scores / second (Which would roughly equate to creating a few hours of plotlines for a city with the population size of Seattle in 30 seconds). What I’m mostly worried about are computers with less than 6 cores, since the performance increase with DOT from 5 cores to 6 cores is monumental. And since we have a game powered by DOT coming out sometime this spring (Or summer if it gets delayed. It may if we make some really cool features for DOT), I imagine most computers will sill be at 4 cores by then.

Of course since this is the version thats currently available for download, the Plan class and structure are not available; however, these create minimal overhead and actually greatly reduce the computational length of the calculations required since

A) It only computers nearest neighbour once per entity rather than once per entity per update

B) It does not immediately account for the negative aspects of an advertisement since we can assume that the NPC in most cases will be overwhelmed by passion rather than reason (Creates for some great drama in games :D)

B) Rather than calculating the definite integral over the two sigmoids like whats shown in the version that’s available, it computers a linearization and weighs the output score based off of its opinion about that advertisement. This is a LOT faster and its about 1/16th the CPU cycles per score. :smiley:

In case you want some numbers: (Note that these numbers were calculated with the version that’s available for download right now. We pulled out multithreading since we couldn’t decide if we wanted to use boost or STL at the time. We’ve decided on boost since then.)

1 core reached 40K scores per second

2 cores reached 70K scores per second

3 cores reached 100K scores per second

4 cores reached 200K scores per second

6 cores reached 300K scores per second

6 cores reached 500K scores per second

7 cores reached 600K scores per second

8 cores didn’t want to function properly since we always had to have a core dedicated to error correcting :P. If
we disabled error correcting, it was well over a million scores per second (It was also a bottle neck on all the other benchmarks) but almost half the results were gibberish.

These numbers are from memory, so don’t quote me on them. Note that after 3 cores we started utilizing the APU (With OpenCL). We couldn’t really utilize them for 1 and 2 cores since creating buffers created too large of a bottleneck with that few cores.

This was also a perfect case scenario. We did not have to do any nearest neighbour searches since the entities new before hand which advertisements they wanted to utilize. In a real world scenario you would most likely be peaking at these numbers, but there would be no way to do them consistently. Removing the need to do nearest neighbour searches also improved the performance of error correcting. The actual numbers would most likely have been peaking at about 10% lower than what they’re presented as there.

NLG

As for conversations with NPCs, its encouraged :D. DIAG is a stochastic based Natural Language Generation system oriented for dialogue. (We don’t have a version of DIAG yet for narration. The dialogue version is mostly just concept code right now as well). DIAG, should IN THEORY produce some very interesting conversations between NPCs and between players and NPCs. The NPCs construct dialogue mostly based off their inference engines that I mentioned above. They retain opinions on most things in the world that they deem important to them, and try to push those opinions on others through dialogue. This in turn leads to some very interesting clustering among NPCs as they will naturally begin to group together into factions and groups. (We’ve had groups of NPCs try to start their own rebellion. It was fun to watch :D)
Stochastic Dialogue Systems:
http://repository.cmu.edu/cgi/viewcontent.cgi?article=2402&context=compsci&sei-redir=1&referer=http%3A%2F%2Fscholar.google.com%2Fscholar_url%3Fhl%3Den%26q%3Dhttp%3A%2F%2Frepository.cmu.edu%2Fcgi%2Fviewcontent.cgi%253Farticle%253D2402%2526context%253Dcompsci%26sa%3DX%26scisig%3DAAGBfm2u-Oz8whUidBZc0JRWUh_LrQy18g%26oi%3Dscholarr#search=“http%3A%2F%2Frepository.cmu.edu%2Fcgi%2Fviewcontent.cgi%3Farticle%3D2402%26context%3Dcompsci”

What we’re trying to make DIAG very close to:
http://onlinelibrary.wiley.com/doi/10.1207/s15516709cog0104_2/abstract (But I think this is the objective of most NLG systems :P. The difference is that our entire AI architecture was designed with dialogue systems in mind. All of our AI is needs based and inference based which is perfect for dialogue systems)

We have 7 planned modes for NPC communication:

-Help Seeking
-Gripping
-Info seeking
-Info Probing
-Assistance (Providing)
-Transaction (Just general trading)
-General (Just normal chit chat)

Each piece of dialogue is separated into segments. So if the player tries to buy a sword, the NPC may first use Info Seeking to figure out why, then just jump into a transaction.

The issue with DIAG is just how much data it requires. Even our simple tests (Right now DIAG is only a console application with 1/16th of the functionality I want it to have and a few dozen pages in a notebook of mine) it still requires 10GB+ of data to function.

While DOT is pretty close to being a reality, DIAG is still a year off from being beyond a solid working prototype. The DOT prototype is mostly ready, what I released was an earlier version of the prototype with half the functionality of what I wanted the prototype to be.

Maybe I should add that all of this is being developed for Linux before windows due to the fact that it’s a lot easier to manage this much data on linux compared to windows. Porting to windows is going to be brutal :frowning:
Going into hobby game dev, I never thought I’d say this but the Linux version will be more fleshed out and have more features than the windows version lol

On a side note I REALLY need to write some documentation for this…

Edit: I created some documentation for this: https://github.com/MatrixCompSci/DOT/wiki/Basics-to-DOT's--AI :smiley:

I need some opinions on something we’re considering implementing.

What we’re considering doing is having a central repo server that contains the newest version of all DOT data, as well as packages detailing computations that need to be completed for the iteration to finish. These packages get spread out among the clients, and each client is told to complete a different part. Since the packages are designed to be split where data interdependence is not needed, they won’t need any of the computations from the current iteration. After a package is finished, the finalized results are spread between the clients, and then proceedingly pushed to the repo. All the clients then grab the next computation package.

So all clients contain a copy of all AI data from the previous iterations (With a Markov property of course. So if new data is available for a certain entity, the old stuff is overwritten) and computational packages. The previous iteration stuff are set up as a torrent for new clients and do avoid file inconsistencies. When a new computation is completed, the previous torrent is updated to redownload the files that have been completed (Since these files of course would have been updated).

The issue that I have is that either packages will be very small, or the clients will need to finish a downloading the new packages before they move onto the next file. The files that DOT outputs are far too large to keep entirely on RAM (6GB or so), but at the same time are too dynamic to download once when the client connects to a server.

I can’t have the server do all the computation, since the upload bandwidth requirements would be tremendous, and the algorithms utilized don’t scale well with the amount of players that are freely roaming. I can’t have players do the computation for the entities that only they effect, since entities are able to effect other entities as much as the player can. If I tried to design it so the player computed the entities that propagated outwards from the entity it had an effect on, the player would be computing every entity available shortly after.

As with A.I. in general, I’ve taken an interest in DOT and officially taking part in its creation. :smiley: And that goes without saying I will give you guys insight on what I explore.

The team is back from vacation and we hope to have the alpha ready for testing sometime by the end of January :smiley:

After reading this thread as a non-programmer, I understand absolutely nothing. However, I’ll be entirely enthusiastic to see your alpha and what it turns into.

The Alpha just had its test release today :smiley:

We’ve also got all our patch notes here

Hey. This is really pretty interesting stuff. I’ve always been a huge fan of procedural stuff but pretty much everyone I know is terrified of the idea for things like people. It looks like you guys are implementing a whole bunch of stuff I’ve been considering for quite some time but being a designer rather than a coder really puts a damper on making stuff happen, as it were. Nonetheless, most of what you’re discussing makes sense. I do have a few questions though:

I realise the discriptions are very much simplified, but exactly how nuanced and complex is the system? Basically how many individual variables actually interact in any given system. For instance you might have a character, and that character is defined by say ten variables defining their goals, emotions, ambitions and so on.

Using stochastic linguistics is quite a clever idea, but exactly how much does it modify itself according to dialect inflection and individual nuance. Essentially, how much gibberish does it produce or not produce?

How do you handle offscreen events? So let’s say there’s a city down the road that’s important to the current city you’re in, what kind of simplification do you do to handle that cities events?

Why single story? I’m poking at the limitations you’re probably running on here. But why do the events necessary need to be set up prior to the game start, rather than setting initial states and allowing cause and effect to take care of the rest? Or heck, in the case of a game with a linearish storyline, have you considered magnetic inevitability? That is to say, rather than forcing the player into the rut, move the rut under the player. Or, another way to put it, the player feels like they’re at the centre of the story, and they go haring off ala Skyrim into the wilderness, the game notes this, but also notes that other things are more important, and so it essentially directs the events of the players next actions to put them back onto their designated path. I suppose an example of that would be where the player is supposed to slay the evil king, but they decide they prefer hunting trolls and completing all the guild quests and basically ignoring the plotline altogether. The game decides this is bad, so it puts a motivation flag up, and sends a mercenary to ‘motivate’ the player, Morrowind Tribunal style. The player, being a player, ignores this. So the game puts another motivation flag on the player. This time they run into a group of knights from the king sacking the village. They kill the knights, and continue on their merry way. Third motivation flag up. The king declares the player a fugitive for killing his knights. The player is now unable to interact easily with law abiding citizens without being called for arrest. They still ignore the king, so fourth motivation flag up. This time a companion is sent to join the player, their mission being to bring the player to the king. Because nothing works better than a damsel in distress - Actually no that’s not right. No actually they steal the player’s equipment and goods and leave a note saying they liked the player so they couldn’t kill them, please see them in the kings palace, or to that effect, because nothing motivates a player more than getting their sweet loot back.

So that’s the Deus Ex Machina version of a motivation. A more complex one would make each action the player takes drive them towards their goal. Which begs the question. What motivates a player? Aannd too much talking. Nonetheless, more questions, but I’m interested in what your answer would be. :slight_smile:

First off for complexity, that’s entirely dependent on the designer. Most test scenarios we’ve done so far require 2K - 3K different variables interacting within a given system, and an individual entity’s single decision rely on about 30 - 40 different variables. A lot of this is entirely automated however. The designer would really only need to create about 10 or so different variables, and DOT will manage the rest.

We have very little idea on stochastic linguistics :smiley: We’ve created prototype projects that produced very interesting results from a predefined training set, but we haven’t done the full implementation of it yet. I would imagine that 90% of it would be very well managed, as dialogue is only created in accordance to the Dialogue Games paper that was published back in the 70s. I don’t think there would be much gibberish. It would start at an okay, and readable level and only get better from there.

I don’t recall ever saying single story. You define factions, and give them a set of plotpoints they need to hit. Each faction can have 256 different plot points, and it chooses the one that interests it the most. The world is started fairly far into the game since a lot of the plot generation is done as deep learning optimization problems through a blackboards system and a multiclass SVM sytstem for constructing the network itself. Every lower node within a blackboard is an instance of a faction specified by the SVM system and the requirements of the node above it. (No we won’t be using UE4’s blackboard. Yes its because we feel they didn’t do a good job optimizing it for our particular intentions.) If we didn’t start it fairly far into the world’s history, none of the network would be optimized and the player would be waiting for a really long time for anything interesting to happen. DOT automates when the world is ready for use by calculating a bayesian efficiency value over the entirety of its tree. When its greater than a value that’s predefined by the designers, its ready. We typically use 0.7. That implies that the SVM tree has 70% efficiency. In turn this translates to, if the king asks for iron, he will have iron delivered to him 70% as efficient as possible. Therefore, it takes 43% longer than the absolute minimum time it will take to deliver iron. The system will continue to optimize this and redraw sections of the network as time progresses.

As I said every faction can have a set of plot points. There is magnetic inevitability to the plot point that the upper most node selects.

So if a king wants to invade a country, the plot will continuously get pulled towards that as the tree attempts to optimize for it. (Of course pulling the player along for the ride as well); however, if that plot point is finished, the king will select a plot point that would require the closest tree to the one that it already has.

I’m not sure if what I said made sense. If it didn’t, let me know.

comments/2tcnot/update_valpha_104/

I’m actually very very proud to announce that DOT has surpassed the performance of a standard behaviour tree implementation, which from what I’ve seen is a hell of a milestone for any fuzzy logic controller. We’re currently packing 14K decision branches per millisecond per thread on a Haswell E CPU, compared to a MCTS implementation we created as a control which is packing 12K decision branches per millisecond per thread.

Its free for download if anyone wants to post their results here :smiley:

(Before you ask if it will perform faster than UE4’s decision tree system, it performed faster than it in Prealpha. I haven’t tested against the newest build, as that was back in 4.4. I assume it’d most likely be on par with DOT.)

DOT plans to go entirely closed source for a few months, and then reopen to a semi small group of users. This is primarily so that we can have our team focus on the engine’s development rather than having to work with a user base from start to finish.

After the conclusion of BETA, DOT’s source code will be available to those who help fund its development, and not the general public.

The repo will be deleted within the next few hours.

Its been fun guys, but in all honesty going open source was an awful decision thats costed us a fair amount of money and time. All existing licenses of DOT are to be considered full GPL. DOT may no longer be used within Unreal Engine 4 unless a license is purchased, of which we’re not even sure if we’ll continue due to the EXORBITANTLY steep limitations of unreal engine 4’s AI engine. (Primarily very poor performance [Both memory and processing wise], far too object oriented in its approach, and the fact that we had to scrap over 50% of it for DOT to work at its full potential.) Those studios that we have already taken on utilizing unreal engine 4 will receive an internally developed version. This includes “The Unpersons” and two other smaller titles.

Hey Matrix,

What happened?

I was really looking forward to using this with Unreal Engine 4. But from what I am reading that might not be the case anymore. Which makes me really sad.

Either way - How much would a license cost?

I will shoot you a PM with the details. :slight_smile:

Just curious,
HeadClot

I can discuss the pricing of a license with you over the PM. Its extremely indie affordable at the moment, and will almost certainly be subscription based.

We decided to end the open source ness since we want to do some REALLY big features that we wouldn’t be able to budget otherwise :frowning: (Ie: Adding direct support into DOT that makes deploying into an MMO type scenario very simple and low maintenaince)

Incase anyone is interested in a license, shoot me a PM. I can have a meeting scheduled between your studio and my sales rep without a problem. If there is enough demand remaining for a UE4 port, I’m sure we can get it done :slight_smile:

Just want to give a status update. We finished alpha earlier today and will be moving into betas development within the next few weeks. Also, due to surprisingly highly popular demand, a ue4 port us still in the works :smiley: We also have a Unity port being considered more actively now.