Using a simpler approach

If you choose to stick with a simple evaluation of the crisp output, in other words, not specifically a tree or an FSM, you can use more Boolean operators to decide what your agent is going to do. The pseudo code would look like this:

IF health IS critical AND mana IS plenty THEN cast heal 

We can check for conditions that are not true:

IF health IS critical AND allies ARE NOT close THEN cast heal 

We can also string multiple conditions together:

IF health IS critical AND mana IS NOT depleted AND enemy IS very strong THEN cast heal 

By looking at these simplified statements, you will have noticed yet another "happy bonus" of using fuzzy logic—the crisp output abstracts much of the decision-making conditionals and ...

Get Unity 2017 Game AI Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.