clintbellanger / flare

Free Libre Action Roleplaying Engine
http://clintbellanger.net/rpg/
GNU General Public License v3.0
166 stars 41 forks source link

Ranged enemy behavior (chance_flee) #872

Closed makrohn closed 11 years ago

makrohn commented 12 years ago

How difficult would it be to make an enemy without melee powers remain at ranged distance? Let's pretend an enemy with melee_range=152 (I'm using goblin shaman here) liked to stay at melee_rage*2, or 304 pixels away from the hero. Or, if the hero closed ranks with the shaman, there was a certain chance (maybe just chance_pursue) it'd run away to start flinging spells again?

I'm mostly thinking about this because I've deliberately put in some enemies without melee attacks into Polymorphable, and once they close ranks, they become harmless. I could give them a melee power, but I like the idea of having to chase them down, and I think it'd add a lot of spice to combat.

clintbellanger commented 12 years ago

I do want to add a chance_flee, that is a similar behavior value to chance_pursue.

The way it would work: if the hero is in melee range, there's a chance each frame that the creature would turn around and run in the opposite direction.

The tricky part is how to do that pathfinding. Should the enemy choose a target square to run to, or simply run away from the player (even if it runs into walls?), or run in a random direction?

stefanbeller commented 12 years ago

I would not like to see enemies running into walls or dead ends, but this would indeed require some pathfinding. Maybe a pathfinding to the next similar enemy, i.e. a goblin runs to other goblins for help? If there are no other enemies found in the pathfinding range, maybe just flee opposite direction to the player if there is enough space ( i.e. no wall within the next few tiles). If there are so many obstacle, either run around or flee accross the whole map?

clintbellanger commented 12 years ago

It could depend on whether the running away represents the creature being scared. If so, it could be fine for them to run into dead-ends. Then such behavior could be triggered by a e.g. Fear spell. But maybe that could be handled separately (scared flee vs. strategic flee).

makrohn commented 12 years ago

So, by your implementation idea, Clint, a "ranged only" enemy would simply have a chance_flee=100 (or maybe chance_flee=75 so the hero at least has a chance to get a swing in)?

makrohn commented 11 years ago

Migrated to https://github.com/clintbellanger/flare-engine/issues/103