O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a fuzzy logic for decision making

Fuzzy logic presents a way to move from exact reasoning of Boolean logic to an approximation of a truth value, whereas Boolean logic uses a binary set of true or false values; fuzzy logic can operate anywhere between these two values.

This can be used to deal with situations where you can't be 100 percent sure about the result. Many modern games use this to make autonomous NPCs or intelligent enemies that can accommodate their actions to the current situation or environment.

This recipe will use a simplistic version of the fuzzy inference system with a fixed number of value points. It's not as precise as the professional grade fuzzy inference systems, but still performs well enough to be used in games.

The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required