For my second blog post, I wanted to touch on artificial intelligence in games. Specifically on probabilities and how they are used. Probabilities are used in many forms of gaming, simulation, evaluation, conditioning, completion, and learning. Lets start off with some bad AI and how probabilities can help the situation. Here is a common video of some hilariously bad AI.
What makes it so horrendous you might ask. Well it clearly lacks natural intelligence. It isn't learning that climbing down that wall is a bad idea even though tons of the AI's comrades have died in that spot.This is most likely due to lack of natural behaviour. Natural behaviour requires probabilities. This is because having so many situations causes inherent unpredictability which causes choosing the best behaviour very difficult under uncertainty. Probabilities are used in many forms of gaming, simulation, evaluation, conditioning, completion, and learning.
A very common probability method for AI found in games is the Bayes theorem.
P(A|B) = P(A and B) / P(B)
Using this formula could help prevent this almost suicidal like intelligence. We would use probability conditioning. Suppose we want to know the probability of death (given) we climb down the wall. (When I say we, I'm talking as though we are the computer controlled enemies). How would you compute this situation?
• Prob of conditional = (prob of complete config)/(marginalized prob over condition)
• Pr(A|B) = Pr(A∩B)/Pr(B)
• Pr(death|climb over) = Pr(death and climb over)/Pr(climb over)
= .2/.41 = 0.488
Those numbers are just examples and they would increase the number of times the AI would die in that situation and each would have their own functions to depict why they increase. An example of the function for "death" would be, the probability of dying anywhere on the map, computed by the rate of AI deaths anywhere on the map during a certain time frame (if AI has been alive longer the chance of death is higher. The example for the "over wall" function would be the probability of climbing over the wall as opposed to another route.
Lets say if that number is <.50 continue with that route. If the number is >, find an alternative route. If the numbers in the example is of maybe the second time this situation occurs, its understandable from the AI's perspective to make that mistake. Perhaps the first enemy had a .00 percent chance since no one had died doing this maneuver before. He jumps over the wall and is shot. This puts the number up to the same figures as above. Since it is not > .50 he would still attempt the same route. This could be because (looking from a reality perspective) he doesn't see his fallen comrade, maybe the shooter has left and is not in the same position, etc. Now if after two people have died from the same situation it's time for the AI to adapt. The AI should figure out another route to take in order to find the player using something like A* or Dijkstras search algortihm
In conclusion, there are many ways to make AI smart and be believable as human beings. This is only one way that could work and I'm sure there are many other efficient ways as well.
No comments:
Post a Comment