This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

Editors' Picks Books

Hand-picked favorites from

our editors

our editors

Editors' Picks Audiobooks

Hand-picked favorites from

our editors

our editors

Editors' Picks Comics

Hand-picked favorites from

our editors

our editors

Editors' Picks Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

CHAPTER 2. NPC BEHAVIOURS USING RULE BASED METHODS

2.3

Fuzzy Logic

Behaviours for a wide range of lifelike actions typically take continuous as opposed to discrete values. • Consider the case of providing a plausible NPC racing car driver. Corners are made by turning the steering wheel as a continuous variable as opposed to assuming one of a predeﬁned set of values. Moreover, turning the wheel is not performed at a ﬁxed rate, but with a variable rate of change. Likewise acceleration or breaking. • Now take the scenario of copiloting a rally car driver, the copilot might provide a commentary using a set of predeﬁned terms such as “fast right”, “blind ridge”, or “hairpin left”. Such information appears to be ‘fuzzy’ but is suﬃcient to guide the driver in piloting a car through a decision making process that requires real time operation. The terms do not assume a ﬁxed reference point, with ‘fast’ always implying a speciﬁc predeﬁned speed, but are interpreted within the context of environmental conditions. Such descriptions dominate our perception of the world as a whole, for example, • A weather forecast: just at what point does sleet become snow, and snow transition into heavy snow? • Colour: at what point does red become orange? • Golf driving instruction: If there is a strong wind, blowing left to right, then hit the ball hard in a direction far to the left of the ﬂag. Note that the ‘fuzzy’ terminology here has nothing to do with statistical measures (there is no element of chance involved). Moreover, such fuzziness enables us to scale our reasoning to many contexts, thus avoiding a lot of exhaustive enumeration that traditional computing data types might imply. The linguistic aspect is a re-accuring factor which dominates the way in which an expert might impart his/ her knowledge to someone less knowledgeable. • Attempting to place speciﬁc values on the ‘fuzzy’ description may well introduce uncertainty. – For example, if we assumed that a ‘strong wind’ implies over 40 kph in the above golﬁng example, then what happens if the wind is only 39 kph, a classical set theory would assume that the wind was not strong.

2.3. FUZZY LOGIC

35

Observation ! membership

Fuzzification:

Antecedent ! consequent

Fuzzy Reasoning:

Membership ! scalar

Defuzzification:

Figure 2.8: Basic architecture of a Fuzzy Inference System. • The use of fuzzy or linguistic relations enables us to introduce a smooth continuously valued assessment environment and resulting actions. In order to provide the basis for a NPC model which expresses behavioural traits as continuous valued properties we: 1. Establish a non binary measurement system (fuzziﬁcation); 2. Deﬁne an appropriate logic for establishing consequences from antecedents (fuzzy reasoning), and; 3. Provide a mechanism for interpreting the result (consequent) in terms of a scalar (defuzziﬁcation), Figure 2.8.

2.3.1

Fuzziﬁcation, Set Theory and Membership Functions

In order to measure the extent to which a concept has been achieved, as in the wind was ‘strong’ or a ‘dangerous’ threat is posed, we need to introduce the concept of set membership. Given a number line representing the scalar measured value of a

36 CHAPTER 2.5ft Fuzzy Set Membership Measured variable: height of a person Figure 2. 4. NPC BEHAVIOURS USING RULE BASED METHODS Universe of the measured variable Set Membership: Binary (crisp) mapping 1 short 0 med. tall giants 15ft 4ft 5ft 6. .9: Example membership functions for establishing classical (crisp) and fuzzy sets.5ft 6ft tall 8ft giants 15ft Classical Set Membership Measured variable: height of a person Set Membership: Continuous valued mapping 1 short 0 med.

