# AI Conversation

I am trying to create a conversation system for a crowd simulation AI. The way I am currently approaching this is by doing a check if bot1 sees bot2, than I pick a point for them to meet and they meet at that point. Start a conversation. The problem is that not many times two agents happen to see each other. I want to introduce a sociability level for each bot which represents how sociable (how much he wants to get engaged in conversation) he is. The problem is that I try to make use of this variable by adding a variable sociabilityLevel which varies from 1 to 10. Whenever two bots see each other I pick a random integer value between 1 and 10, call it randomValue.

If randomValue <= sociabilityLevel, for both of the agents, than they actually meet. For example: bot1 has sociability level of 9(high) and bot2 has 5(medium), assuming they both see each other in this frame,I pick a random value which happens to be 4. This means that the meeting is possible,otherwise for a random value of say '8' than the meeting will be cancelled because it does not satisfy bot2 requirement.

My goal is to make the agents with high sociability level talk with each other very probable, and agents with low sociability level talk with each other very unlikely. And any other combination with medium etc.

The problem is that with my current approach is that the sociabilityLevel variable does not reflect the actual chance of that agent of talking. The reason is because the condition of the agents to see each other is much more powerful than the randomValue <= sociabilityLevel condition.

Furthermore, if two agents come from direct opposite directions they will see each other on several frames, which means that the check randomValue <= sociabilityLevel will be executed as long as they see each other. This results in picking several random numbers pretty fast and it is quite likely that an agent with a level of 2 sociability will agree to the meeting.

I thought of introducing a 0.25 let's say delay for the agent to check if he sees another agent and vice-versa. This does not seem the right way to solve the problem.

Let's I remove the check for them to see each other and create a sort of event (like in this post : Design pattern for AI cooperation), where bot1 asks "Do you want to meet me?", and bot2 answers "Yes, I do". The issue is that how can I get the meeting point right? Because they have to face one each other and I am not pretty sure how to do this. Moreover, I only need to send the "Do you want to meet me?", only to a close bot, otherwise will mean a disaster, one agent wait hours for the other agent to come up.

• I use ray casting indeed in the checking if they see each other. Every agent has a viewAngle and a viewDistance. I will borrow the idea with the average of sociability and the list of bots. One thing, though, if I have 30 bots would that be efficient enough?Having a list for every bot? In the game I use a GameManager class which holds a list of all active bots. Thank you for the answer, it helped me :) Commented Apr 6, 2020 at 6:53
• So thanks dude, I will mark your answer for you. I still find more reasonable to make a double condition like this one randomValue <= sociabilityLevel for both bots than using an average. If bot1 has 1 sociability and bot2 has 10 than the average is 5, which is quite big and meaning 50% probability for them to meet. Not really intended though. If I use my condition the probability is smaller,which is better from my point of view. You read the question, you had the time to answer and comment, I appreciate that. Commented Apr 6, 2020 at 19:37