i have a new kind of AI behavior i want, that i've never needed before:
"do normal AI, while avoiding an area"
the specific case is doing normal predator or non-predator animal AI in Caveman 3.0 while staying away from campfires.
i discovered that "campfire nearby" and "taking missile fire" are not mutually exclusive conditions, and therefore require separate AI variables to avoid conflicts. so a change to the "flee from campfire" code is called for.
off the top of my head, it would seem that after deciding on a "move" the AI would have to then check to see if that "move" would place it near a campfire. if so, it would have to choose something else to do.
but the more possible "moves" the AI has, the more checks are required. skyrim has one type of AI (hostile) with two basic moves: attack and flee. caveman has at least a few more than that - perhaps as many as six different possible moves each for about six different types of AI. it would be a whole lot nicer if i could do one check in one place, rather than 36 checks in 36 places.
simply having an animal flee if withing 50 of a fire results in the critter oscillating between flee and close at a range of 50 feet, assuming their target is near the fire.
using a flag or state variable to flee at 50 and stop fleeing at 75 (or whatever) results in oscillations back and forth at ranges of 50 and 75 feet.
is one check per possible move the best approach, or should i go to a lower level and prevent targeting of entities near campfires altogether, or something else? is a separate AI state for "i can approach no closer" behavior required?
as i said, i've never had to write "avoid area" behavior AI code before - flee from area, yes. but avoid area while doing other stuff - no. so whats the easiest way to do this?
i want to keep it as simple as possible.
EDIT:
simply ignoring targets near a fire won't necessarily work. if the target is not near a fire, and the critter should flee from the target, away from the target might be towards a fire.