Monday, 6 November 2017

AI Techniques and Decision Making Concepts

AI Techniques and Decision-Making Concepts

Artificial intelligence in games needs to feel real. The best games we know and love, past or present, are immersive -they make you feel like you’re actually there, not just sitting on your sofa with a controller / mouse in your hand. Time passes by and before you know it hours have flown by and you haven’t even felt it. AI plays a major part in that immersion, through the concepts and techniques they are given. These I will cover below:

 

State Machines & Behaviour / Decision Trees

Figure 6. Finite-State Machines: Theory and Implementation 
(Bevilacqua, 2013)
State machines, also known as finite state machines (FSM), are a “model of computation based on a hypothetical machine made of one or more states.(Bevilacqua, 2013). These machines are designed to function as a thought process for AI, making them more intelligent. However, this can leave them feeling very rigid and static. This is due to the fact that each state specifies that of the next. Furthermore, states can’t be defined dynamically - it can’t query what it’s being asked and therefore it’ll always react in the same way. [Fig. 6] shows an example of a FSM, where “find aid”, “evade”, “wander” and “attack” are all of the states. The biggest problem with FSMs, as pointed out by (Estrada, 2014)FSMs are great because they are so simple and intuitive. When they get big, however, they become so complicated. It got to a point where I’m afraid to change the configuration of the FSM because the working AI easily breaks.” For state machines that are extremely complex, this might require fixing multiple states in order to get the AI working. The bottom line is that if the AI in a game is intended to be simple, then FSMs are the correct option, but for anything complex, behaviour trees are much more appropriate.


Behaviour trees provide a way of defining a given state depending on the feedback from other states, known as children. In the diagram below [fig. 7] (Simpson, 2014) explains that “The most obvious usage of sequences is to define a sequence of tasks that must be completed in entirety, and where failure of one means further processing of that sequence of tasks becomes redundant.” In other words, the door cannot be walked through if it hasn’t been opened. All of the checks that are being made on the door are children of the “sequence” node, with this node being the parent.
These children are the leaves of the tree, and the sequence node is the branch.

Figure 7. Behaviour trees for AI: How they work 
(Simpson, 2014)
These trees give the AI more control, making them able to make decisions based on their current state adds to immersion. It can make the AI feel more human and not just a robot. Some games such as PacMan have contained the simplest of AI, but partly the reason that this game was so successful was due to the AI being able to make decisions by themselves. (Kehoe, 2015) describes AI decision making as a “core concept”. Without this capability, AI can feel very scripted and rigid. The type of decision that an AI will make will be based upon the genre of game it is, but the fundamentals stay the same.

The decision making in PacMan was extremely basic, as (Kehoe, 2015) explains “Four ghosts plagued the player. Each ghost followed a simple rule set. One ghost was always to turn left, another was always to turn right, one turned in a random direction, and the last turned toward the player.” More complex decision making involves using larger trees, which provide a platform for when an AI decides.

Fuzzy Logic

Fuzzy logic, as (Rouse, fuzzy logic, 2016) describes is “an approach to computing based on "degrees of truth" rather than the usual "true or false" (1 or 0) Boolean logic on which the modern computer is based. 

These models can be used as a platform to make decisions to determine an AIs state to give states to an AI. In older games, such as PacMan there were only two states: alive and dead. The player would be alive until they bumped into an AI, and at that point it was all over, and they were dead. The application of fuzzy logic is expanding this linear system by introducing new waypoints between 0 and 1. In the game League of Legends, AI will become aggressive when their health bars are full or near full. Upon reaching a certain percentage of health they will start to retreat towards their base. These are states determined by fuzzy logic which, when the AI drop below a certain percentage of their maximum health, tells them that they are in some sort of unhealthy state, and must retreat. This is as shown in [fig. 6], the player is attacking back, it’s health gets low, so the AI chooses to retreat.

No comments:

Post a Comment

References

References Bevilacqua, F. (2013, October 24). Finite-State Machines: Theory and Implementation . Retrieved from: https://gamedevelopmen...