Author Topic: Opportunity based melee attack system  (Read 579 times)

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5238
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #15 on: February 28, 2017, 08:49:41 PM »
I'd prefer this kind of thing too, but it's about 20x as much work to make it work like this (that's my actual estimate, not hyperbole), and since I'm not the one stepping up to write it, there's only so much I can insist on.  IMO a cooldown gets us 60-80% of the behavior we want with 5% of the work.

I'd disagree about that estimate: cooldown would get us a lot of behavior, but it would eventually turn into a lot of work if we were to combine it with automatic selection.
I don't follow, attacks that are cooling down wouldn't be added to the list of available attacks, it couldn't be simpler from that angle. I could definitely be missing something though.
By adding cooldowns to that, we now force the player to micromanage around the AI <examples>
This is a good point and an unintended side effect of the cooldown approach.

The thing I'm trying to prevent is that random variations with no cooldown will do one of two things.
1. Execute the same attack every time if the difference between the best and next best attack is larger than the random variation. (Also applies to each additional attack option, there will be a strong bias toward the top few attacks).
2. Sometimes nerf the best attacks so much that an extremely suboptimal attack is executed repeatedly, leading to YASD because damage output is so unreliable.

I don't think it's too hard to work around this, but we need to be clearer about our goals as opposed to the mechanisms we're using.

By having only move cost, accuracy, and damage (clipped to monster's current hp) to care about, the simple AI system could easily make best decisions in vast majority of cases, whether player was in a serious fight or just otab-ing through a dungeon. This would mean that the player wouldn't need to "switch to manual" often, saving us a great deal of UI, which we all hate to write and use.
This bias toward damage over time would lead to non-damage-dealing attacks not being worthwhile.  Even if you switch modes and consider only attacks that cripple, delay, or deal other status effects, only the ones that deal the most damage would actually execute.  I don't want to sacrifice more interesting kinds of attacks in order to add more variation in just damage dealing attacks.

There's a straightforward solution though, instead of filtering the list, alternate attack modes could change the evaluation function that selects the best attack.  "Delay" mode could evaluate based on chance-to-delay, expected delay, and move cost.
Its like a fun family cookout, except your family is burning in flames while trying to eat you. -secretfire
I'm more excited than a survivor on meth and toast'ems. -Nighthawk
The the giant wasp is slammed through the zombie brute!

Online Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3485
    • View Profile
Re: Opportunity based melee attack system
« Reply #16 on: February 28, 2017, 10:05:54 PM »
This could get complex fast, but I'm afraid it has to - avoiding manual control isn't easy.

The weight change of effects would probably have to depend on the target. Otherwise the player would need to switch to aggressive to attack hulks, then back to defensive in the next turn, thus defeating the whole point of modes.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: Opportunity based melee attack system
« Reply #17 on: February 28, 2017, 10:16:47 PM »
I'd prefer this kind of thing too, but it's about 20x as much work to make it work like this (that's my actual estimate, not hyperbole), and since I'm not the one stepping up to write it, there's only so much I can insist on.  IMO a cooldown gets us 60-80% of the behavior we want with 5% of the work.

I'd disagree about that estimate: cooldown would get us a lot of behavior, but it would eventually turn into a lot of work if we were to combine it with automatic selection.
I don't follow, attacks that are cooling down wouldn't be added to the list of available attacks, it couldn't be simpler from that angle. I could definitely be missing something though.
By adding cooldowns to that, we now force the player to micromanage around the AI <examples>
This is a good point and an unintended side effect of the cooldown approach.

The thing I'm trying to prevent is that random variations with no cooldown will do one of two things.
1. Execute the same attack every time if the difference between the best and next best attack is larger than the random variation. (Also applies to each additional attack option, there will be a strong bias toward the top few attacks).
2. Sometimes nerf the best attacks so much that an extremely suboptimal attack is executed repeatedly, leading to YASD because damage output is so unreliable.

I don't think it's too hard to work around this, but we need to be clearer about our goals as opposed to the mechanisms we're using.

By having only move cost, accuracy, and damage (clipped to monster's current hp) to care about, the simple AI system could easily make best decisions in vast majority of cases, whether player was in a serious fight or just otab-ing through a dungeon. This would mean that the player wouldn't need to "switch to manual" often, saving us a great deal of UI, which we all hate to write and use.
This bias toward damage over time would lead to non-damage-dealing attacks not being worthwhile.  Even if you switch modes and consider only attacks that cripple, delay, or deal other status effects, only the ones that deal the most damage would actually execute.  I don't want to sacrifice more interesting kinds of attacks in order to add more variation in just damage dealing attacks.

There's a straightforward solution though, instead of filtering the list, alternate attack modes could change the evaluation function that selects the best attack.  "Delay" mode could evaluate based on chance-to-delay, expected delay, and move cost.


From one side: why would one actively engage in mortal combat with an enemy if not to neutralise them as quickly and efficiently as possible? Choosing to cripple your opponent over dealing immediate lethal damage is pretty much absurd. Landing a crippling strike 'may' be useful when you know you can't deal enough damage to your opponent in a short time frame (swarmed from every side) or when you know that there is no way that you could harm your opponent (insanely armoured) but then why wouldn't you just run in the first place... seems like an error in judgement from the start. So that's probably why the game should always prioritise maximum damage/accuracy because it expects you to know better not to engage in combat you aren't going to win.

However, there 'could' be some attacks in 'some' very specific and rare situations which stat-wise don't do a lot of damage but would debuff the opponent to take more damage from there on. Such a strike would probably be much weaker damage-wise than a full broadsword swing to the dome piece, but cumulatively allow to stack more damage on your opponent than if you'd just be swinging at it wildly. Or of course you may want to cripple a zombie's legs while he's in a doorway to stop the horde from catching up. Another lower dmg attack would be one that is focused on penetrating armour (precise stab between the plates doesn't have as much punch behind the swing)  which might be more useful in a specific combat situation vs a tanky enemy.

For general-purpose combat versatility, damage/accuracy is still preferred

Online Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3485
    • View Profile
Re: Opportunity based melee attack system
« Reply #18 on: February 28, 2017, 10:24:04 PM »
From one side: why would one actively engage in mortal combat with an enemy if not to neutralise them as quickly and efficiently as possible?

Stunlocking+knockbacklocking hulks is an overpowered technique. While it isn't supposed to be treated as a proper tactic here, the combat AI system should, where possible, allow efficient "mashing", without player having to constantly click through menus.
Similar for the acid zombies, which are better disabled and killed in 4 turns than killed in 2 turns with one of those turns spent under their attack.
So the ability to prioritize debuffs and mobility would be helpful.

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5238
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #19 on: March 01, 2017, 02:48:28 AM »
From one side: why would one actively engage in mortal combat with an enemy if not to neutralise them as quickly and efficiently as possible?
Neutralization doesn't require killing for one, if your actual goal is to run away it's a hell of a lot easier to trip an opponent and run than to kill them.
Another is effort expended, if you need to make a single low-effort attack to neutralize an opponent for long enough to escape, that conserves energy for escaping and neutralizing other opponents.
Another is dealing with multiple opponents, it might be feasible to temporarily incapacitate several opponents for long enough to deal with one of their allies, but if you tried to kill the first outright it's allies could get some hits in.
In our particular scenarios, these effects are even more exaggerated, because some opponents are relatively easy to incapacitate temporarily, such as by tripping a zombie, but at the same time are more durable than humans, such that one-shot kills are difficult or impossible to perform.
Choosing to cripple your opponent over dealing immediate lethal damage is pretty much absurd. Landing a crippling strike 'may' be useful when you know you can't deal enough damage to your opponent in a short time frame (swarmed from every side) or when you know that there is no way that you could harm your opponent (insanely armoured) but then why wouldn't you just run in the first place... seems like an error in judgement from the start. So that's probably why the game should always prioritise maximum damage/accuracy because it expects you to know better not to engage in combat you aren't going to win.
In other words, if you make such an error in judgement, the system should just abandon you to your fate? In case it's not clear, rhetorical question, it shouldnt.
Its like a fun family cookout, except your family is burning in flames while trying to eat you. -secretfire
I'm more excited than a survivor on meth and toast'ems. -Nighthawk
The the giant wasp is slammed through the zombie brute!

Offline Michi

  • Zombie Food
  • *
  • Posts: 79
    • View Profile
Re: Opportunity based melee attack system
« Reply #20 on: March 04, 2017, 07:23:46 PM »
I love everything I am reading here, because as a few of you have mentioned, combat is not very nuanced right now.

My only insight comes from the existing special attacks some weapons have combined with what I have seen from the martial arts stuff.

Basically, I am making one choice. What weapon am I using - does it have some useful special effects, and does it interact with the martial arts style. After that, the game takes over, and I dont know about everyone else, I don't even look at eh scrolling text to see if I did a fast strike or a block or whatever, I just keep an eye on my health and if the mob died.

Having the player be able to make choices right before a fight and during the fight would make the combat more interesting, whereas adding more possibilities solely controlled by the AI without meaningful interaction by the player won't add a lot to the current system, IMHO. Just more text to scroll by during combat. At the same time, I definitely don't want something that would being overly cumbersome when I need to, say, clear out a school.

The stances idea is step towards player interactivity, but I see people choosing offense 90% of the time, and then defense when stamina is down and no chance of running away.



Online Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3485
    • View Profile
Re: Opportunity based melee attack system
« Reply #21 on: March 04, 2017, 09:08:01 PM »
Having the player be able to make choices right before a fight and during the fight would make the combat more interesting, whereas adding more possibilities solely controlled by the AI without meaningful interaction by the player won't add a lot to the current system, IMHO.

Even the AI possibilities would actually add a lot, though not directly during the fight but rather during preparations.
Choices such as leaving a free hand vs. 2h weapon, lighter armor for more special attacks or heavier for more reckless weapon attacks, perception for special effects or dexterity/strength for pure damage.
Then, during fight, those choices would influence the fighting style: kiting, standing and smashing, getting 3 zombies lined up for area attacks.

If we want something more complex, I'd consider adding Sil-like conditional attacks on movement. For example, a martial art could have a free sweep when moving past a zombie, a hard punch executed only after moving towards target (this one would combo nicely with stacking bonus, so that you'd move from zed to zed only to keep executing charge punches), or a prepared attack against first approaching target in given turn.

I'd rather avoid player choice being made mostly through mode switching and specific commands, because that's UI stuff and could get tedious fast.
Once in a while would be fine, but I'd prefer to keep it from turning into "go offense until tired, go defense on retreat, go offense until tired". It would be less bad to keep it all offense all the time to be honest.

Examples of good choices I see:
  • The aforementioned charge attack, attack in passing, attack when disengaging and prepared attack
  • Attack that can be executed only after not attacking for a turn
  • Penalty applied to every target you move past (ie. start and end movement adjacent to)
  • A group attack when you and a NPC hit the same target. Or possibly you and a dog.
  • Attack that requires the target to have a wall behind it
  • Other terrain dependent attacks - curbstomping

Anything that doesn't require the player to say "I want to do exactly that" instead of "I know there is a smart thing to do here, do that".

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5238
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #22 on: March 05, 2017, 09:06:03 PM »
Even the AI possibilities would actually add a lot, though not directly during the fight but rather during preparations.
Choices such as leaving a free hand vs. 2h weapon, lighter armor for more special attacks or heavier for more reckless weapon attacks, perception for special effects or dexterity/strength for pure damage.
Then, during fight, those choices would influence the fighting style: kiting, standing and smashing, getting 3 zombies lined up for area attacks.
This goes far beyond the damage over time evaluation you were talking about, and starts evaluating the player's health and armor, as well as the attack potential of nearby enemies.  This is way too much AI.
If we want something more complex, I'd consider adding Sil-like conditional attacks on movement. For example, a martial art could have a free sweep when moving past a zombie, a hard punch executed only after moving towards target (this one would combo nicely with stacking bonus, so that you'd move from zed to zed only to keep executing charge punches), or a prepared attack against first approaching target in given turn.
That kind of thing is attractive when your goal is to build an immersive fighting system, but it's just another form of micro-management, you still have to do specific things to trigger your special attacks. It also ends up driving the combat system, because options like delay, cripple, evade don't necessarily map well to a movement-based system like that.
I'd rather avoid player choice being made mostly through mode switching and specific commands, because that's UI stuff and could get tedious fast.
Once in a while would be fine, but I'd prefer to keep it from turning into "go offense until tired, go defense on retreat, go offense until tired". It would be less bad to keep it all offense all the time to be honest.
I agree that the frequency of adjustments needs to be low, and for the vast majority of encounters (routine one where you're in no real danger, and even non-routine encounters where you can defeat each opponent before being attacked by a new one), you would just keep it at damage-offense, but I want there to be options for when you are dealing with too many opponents, or need to retreat from an encounter, and when to switch from offense to defense, or when to use tactical options like delay or crippling attacks.
Examples of good choices I see:
  • The aforementioned charge attack, attack in passing, attack when disengaging and prepared attack
  • Attack that can be executed only after not attacking for a turn
  • Penalty applied to every target you move past (ie. start and end movement adjacent to)
  • A group attack when you and a NPC hit the same target. Or possibly you and a dog.
  • Attack that requires the target to have a wall behind it
  • Other terrain dependent attacks - curbstomping
Again, this kind of thing is immersive, but it can't change the kind of attack being made, because if they do, it risks having players accidentally trigger suboptimal attacks that can get them killed.
Fundamentally, if there is a really interesting difference between attack types, the decision to use one or the other MUST be explicit.
Anything that doesn't require the player to say "I want to do exactly that" instead of "I know there is a smart thing to do here, do that".
Attack goals have the property you're asking for, you're asking for a general class of behaviors, not a specific one.
« Last Edit: March 05, 2017, 09:54:55 PM by Kevin Granade »
Its like a fun family cookout, except your family is burning in flames while trying to eat you. -secretfire
I'm more excited than a survivor on meth and toast'ems. -Nighthawk
The the giant wasp is slammed through the zombie brute!

Offline Rivet

  • Administrator
  • Survivor
  • *****
  • Posts: 2658
  • C:DDA Developer
    • View Profile
    • Rivet's Git profile
Re: Opportunity based melee attack system
« Reply #23 on: March 05, 2017, 09:39:34 PM »
Worth the effort?

Very worth the effort.
“No! I must kill the demons” she shouted
The radio said “No, Rivet. You are the demons”
And then Rivet was a zombie.

Online Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3485
    • View Profile
Re: Opportunity based melee attack system
« Reply #24 on: March 05, 2017, 10:24:13 PM »
This goes far beyond the damage over time evaluation you were talking about, and starts evaluating the player's health and armor, as well as the attack potential of nearby enemies.  This is way too much AI.

I mean the player setting those up and AI only caring about what it can predict. For example, putting on a heavy armor would slow down all attacks by a flat amount, so fast attacks would suffer more than slow ones. This in turn would make the AI pick "huge axe slam" more often than "elbow strike".

Quote
That kind of thing is attractive when your goal is to build an immersive fighting system, but it's just another form of micro-management, you still have to do specific things to trigger your special attacks.

Then scrap (or just "move back") those that make it more tedious and just keep those which offer tactical advantages. For example, moving past a critter and executing a totally bland, regular, unbuffed attack for free (but full move price for moving) would not be any more micromanagement than regular combat with kiting - in fact less.
Still, I'd rather at least try to make it work than instantly going for manual selections on everything. Maybe it's easier than it sounds?

Quote
It also ends up driving the combat system, because options like delay, cripple, evade don't necessarily map well to a movement-based system like that.

It would synergy with those pretty well: if you had free attacks on disengage, the evade option would push stuff back, while attack option would hurt things.

Quote
I want there to be options for when you are dealing with too many opponents, or need to retreat from an encounter, and when to switch from offense to defense, or when to use tactical options like delay or crippling attacks.

This should be treated as necessary evil and avoided where not necessary. For example, by limiting the number of modes and keeping them in the same menu as martial arts (as in, "offensive" would be a martial art).
Crippling, avoiding and delaying could easily be one mode (defensive).

Quote
Fundamentally, if there is a really interesting difference between attack types, the decision to use one or the other MUST be explicit.

To some degree yes, but a lot could be done by stretching the implicitness of them.
Combining with movement, involving pauses, depending on surroundings - in the end pure DPS should be reserved for endgame characters who can afford to stand around and mash tab.

Offline pisskop

  • Survivor
  • ***
  • Posts: 3210
  • Closet Brute
    • View Profile
Re: Opportunity based melee attack system
« Reply #25 on: March 06, 2017, 12:14:17 AM »
just putting it out there that tracking which way a critter is facing based on last movement direction or turning to do something (defend) would be nice.

and then we could add in things like light directions and back attacks and stealth

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5238
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #26 on: March 06, 2017, 03:17:17 AM »
This goes far beyond the damage over time evaluation you were talking about, and starts evaluating the player's health and armor, as well as the attack potential of nearby enemies.  This is way too much AI.

I mean the player setting those up and AI only caring about what it can predict. For example, putting on a heavy armor would slow down all attacks by a flat amount, so fast attacks would suffer more than slow ones. This in turn would make the AI pick "huge axe slam" more often than "elbow strike".
What I ws reacting to was
Quote
heavier for more reckless weapon attacks
, which seems to indicate that more armor means "it's ok to make reckless attacks", which is fundamentally not something a system like this should be making.  I guess you mean something like, "slower attacks will be impacted less by encumbrance, so as you add more armor they become more optimal".  If that's the case I was just reading too much into your statement  and there's no problem.

Taking a step back, I want to reiterate that I think the overall plan is a good one for increasing variability of combat from both an effectiveness and narrative point of view, as well as adding strategic depth around equipment selection.  My only concern is it leaves tactical depth behind if the primary goal of attacks is always damage.
Quote
That kind of thing is attractive when your goal is to build an immersive fighting system, but it's just another form of micro-management, you still have to do specific things to trigger your special attacks.

Then scrap (or just "move back") those that make it more tedious and just keep those which offer tactical advantages. For example, moving past a critter and executing a totally bland, regular, unbuffed attack for free (but full move price for moving) would not be any more micromanagement than regular combat with kiting - in fact less.
Still, I'd rather at least try to make it work than instantly going for manual selections on everything. Maybe it's easier than it sounds?

Quote
It also ends up driving the combat system, because options like delay, cripple, evade don't necessarily map well to a movement-based system like that.

It would synergy with those pretty well: if you had free attacks on disengage, the evade option would push stuff back, while attack option would hurt things.
Right, if you have both a goal set and movement-based modifiers, they will work just fine, I was pointing out that just a movement-based attack system doesn't have a good way to specify flavors of attacks, so it needs something else to do that.  Both would be ust fine.
Quote
I want there to be options for when you are dealing with too many opponents, or need to retreat from an encounter, and when to switch from offense to defense, or when to use tactical options like delay or crippling attacks.

This should be treated as necessary evil and avoided where not necessary. For example, by limiting the number of modes and keeping them in the same menu as martial arts (as in, "offensive" would be a martial art).
Crippling, avoiding and delaying could easily be one mode (defensive).
I don' think the goals as martial arts thing works, because that implies that martial arts are also goals, which is WAY too many of them.  I'd prefer them to remain orthoganal, with styles augmenting the list of attacks one can make, and goals changing the evaluation function for attacks that are available.
While delaying and evading could be merged (minimal effort to neutralize enemies for short durations and forcing enemies to waste moves have the same outcomes), crippling would be different.  IMO the minimal set of goals would be damage, cripple, delay.  Aother fundamental attack type is move, but I'm not sure that can be handled the same way.
Quote
Fundamentally, if there is a really interesting difference between attack types, the decision to use one or the other MUST be explicit.

To some degree yes, but a lot could be done by stretching the implicitness of them.
Combining with movement, involving pauses, depending on surroundings - in the end pure DPS should be reserved for endgame characters who can afford to stand around and mash tab.
So to clarify a few things, I'm only looking for ~3 goal settings, and this set of features or the goal setting thing could go in first, both IMO advance melee significantly.
Its like a fun family cookout, except your family is burning in flames while trying to eat you. -secretfire
I'm more excited than a survivor on meth and toast'ems. -Nighthawk
The the giant wasp is slammed through the zombie brute!