Relationship AI

Artificial Intelligence

  • ue4

I’ve wanted to make this project for a long time because I love building simulation-driven systems that change over time. By using simulation-driven systems level designers and artists can make environments feel more alive without player-interaction.

The idea was to create an AI-agent that walked around and interacted with other AI’s. After the AI ended a conversation with another AI both of  them would remember that they had the conversation and act differently when the two AI’s met again later on. I decided to implement this as a relationship-based solution similar to the one used in the game The Sims.

With a relationship-based solution the conversation could either end in a better or worse relationship status between the AI-agents.

Developer video

The Process

First off I created a crude random-generated walking pattern where the AI’s would eventually come in close proximity to each other. After that I created the sight sense. It got implemented as a proximity-check to see if another AI-agent is in the vicinity.

Now the AIs can walk around and find each other. The next logical step was to implement how the AI handled their relationships.

They got individual names from a list of names and their starting relationships to each other got randomized between good, neutral and bad.

The randomized relationship statuses.Patrolling AI that walks between target points.

 Struggling keeping it Object-oriented

My initial thoughts about the system were that the AI-agents would always be the masters of their own actions. When I had two AI-agents talking to eachother for the first time I quickly relized the complexity of having two AI’s sharing the same conversation tree,  having to tell the other when it’s their turn to talk.

Which one of the AI’s were to decide how the conversation should go?

When the AI initialize a conversation it randomized one of the AI's who will be the controller of the conversation.

I randomly selected one of them who would control the conversation. The AI with the control would keep the other AI in a “limbo” state, taking control over the other AI’s speech. After the conversation the controlling one will change the relationship-status for both and release the other AI.

When a conversation ended the controlling AI will reset the variables for both.

This is the "bad"-relationship conversation-tree that the AI can use when talking to another AI.

I decided to limit/restrict the possible relationship levels to 3 due to the massive amount of dialogue-trees it would require.

Further Developement

From where the project stands today it would be easy to add support for special dialogue-trees between two specific AI-agents.

To use the AI all I have to do is to place target points and it will start patrolling, finding other AI’s and start conversations.

All in all, even though I had to iterate on the initial design, everything went smoothly. Making the AI was a lot of fun and I learned a lot about UE4 and visual scripting in general.