2. we are interested in declaring membership functions that are eﬃcient to evaluate3 . x. To this end. 3 .5 mH (x) = (2. Figure 2.10. b. c}. • Normality: 0 ≥ µF (x) ≥ 1 • Domain of discourse: x ∈ R From the perspective of computer gaming applications. that includes the case of binary membership as a special case. More formally. Classical Crisp Set membership of set ‘A’ for the concept of ‘short’ individuals in Figure 2.1) 0 otherwise • The members of set A are described in terms of the binary membership operator. µF (x) tends to zero.3. b.9 is expressed as {A = x ∈ R | 0 ≥ x ≥ 4. smoothness constraints are typically assumed. although the following constraints are generally assumed. Sigmoid or Bell curves might be assumed [10]. Fuzzy Set membership is established by a membership function. membership functions generally take the form of either triangular or trapezoidal operators (and special cases of a ‘singleton’ and ‘shoulder’) Figure 2. say hight of a person. likewise as x exceeds the point for maximum membership. Figure 2.0 (2. a.10. membership functions based on Gaussian. but may result in a membership grade anywhere in the unit interval depending on the value of the measured entity. As such the user is free to declare any form of fuzzy membership. or x−a c−x triangle(x. thus may only either be a member or not be a member. Thus. mH . Triangular membership function is described with a tuple {a. 1 0 ≥ x ≥ 4. variable denoting the location of the corresponding corners. µF . c) = max min . • Monotonicity: µF (x) tends to unity as x tends to the maximum value.2) b−a c−b In the case of applications where self identiﬁcation of the membership functions are required. FUZZY LOGIC 37 property.5} or by the crisp membership function. the following terminology is generally adopted. we need to establish a membership function which maps the measured value into a set with associated label.9. mH . [5]. .

As long as the range is common to all membership operators the range itself is not important. c.a. on a domain of discourse. variable denoting the location of the corresponding corners. but we also support degrees of membership over a common interval. c. c. . R.. 1. • Note. b. c. 255}. d) = max min . .3) b−a d−c At this point we have a mechanism for mapping a variable. b..10. c) 1 mF(x) 1 Singleton(x.. Trapezoid membership function is described with a tuple {a. NB mF (x) and µF (x) will be used interchangeably to denote a fuzzy membership function. NPC BEHAVIOURS USING RULE BASED METHODS mF(x) Triangular(x.a. . d) 1 x mF(x) 1 Trapezoid(x.a. such that the classical cases of binary membership are included as a special case. Figure 2.0 (2. d}. x. a. b. d) 0 0 x x Figure 2. or x−a d−x trapezoid(x.a) 0 0 x mF(x) Shoulder(x. but from an implementation perspective the interval might take the form {0. b. b.10: Typical fuzzy membership functions appropriate for gaming applications. that from a set theoretic perspective this interval is generally assumed to be the unit interval.38 CHAPTER 2.

Cartesian product spaces Let the elements of two (classical) sets A and B be: • A = {0. Measure membership: Evaluate corresponding fuzzy set membership.2 Crisp Relations In the following we will incrementally establish the basis for our fuzzy reasoning engine.3) for Triangular or Trapezoidal membership functions respectively.3. (b) Case of Trapezoid membership function: IF a ≥ x ≥ d THEN ‘is a member ’. c} The pairwise association of two collections of elements deﬁned by two sets may be speciﬁed exhaustively in the form of Cartesian Products. • The development will ﬁrst consider the classical binary logic. and then introduce the corresponding fuzzy model of composition. 1} • B = {a. equations (2. b. or (a) Case of Triangular membership function: IF a ≥ x ≥ c THEN ‘is a member ’. FUZZY LOGIC 39 Establishing to what degree a variable x is a member of a fuzzy set.2. • This will provide the basis for the composition operator. where the reader is referred to these references for further information. 2. 2. To do so. where it is this operator that provides the basis for building the fuzzy set equivalent of implication or generalized modus ponens. is a two stage process: 1. The presentation follow that developed in [10] and [5]. or fuzziﬁcation. we: • Address the concept of logic as applied to ‘relations’.3. .2) and (2. Establish range: The ﬁrst step is to determine whether the variable lies within the domain of the membership function.

X and Y. c). (0. (a. (0. Thus. NPC BEHAVIOURS USING RULE BASED METHODS • However. y) = (2. 1). χ denote the strength or pairwise relations. a). with unity denoting a complete relation (between the two elements in each universe) and zero indicating no relation. For example. 2} the unconstrained universal relation UA and corresponding constrained identity relation IA would have the form. (c. Thus. (0. (1. species generally only reproduce with members from the same species.5) 0. 1).4) . Characteristic Function • The Cartesian product space on its own merely establishes the total space of variable combinations. for a set A = {0. 0). • A more general case permits elements to have no relation with each other. Let the characteristic function. 0). c). b). an order is established between the pairwise enumeration. (c. 0). b). c). (c. y) ∈ X × Y / In the above Cartesian product space we assumed that all elements of each universe have some relation with each other. (1. (a. b). (c. b). (b. y ∈ Y } results in a complete pairwise enumeration of every element in each universe. (c. (a. a). (b. a). • What makes the concept interesting from the perspective of establishing a reasoning engine is the strength of the relationship between pairs of elements. (b. X × Y = {(x. 1)} • B × B = B 2 = {(a. y) | x ∈ X. (b. (1. 1. 1)} • A × A = A2 = {(0. the Cartesian Product of two or more sets is distinct from the case of an arithmetic product. • A × B = {(0. (b. (2. 0). (1. c)} • B × A = {(a. 0). a). (x. or 1. (x.40 CHAPTER 2. (1. y) ∈ X × Y χX×Y (x. c)} In the more general case the Cartesian product of two universes. 1). a). b).

FUZZY LOGIC 1 2 3! 1 2 3! 41 Unconstrained relation: UA! 1 2 1 2 3! Constrained relation: IA! 3! Figure 2. (2. (2. 1).3. • UA = {(0. • The above relations can be expressed diagrammatically through Sagittal diagrams in which the relation expressed by the Characteristic Function is summarized by the lines between each domain element. Figure 2. (1. 1). (2. 2)} • IA = {(0.11: Sagittal diagram for unconstrained (UA ) and constrained (IA ) relations. 0). for unconstrained and constrained relations expressed by UA and IA above. (0. (1. (1. (1. 0). In the case of a 3 × 3 space the ensuing relations .11 provides the pictorial equivalence. 2). 0). 0). Finally. 1). 2)} respectively. (2. • Thus. (0. 2). or O and E respectively. Operators Two of the most simple relations take the form of the null and complete relation matrices. 1). note that.2.

the properties of commutativity. y) : χR (x. y) Identity (∅ → O and X → E) (2. • Let ‘S ’ denote the relation or mapping between elements of domain Y to Z. Composition Consider the Sagittal diagram of Figure 2. We may summarize the relations characterized in this diagram and pose a question regarding the number of elements mapped between the domains as follows. y) Containment R ⊂ S → χR (x.6) • Now consider the two relations.7) In addition to the above function-theoretic relations. However.12 identiﬁes two paths by which elements from the domain of X are mapped to that of Z. z1 }. y2 . R and S. • The following provide function-theoretic operations (equivalent to the set theoretic operations for union. Union R ∪ S → χR∪S (x. y)] Intersection R ∩ S → χR∩S (x. z2 } and {x2 . where this is a fundamental building block for establishing our reasoning system.42 CHAPTER 2.12. y) : χR (x. y3 . the above deﬁnitions are suﬃcient for introducing the concept of composition. associativity etc may also be carried over from the equivalent set theoretic cases [10]. deﬁned on Cartesian universes X ×Y . y) = min[χR (x. • Let ‘R’ denote the relation or mapping between elements of domain X to Y. χS (x. y)] Complement R → χR (x. or {x1 . (2. y) : χR∪S (x. The operation that expresses the set of . y) = 1 − χR (x. y) ≤ χS (x. y) = max[χR (x.E = 1 1 1 0 0 0 1 1 1 take the form. NPC BEHAVIOURS USING RULE BASED METHODS 0 0 0 1 1 1 O = 0 0 0 . intersection etc). • What elements from the domain of X are also mapped to the domain of Z ? Figure 2. y). • In doing so we are laying the groundwork for building the logic associating with the fuzzy reasoning engine. y) : χR∩S (x. y). χS (x.

z)) (2.9) Question: For the crisp relations depicted in the Saggittal diagram of Figure 2. .12: Saggittal diagram for example of crisp relations between elements of three universes. deﬁne the Relation matrices R and S.2. z) = y∈Y (χR (x. z)) y∈Y (2. χT (x.3. FUZZY LOGIC 43 X x1 Y y1 Z x2 y2 z1 y3 z2 R y4 S Figure 2. z) = (χR (x. max-min composition has the form. y) ∧ χS (y.8) max-dot composition has the form. χT (x. T. Let ‘T ’ denote the composition mapping identifying the elements between relations R and S. or T = R ◦ S. elements associated with such a path is denoted composition. and has two general forms. y) • χS (y.12. and the corresponding max-min composition.

R. relations are deﬁned above as per crisp sets. µB (y)) (2. Thus. y) (2. R and S. y) Containment: R ⊂ S ⇒ µR (x. of the fuzzy sets. y)) Complement: µR (x. y). deﬁned on the Cartesian space X × Y .11) where the membership function of the fuzzy relation R is deﬁned in terms of the intersect. the laws associated with the excluded middle relation is explicitly broken in the case of fuzzy sets. the above Cartesian product is implemented as a cross product of two vectors. y) = 1 − µR (x. analogous set operators may be deﬁned in terms of the fuzzy membership function. x and y. a fuzzy relation. 1]. is a fuzzy relation. y) = min ((µR (x. y) = min ((µA (x). it follows that the deﬁnition for a fuzzy composition is also . or Union: µR∪Y (x. R expresses the Cartesian product space X × Y in terms of a strength of membership. y) ≤ µS (x. y)) Intersect: µR∩Y (x. Operators For fuzzy relations. X and Y. in the case of the fuzzy relation R. A and B. from each universe. µS (x. µS (x. as measured over the unit interval [0. • Thus. however. and complete.44 CHAPTER 2. NPC BEHAVIOURS USING RULE BASED METHODS 2. membership is measured in terms of a membership function. y) = µA×B (x.3. R ∪ R = E. or µR (x.3 Fuzzy Relations • The above methodology established the process for deﬁning relations between universes through the concept of a Cartesian product. E.12) (2. and R ∩ R = O Cartesian Product and Composition The Cartesian product between two fuzzy sets. y) = max ((µR (x. O. y).10) The null. • In the case of elements characterized in terms of fuzzy sets however. itself contained within the Cartesian product space declared by the respective universes. µ. deﬁned in terms of ordered pairs of elements. or A×B =R⊂X ×Y (2. Moreover.13) As such.

B. The general goal is to infer the (degree of truth) associated with a proposition. ‘A’ denotes “sharp corner” and ‘B’ “approach slowly” then we can naturally express the implication by. deﬁned on Cartesian spaces X × Y and Y × Z respectively.9. z)] (2. or A → B.3. The basis for formal reasoning is an inference procedure. a “somewhat sharp” corner enables us to generalize to inferring that the approach should be “more or less” slow. consider two fuzzy relations R and S. itself based upon an appropriate model for ‘if–then’ rules. THEN y is B consequence (conclusion) y is B However. z)) = maxy∈Y min [(µR (x. T. 4 . premise 1 (fact) x is A premise 2 (fact) IF x is A. or max-product4 composition: min-max composition: µT (x. THEN y is B consequence (conclusion) y is B’ Implies that the intersect operator is deﬁned in terms of a dot product as opposed to the min operator. Thus. or premise 1 (fact) x is A’ premise 2 (fact) IF x is A. this should not be taken to imply that the resulting system is any less exact than that aﬀorded by crisp logic. The ensuing fuzzy relation. A.3. is to provide the basis for reasoning under non-binary information. z) = y∈Y ((µR (x. or modus ponens. from the implication.4 Fuzzy Reasoning The original motivation for fuzzy logic. FUZZY LOGIC 45 deﬁned analogously to the crisp composition operator. fuzzy reasoning might be considered more exact precisely because it does not assume a binary universe. µS (y. y) ∧ µS (y. and general goal of the above preamble. The ensuing reasoning system often this is referred to as “Approximate Reasoning” or “Fuzzy Reasoning”. y). we also take for granted that there is an implicit monotonic relationship between the degree of satisfaction in the premise. Consider. Indeed. z) = y∈Y ((µR (x.2. see Figure 2. y) • µS (y.14) min-product composition: µT (x. However. Thus. z)) 2. deﬁned over the Cartesian space X × Z. or T = R ◦ S is most frequently declared in terms of a max-min.

• In short we need to deﬁne a scheme for expressing the resulting fuzzy set in terms of an appropriate ‘singleton’ or crisp scalar value. Single Rule with Single Premise: The premise simpliﬁes to the special case of a scalar thresholds. A → B. the compositional rule implies C = (A ×B )◦(A×B → C) or µB = w1 ∧w2 ∧µC (z) 3.13(a).13(c). and B a fuzzy set on Y. µR (x. The fuzzy proposition B’ induced by the premise “x is A’” and the fuzzy rule “if x is A then y is B” is deﬁned in the form of the fuzzy composition. µB (y) = x∈A ((µA (x) ∧ µR (x. Thus. or as per equation (2.15) • If we go on to assume the speciﬁc case of composition based on the Max-Min operator. y)) = max min [(µA (x).46 CHAPTER 2. is deﬁned in terms of a fuzzy relation R on the Cartesian product. 1.16) now applies. with the remaining problem of establishing what the fuzzy consequent actually means in practice.14). y)] x∈A (2. Implication. or µB = w ∧ µB (y) 2. Multiple Rules with Multiple Premises: The ‘max’ operator of equation (2. Figure 2.13(b). B = A ◦ R = A ◦ (A → B) (2. Consider the following three special cases.16) We are now in a position to build some reasoning engines. . thus the area of the implication is the maximum of each minimally thresholded premise. Single Rule with Multiple Premises: The premise simpliﬁes to the special case of the minimum of two scalar thresholds. Figure 2. Figure 2. NPC BEHAVIOURS USING RULE BASED METHODS Deﬁntion: Fuzzy reasoning Let A and A’ be fuzzy sets on the universe X. At this point we have the basis for fuzzy reasoning. X × Y. • This process is generally denoted defuzziﬁcation. then we have the special case of the above general model of fuzzy reasoning.

2.3. . (b).13: Fuzzy Reasoning: (a) Single Rule – Single Premise. FUZZY LOGIC 47 µ A A’ X min µ B Y B’ Fig(a) µ A A’ X µ B’ B Y µ C C’ min Z Fig(b) µ A1 A1’ X µ A2’ A2 µ µ B1’ B1 Y B2 µ C1 Z B2’ µ C2 Z max X Y min Fig(c) µ C’ Z Figure 2. Single Rule – Multiple Premises (c)Multiple Rules – Multiple Premises.

or a decrease/ increase in health/ energy. volume of voice.3.13 is in the form of the Mamdani model of inference. 2.5 Defuzziﬁcation Defuzziﬁcation is the process by which a fuzzy consequent is reduced to a singleton or crisp scalar value in order to provide an interface to a typically scalar ‘action’. Mamdani The derivation employed in Figure 2. or a low computational cost at the expense of a poor approximation relative to the properties of the consequent. Examples might include speed of movement. and y = f (x. NPC BEHAVIOURS USING RULE BASED METHODS 2. actions are typically associated with a scalar deﬁning a speciﬁc measurable property. however. or DomainM ax µ(z) · zdz ∗ z=DomainM in z × µ(z) z = ≈ DomainM ax (2. y) is the a priori deﬁned consequent polynomial. thus beneﬁting the typically real time nature of gaming applications. Kang .6 Fuzzy Inference Defuzziﬁcation is generally considered within the context of the inference system as a whole. The models are important as they potentially provide a signiﬁcant decrease in the complexity of the defuzziﬁcation process. In the next section we will consider a slightly diﬀerent approach to resolving the ‘defuzziﬁcation’ problem. and results in three typical cases: Mamdani. The ‘classic’ defuzziﬁcation operation takes the form of the center of gravity model. That is to say. That is to say. you are either faced with an accurate estimate at the expense of computational overhead. making the model too costly for consideration under a gaming context. or IF (x is A) and (y is B) THEN y = f (x. the cost of defuzziﬁcation will always be high.48 CHAPTER 2.3. As such.17) µ(z)dz z=DomainM in µ(z) Many other approaches exist (bisector of area. mean of maximum etc). Sugeno or TSK5 model of inference replaces the fuzzy consequent with a polynomial. 5 Takagi. Sugeno. Sugeno or Tsukamoto fuzzy inference. the basic tradeoﬀ remains the same. (angular) direction. y) where A and B are naturally fuzzy premises.

2.14 illustrates a ﬁrst order Sugeno fuzzy model (i. ..e.3. the consequent is deﬁned in terms of a ﬁrst order polynomial).15. In this case the consequent merely takes the form of a weighted average of the premises. Tsukamoto This model attempts to strike a balance between the simplicity of evaluation achieved in the Sugeno model (possibly at the expense of model transparency) and the evaluation overhead implicit in the Mamdani model by limiting the consequent to monotonic membership functions. As such conversion to a singleton again takes the form of a weighted average. Figure 2. Figure 2. FUZZY LOGIC 49 µ A1 µ B1 z1 = p1x + q1y + r1 µ A2 X µ B2 Y w1 z2 = p2x + q2y + r2 x X y Y min w2 z = w1z1 + w2z2 w1 + w2 Figure 2.14: Sugeno or TSK model of Fuzzy Inference.

NPC BEHAVIOURS USING RULE BASED METHODS µ A1 µ B1 w1 µ µ A2 X µ B2 Y z1 Z µ w2 z2 x X y Y min Z z = w1z1 + w2z2 w1 + w2 Figure 2.15: Tsukamoto model of Fuzzy Inference.50 CHAPTER 2. .

3. 10. • Medium range targets are most likely to be hit. very desirable>. thus. Basic factors we want to include in the decision making process might take the form of: the range to the target and available ammunition (I’m not making any claims as to the appropriateness of these factors!) and the consequent will be in the form of the desirability of using a rocket launcher. medium. these need interpreting within the context of fuzzy membership functions. or <undesirable. . as in the Tsukamoto model. Consider the case of designing a set of fuzzy rules for weapon selection in a ﬁrst person shooter game [3].2. 30>). • Long range targets will probably be able to ‘dodge’ the rocket. FUZZY LOGIC 51 2. Let us concentrate on one particular aspect. ok. Like any system for inference the assumed representation results in speciﬁc design tradeoﬀs that have both advantages and disadvantages. but others require that the underlying rules of the model be simpliﬁed ﬁrst. given that they are slow moving projectiles. Some of this can be dealt with by assuming an appropriate model of inference. or speciﬁc to a particular weapon. far>. In our role of domain ‘expert’ we make the following basic assumptions regarding the deployment of a rocket launcher. medium implies 150m. <0. this time for our conclusions.. Consequent Let us again assume a tuple. In the case of fuzzy inference – indeed any model of rule based reasoning – the complexity of the model can increase rapidly if speciﬁc attempts are not made to address the scalability problem.3. desirable. • Firing a rocket launcher for hand to hand combat is likely to result in ‘self annihilation’.7 Example: First Person Shooter weapon selection. plenty>. and far is anything after 300m. Let us consider the following design issues. Premise 2 – Available ammunition Again we might rely on a tuple.. where close implies ‘hand to hand’ combat. say <low. where the speciﬁc values associated with the maximization of the membership will probably need to be weapon speciﬁc (say. to use a rocket launcher or not to use a rocket launcher. Premise 1 – Target range Consider the tuple <close.. The above introduction to building a fuzzy inference system has concentrated on establishing the derivation of the basic system for inference. We now need to deﬁne the set of fuzzy rules to establish the decision making process of our character. Parameterization of which might be appropriate for characterizing the deployment of any weapon.. Naturally.

33 j wj Naturally. then from Figure 2. Thus. or • IF target close AND ammunition low THEN weapon undesirable • IF target close AND ammunition ok THEN weapon undesirable • IF target close AND ammunition plenty THEN weapon undesirable • IF target medium AND ammunition low THEN weapon desirable • IF target medium AND ammunition ok THEN weapon very desirable • IF target medium AND ammunition plenty THEN weapon very desirable • IF target far AND ammunition low THEN weapon undesirable • IF target far AND ammunition ok THEN weapon undesirable • IF target far AND ammunition plenty THEN weapon desirable Where this has the dual representation as a fuzzy associative memory.2 + 0.16 provides a forewarning of the complexity problem. in which the numerical value denotes the degree with which a property is measured relative to the current condition of the world. as the number of rules increases for a given set of variables we face a combinatorial increase in the number of resulting rules that require tests.33 × 15 i wi zi z= = ≈ 65.16. whereas for one more antecedent condition (again under a quantization into . Figure 2.67 × 98 + 0.67 + 0.17 we resolve the ‘desirability’ of the rocket launcher for the current condition. Speciﬁcally. under the above model there are a total of 9 rules for complete coverage. repeating this process over all weapon types and choosing the case with the largest desirability will establish the weapon of choice (what about ties?).52 CHAPTER 2.18) 0. Cdesirable and Cvery−desirable . The Fuzzy Associative Matrix of Figure 2. NPC BEHAVIOURS USING RULE BASED METHODS • How many rules will be necessary? • Is there an implicit rule ‘coverage’ requirement? One way of addressing these points is to ensure that all possible combinations of premise have a corresponding consequent. with consequent membership functions Cundesirable .75 (2. Assuming that we are employing a Tsukamoto model of inference.2 × 25 + 0. or 0.

0 Undesirable 0.2 Undesirable 0.0 Far Undesirable 0.2. .33 Desirable 0.67 Very Desirable 0.3. FUZZY LOGIC 53 Close µDistance Medium Desirable 0.0 Figure 2.2 Very Desirable 0.0 Low µAmmo OK Plenty Undesirable 0.0 Undesirable 0.16: Fuzzy Associative Matrix.

67 VDesirable Z 98 Z Figure 2.2 25 µ 0.54 CHAPTER 2.33 15 µ Desirable Undesirable Z 0. NPC BEHAVIOURS USING RULE BASED METHODS µ 0. .17: Resolution of Consequent conditions in Rocket Launcher Example.

3.. we rely on redundancy in the original relationship between antecedent and consequent. • When target close ammunition level is irrelevant. consequent is always ‘undesirable’. Sugeno or Tsukamoto). Thus.3.f. that we cannot resort to ‘simpliﬁcations’ of the form. FUZZY LOGIC 55 three membership functions) we have 29 rules. – The decree of redundancy present in the antecedent–consequent relations. consequent is ‘very desirable’. under such a simpliﬁcation we have a total of 5 rather than 9 rules to cover all scenarios. For the speciﬁc case of our rocket launcher example. Mamdani. the following simpliﬁcations are possible.8 Pragmatics • The most signiﬁcant limitation of the Fuzzy Systems approach lies in the scalability. Thus. . • When target medium and ammunition level is ‘ok’ OR ‘plenty’. • Scalability is a function of: – The number of antecedents and associated consequents. • When target far and ammunition level is ‘low’ OR ‘ok’.2. • When target medium and ammunition level is NOT ‘low’. then the rate of increase is also extends. • Why? 2. consequent is ‘undesirable’. Moreover.g. Note however. In order to mitigate against this eﬀect. if the number of membership functions increases. under 5 membership functions there are 25 and 125 rules respectively for complete coverage. [5]. Where this would be perfectly reasonable under classical binary logic. however. for more precision for example. consequent is ‘very desirable’. – The form of fuzzy inference and therefore the mode of defuzziﬁcation (c. – The utility of an appropriate learning algorithm for establishing the necessary rule base under problem dependent conditions e.

thus we will not consider it further here. However. there are also some fairly important caveats that impact on the generality of the method [7]. NPC BEHAVIOURS USING RULE BASED METHODS • One additional attempt at increasing the scalability of the Fuzzy System has been to use the ‘Combs Method’ of rule base simpliﬁcation.56 CHAPTER 2. .

[5] J. Bourg and Glenn Seemann. 67 . O’Reilly. MacMillan. Morgan Kaufmann. Fuzzy Logic with Engineering Applications. [9] D. 83(3):378–406. In Joost Raessens and Jeﬀery Goldstein. Neural Networks: A comprehensive foundation. Pattern Recognition and Machine Learning. Ross. Charles River Media. 1999. [11] Brian Schwab. 1994. 1995. Worldware Publishing. Programming Game AI by Example. pages 205–215. 2005. 1995. [6] John Laird and Michael van Lent. Hussain. R. Sun.-T. 7(3):369–371. Comments on “Combinatorial rule explosion eliminated by a Fuzzy Rule conﬁguration”. AI for Game Developers. 2006. McGraw Hill. Neuro-fuzzy modeling and control. 2005. [7] Jerry Mendel and Qilian Liang. McGraw Hill. chapter 13. [8] Ian Millington. 1994. AI Game Engine Programming. 2004. Bishop. [10] Timothy J. M. [3] Mat Buckland. [4] Simon Haykin. Handbook of Computer Game Studies. MIT Press. [2] David M. 2004. Springer Verlag. editors. 2006. Proceedings of the IEEE. Partridge and K. IEEE Transactions on Fuzzy Systems. Jang and C.-S. Artiﬁcial Intelligence for Games.Bibliography [1] Christopher M. Knowledge Based Information Systems. The role of artiﬁcial intelligence in computer game genres.

fuzzy

fuzzy

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue listening from where you left off, or restart the preview.

scribd