1
\$\begingroup\$

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.

\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

How I would have done is to add a circle on every agent. The more sociable have a bigger zone so more chance to see an other one. If two zone touches, you make a probability check,

example: Bot1 have a sociability of 3 and bot2 have a sociability of 7. You make the average like "(ShiestBotSociability + SociableBotSociability) / 2" = meeting chances that give a result between 0 and 10. Then you get a random value between 0 and 10 and do "if random number < meeting chances ..." If the don't meet, you add the bot1 an array of bots to ignore of bot2 and do the same for the array of bots to ignore of bot1. Then you remove them from the array under a certain condition (ex: after 1 minute they could meet again).

If you don't want to do that: I'm not sure if thats possible in the case of your game, but you could use a raycast as the bot view (if you're not already doing it) that have a certain length of like 10 meters. If a bot see an other one, you can do a probability check based on his social level to determine if he will talk to the other bot, then if he do the other bot either turn toward him or ignore him, based on his sociability.

However I think the best way is still to compare both bots sociability is to make an average, but thats up to you. I hope this helps you !

\$\endgroup\$
4
  • \$\begingroup\$ 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 :) \$\endgroup\$
    – nickk2002
    Commented Apr 6, 2020 at 6:53
  • \$\begingroup\$ Maybe a multidimentional array in a game manager would be a better idea, or something that doesn't have to be on every bots. If this answer your question you can mark the my answer above as the solution :) \$\endgroup\$ Commented Apr 6, 2020 at 15:03
  • \$\begingroup\$ Ok a multidimensional array in a game manager is the same thing judging by the memory ( O(number_bots * number_bots) memory). \$\endgroup\$
    – nickk2002
    Commented Apr 6, 2020 at 19:37
  • \$\begingroup\$ 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. \$\endgroup\$
    – nickk2002
    Commented Apr 6, 2020 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .