Fuzzy Variables and Membership Functions
The enhanced movement behaviors are defined in terms of concepts in the world, which must be modeled using either fuzzy variables or linguistic variables (that is, a combination of terms). Conceptually, these variables are used by a fuzzy expert system, either inputs to the system or outputs linked to actions. There's no need for internal variables in the actual fuzzy interpreter because the behaviors are truly reactive.
First, the fuzzy system needs to control the movement. A linguistic variable called move is defined with three different terms: forwards, stop, and backwards. The base variable is defined as the movement velocity. Forwards is defined as half a triangular membership function, corresponding to 0 degree of membership (DoM) when the velocity is null, and a DoM of 1 when the velocity is full. Backwards is defined as the exact opposite, defined as 1 DoM when the full velocity is in reverse. To define the third term, we use a fuzzy equation of the primary terms:
stop = not (forwards or backwards)
This relationship is relatively intuitive. However, want to sharpen the meaning of stop, because the slope is a bit too gentle. So, we use the fuzzy modifier extremely to obtain a steeper curve, much closer to the informal meaning of stop.
The second form of control needed on the movement is turning the body to influence the direction of travel. To achieve this with a fuzzy interpreter, we'll use another linguistic variable called turn. The base variable for turn is defined as the relative yaw turning angle in degrees. There are five fuzzy terms defined over this base variable to form the linguistic variable, each of which indicates objects that must be turned toward: button, door, ladder, platform, and exit. These are dynamic membership functions, because the relative position of these objects changes over time. The triangle membership function is used; the point of the triangle matches the angular position of the object, and the base always goes through the origin. (That is, zero membership means no turn.)
A final variable, called look, controls pitch separately. This is a simpler linguistic variable, defined statically. There are two fuzzy terms: up and ahead. The term up corresponds to a pitch of 90, with the base of the triangle going through the origin. The term ahead corresponds to a pitch of 0, with the base of the triangle at ±90.
The senses are other linguistic variables. The door is defined over the height of the opening (base variable); the door is defined as "open" if the player can crawl through, which tails off to a DoM of 0 as the door touches the floor. We can also define the fuzzy term "fully open" as a combination of the primary term open and the offset modifier fully. When the player can walk through, the DoM is 1, and 0 when the player can crawl through.
Then, we define a button_pressed term, which is really more of a Boolean singleton than a fuzzy variable. There is no continuous base variable to use (except maybe time), and more to the point, there's little benefit in using one.
The linguistic variable platform is defined as two terms: ready and arrived. Readiness is measured as the distance off the floor, and how easy it is to climb on. The DoM is 1 when the platform is at the starting point, fully on the floor; the DoM triangle then reaches 0 when the player needs to double-jump to get onto the platform. The state arrived is measured as the distance to the final location; full DoM corresponds to a distance of 0; when 0, DoM requires a double-jump to get off.
Another simple term, called aboard, indicates whether the animat is on the platform. It's defined with a membership of 0 when the animat is not on the platform. This peaks at the center of the platform to a degree of membership of 1. The base variables are the x and y coordinates on the floor, rather than the distance to the center of the platform. This makes the membership function seem like a pyramid on the platform.
Finally, the linguistic variable for the ladder is defined as two terms: held and top. The term held is defined over time, taking its full 1 DoM value after 1 second of touching, and back to 0 after it has released for a second. The term top is defined over height as a base variable. When the player can just walk off, it has 1 DoM; the DoM triangle reaches 0 one step away from the top.