View Single Post
Old 02-22-2005, 11:45 AM   #1
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
A combat-related problem I've come across recently is that of deadlock - two creatures fight each other, but neither can win. For example, a skeleton fighting a swarm of killer bees:

The skeleton draws its longsword with its right hand.
The skeleton unslings its target shield from across its back with its left hand.

The swarm of killer bees fly around the skeleton, buzzing angrilly.
The skeleton ignores the bees.

The skeleton slashes at the swarm of killer bees with its longsword.
Its blade passes harmlessly through the swarm of killer bees.

The swarm of killer bees fly around the skeleton, buzzing angrilly.
The skeleton ignores the bees.


In theory the skeleton might kill one or two, but not enough to make any real difference to the bees. Equally, the bees can't exactly sting the skeleton to death, as their poison doesn't affect it, and their stings aren't strong enough to do any real damage.

I suppose you could argue that, eventually, the skeleton would kill the bees, or they'd give up and leave of their own accord (although with the skeleton constantly provoking them I've no idea how long that would take). But the same problem applies to other scenarios as well - eg:

The zombie throws a clumsy left punch at the wraith's stomach.
Its fist passes harmlessly through the wraith.

The wraith reaches towards the zombie with its left hand.
The zombie ignores the wraith's chilling touch.

The zombie says, 'Braaaaaiiiinnnsssss.'

The zombie snaps at the wraith with its powerful jaws.
Its bite passes harmlessly through the wraith.


In this case, neither the zombie nor the wraith are likely to give up, as both are mindless undead.

One option might be to say that mobs can recognise when a fight is futile, and walk away - but what about scenarios where the mobs have been deliberately ordered to fight? For example, in a magical duel Bubba the Pyromancer might call forth a powerful fire elemental to attack Boffo the Demonologist. Boffo might then respond by summoning a balrog to keep the fire elemental at bay - as both mobs use fire magic and are immune to fire magic, neither could hurt the other. But as the elemental has to get past the balrog to complete its orders, and the balrog has to kill the elemental to complete its orders, they can't very well just wander off.

In the case of summoned mobs, they could likely be held in place by a limited duration on their summoning. But what about mobs that are being controlled?

The best approach I can think of is to say that if two mobs cannot hurt each other, they will ignore each other, unless being controlled (in which case they will attempt to fight for the duration of that control).

But what about scenarios where one mob can hurt the other, but that other mob can't hurt them back? A swarm of bees cannot hurt a fire elemental, but the fire elemental could certainly destroy the bees. A goblin cannot hurt a wraith, but that wraith could easily drain the life from the goblin. And so on.

Thus I propose that mobs respond to an attacker they cannot defeat based on their intelligence level, as follows:

1) Mindless mobs (skeletons, golems, etc) ignore attackers they can't hurt, going about their business as usual.

2) Mobs with animal-level intelligence flee attackers they can't hurt.

3) Smart (human-level intelligence) mobs flee non-smart mobs they can't hurt (they know they'll get no mercy from a big green slimy blob).

4) Smart mobs attempt to surrender to or beg mercy from smart mobs they can't hurt, and flee if that fails to work.

However there may be some exceptions to the above, based on skills and knowledge. A human with some sort of animal empathy ability might try to use that before fleeing a rabid wolf, while that same human - having just witnessed a vampire massacre his entire village - might decide to skip the begging and go straight for the fleeing.

Then of course there's the motivational aspects to consider. It's seems reasonable for skeletons and wraiths to ignore each other, but what about mobs that have no real reason for knowing they can't hurt their opponent? Imagine a big slimy blob that homed in on vibrations, covering (and killing) most creatures. What would it do when it encountered an acid-proof golem? Just cover it and effectively follow it around? That could get pretty annoying as well, as the golem might end up collecting a huge following of such creatures.

There's also other problems to consider when it comes to smart mobs - the villagers may not be able to kill the vampire themselves, but perhaps they know the local church has a supply of holy water. Should the smart mobs therefore take that into consideration, and flee for the church? What if they have to go through other dangers to reach the church?

A typical villager or citizen would probably just want to get away, while a warrior would be more interested in arming themselves appropriately and coming back - for most cases this could simply be represented by a "wolf or sheep" boolean flag, i.e., do they have the fighting spirit or not?

But even that isn't going to hold true in all situations, nor does it account for the fact that smart mobs might choose to sacrifice themselves. A villager protecting their family might well come back once properly armed, or even throw themselves into a fight they knew they couldn't win, just to give their loved ones time to escape. Come to think of it, certain animals might do the same as well (eg those with young to protect). Equally, even some seasoned soldiers might decide to flee rather than fight a battle they probably couldn't win. Perhaps some sort of courage rating, adjusted by circumstances, might do the job...

But all of this ends up adding a large amount of complexity to a relatively simple problem. Thus I'd propose simplifying the process down to the following:

1) If you're being controlled, or are berserk/frenzied, you attack regardless of the situation, otherwise:

2) If you can't hurt your opponent, and you're both smart, and they are not 'merciless' (a reputation-based flag) or berserk, you surrender, otherwise:

3) If you can't hurt your opponent, you flee (or ignore them if you're mindless).

4) If you're fleeing, and you know about an appropriate counter-measure for the attacker, you head towards the location required to achieve that counter-measure (which might typically involve passing the attacker information to another mob - eg specialised cityguard).

Any special cases (animal empathy on the rabid wolf, hiding in the forest because you've got a high stealth skill, etc) should be exceptions outside of the standard approach.

Such a system could later be tweaked to supply more believable behaviour - for example, you could give each mob a 'will to fight' stat based on the situation, ranging from 0% (you've no wish or reason to fight) to 100% (you're fighting to protect loved ones). Smart or animal-intelligence mobs could then use the 'will to fight' to determine when they've had enough of the fight, with the typical citizen running off to find a cityguard straight away, the cityguard running off to find the elite guard after a severe beating, etc.

Thoughts?
KaVir is offline   Reply With Quote