Summary

Fuzzy logic represents concepts such as low health, medium threat, or high desirability as degrees of membership rather than as hard yes/no categories. In games, that makes it useful for AI decisions that should feel smooth and human-like instead of brittle. (Millington, Artificial Intelligence for Games, see source-artificial-intelligence-for-games; Buckland, Programming Game AI by Example, see source-programming-game-ai-by-example)

Key ideas

  • Fuzzification: convert crisp input values into memberships such as Low, Medium, High.
  • Rules: combine memberships into conclusions.
  • Defuzzification: turn the fuzzy result back into a usable crisp output.

Example rule:

  • If health is Low and enemy pressure is High, retreat desirability is Very High.

In practice

float LowHealth(float health01) => Mathf.Clamp01((0.4f - health01) / 0.4f);
float HighThreat(float threat01) => Mathf.Clamp01((threat01 - 0.5f) / 0.5f);
 
float RetreatScore(float health01, float threat01)
{
    float lowHealth = LowHealth(health01);
    float highThreat = HighThreat(threat01);
    return Mathf.Min(lowHealth, highThreat);
}

This is not a full fuzzy engine, but it captures the practical point: avoid hard jumps when the decision should scale smoothly.

Evidence

  • Millington presents fuzzy logic as a useful decision layer because many game concepts are inherently graded rather than binary.
  • Buckland shows how fuzzy conclusions can be combined and then defuzzified into crisp action values for practical agent decisions.

Implications

  • Fuzzy logic is especially good for desirability scoring, weapon choice, aggression level, retreat timing, and other continuously varying decisions.
  • It pairs naturally with utility-ai because fuzzy memberships can feed into utility curves.

Open questions

  • When is fuzzy logic clearer than a hand-authored curve in a utility system?
  • How much fuzzy tooling is worth building for a student Unity project?

utility-ai · game-ai-agent-design · ai-state-machine-pattern · source-artificial-intelligence-for-games · source-programming-game-ai-by-example