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

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3551
    • View Profile
Opportunity based melee attack system
« on: February 26, 2017, 07:28:07 AM »
Our current melee system is pretty simple: when you attack, you attack with currently wielded weapon. Then you get bonus attacks due to mutations (if you have them).

How about this:
  • When attacking, game enumerates all possible attacks
  • Some of them are pretty weak most of the time: headbutts, elbow strikes, pistol whips
  • The attacks get some random permutation to accuracy/expected damage every time
  • The effectiveness of attacks is evaluated based on enemy (for example, armor is subtracted from damage)
  • Attacks are weighted somehow: usually just by DPS, but sometimes by being finishing strikes (dropping monster to 0 hp or less) or special effects
  • Best one is picked and executed

The advantages are:
  • Natural execution of ideas like kicks, weird martial art tricks and so on
  • Sensible dual wielding: not double damage at extra move cost or anything, just more opportunities for attacks
  • When wielding an unwieldy item (tank full of water), you no longer become very vulnerable - you can now kick and maybe even bite
  • Mutations don't need to grant extra attacks, just modify existing ones (beak is just mutant bite, horn headbutt is just mutant headbutt, claw strike is just human scratch turned not-useless)
  • Naturally extends to multiple attacks per weapon, such as haft strikes and halberd chop/thrust/hook
  • One-handed weapons have the advantage of keeping a hand free for off-hand strikes

Disadvantages are:
  • Complexity in implementation
  • Complexity in understanding without a good UI showing all the chances

DF has something relatively similar.

Worth the effort?
Of course this is a post-0.D idea, there is no way it is going to be in this stable.

Offline Noctifer

  • Survivor
  • ***
  • Posts: 2530
  • Evening Star
    • View Profile
Re: Opportunity based melee attack system
« Reply #1 on: February 26, 2017, 08:09:07 AM »
How about martial arts shifting the focus? Some will give priority to damage-per-hit while other prioritise fast attacks or dodge/block.
May mother Venus guide us all!

...Noctifer's incredibly loot bloated Survivor Emcampments™...

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3551
    • View Profile
Re: Opportunity based melee attack system
« Reply #2 on: February 26, 2017, 08:29:20 AM »
I'd prefer the AI attack selecting part not to be tied too much to in-game mechanics.
If martial arts become a problem, I'd rather add a menu to allow disabling certain attacks.

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5308
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #3 on: February 27, 2017, 03:04:29 AM »
I think it's a great idea, it improves melee combat in several ways:
  • More varied combat descriptions.
  • If done well, will apply flavors to combat, in that you would tend to use different sets of attacks against different enemies.
  • More variance in how combat plays out since different attacks might inflict wounds or conditions in addition to straight damage.  For example if you end up immobilizing a target, you might move away from them and then mop them up later.  Even short of that, breaking the predictability of "X strikes to kill a zombie" would be worthwhile.
  • If we come up with actual logic behind when enemies are vulnerable to different attacks, we can just add it without changing player behavior or the UI

Side note, I'm strongly against anything resembling df's UI for combat.  The underlying system is ok, but the micromanagement of combat is horrific.  This system seems like it's grabbing just the good parts, so this is intended more for commenters than Coolthulu.

Some extensions, not necessary for a v1:
As opposed to any kind of player or martial art black/white -listing, I'd prefer to see attacks (defined in json of course) with one or more attributes stating the "goal" of the attack, such as "damage", "crippling", "defense", "avoidance", "delaying", "stunning".  The player would choose a goal for their attacks, basically switching "modes", and that would bias which attacks get selected.  Examples of how that might play out at the end.
In addition to or instead of random variation every turn, the attacks might have various cooldowns so they're not usable indefinitely.  This would be nice because it could lend a cadence to combat, you might hit an enemy with a number of good attacks, but at some point all your good ones are in the process of cooling down, so you might want to go on the defensive for a turn or two to let them reset.
Attacks could change the state of the player after use, for example some concept of how the weapon is being held, the facing of the player relative to the enemy, the degree to which the player has their weapon, arms, or legs ready to block.  This could be leveraged to trigger either combos, where attacks set the player up to perform a specific next attack, or failures could be combo breakers, changing the player to a state where they don't have good attacks available.  This sort of thing could also provide cadence to combat, since eventually these changes are going to get you into a state where attacking isn't necessarily the best option.  You might want to go on the defensive, or maybe even retreat for a bit (your stamina is getting burned at the same time too).
Attacks could inflict minor and temporary conditions on enemies that can be capitalized on, for example a hard hit could inflict an off-balance condition, and a follow up attack could cause a knockdown.  This is the most complex option, requiring a large number of attacks to be augmented with this kind of thing for the system to work.
A related idea is replacing mandatory counterattacks (which suck in several ways) with inflicting a "counter-attackable" condition, if the player attacks a monster with this kind of condition, it triggers a counterattack, which will generally be beneficial in some way, either by being faster, or hitting harder, or inflicting another condition.

Some examples of how attack modes might play out:
If you're in a fighting retreat vs an overwhelming number of zombies, you might set your goal to "delay", and when a zombie catches up to you, you might trip, or push, or hip-throw, or mule kick, etc in order to temporally disable opponents, giving you time to escape.
If on the other hand you were cornered, you might switch to "crippling", and you'd kick ankles, break arms, snap necks, cut tendons, etc in order to cripple the opponents near you, forming a wall between you and the rest of the horde (they might push past each other to get at you, so this wouldn't be foolproof).
Another crippling mode scenario would be if there are just a few too many zombies to deal with at once, you might try and cripple a few before the main group arrived to even the odds a bit, then switch to damage to finish them off.
A very simple alternating pattern would be offence vs defence, defensive attacks would tend to do less damage, but allow your stamina to recover, so you can either alternate between the two, or if you're hurt it might be worthwhile to just stick with defense.  On the other hand if something lands an attack that causes bleeding, you might not be able to stay on defense, requiring you to either finish off some opponents or run away.
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 §k

  • Survivor
  • ***
  • Posts: 287
    • View Profile
Re: Opportunity based melee attack system
« Reply #4 on: February 27, 2017, 04:49:03 AM »
I think offence/defense toggle is good enough, and let AI handle the rest. And monster melee AI should be as good as player AI.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3551
    • View Profile
Re: Opportunity based melee attack system
« Reply #5 on: February 27, 2017, 07:18:41 AM »
As opposed to any kind of player or martial art black/white -listing, I'd prefer to see attacks (defined in json of course) with one or more attributes stating the "goal" of the attack, such as "damage", "crippling", "defense", "avoidance", "delaying", "stunning".

I see multiple reasons against blacklisting, but I'd still want it in.
Blacklisting would avoid situations where the player has no option to subdue someone "weird" (not handled by AI well), no option to disable weapon attacks with a fragile weapon or costly attack type (say, electric zap).
The presets you listed do sound like a good idea, but I'd prefer to allow player to at least disable specific attacks out of those. Disabling would not offer objective advantages (opportunity for attack is simply missed, nothing replaces it), but sometimes the player has a good idea that the devs simply can't account for properly due to sheer mass of probabilities.

Quote
In addition to or instead of random variation every turn, the attacks might have various cooldowns so they're not usable indefinitely.

Pretty interesting idea, but I'm a bit worried about AI misusing those, requiring player micromanagement. How about per-target cooldowns rather than attacker cooldowns?

Quote
A related idea is replacing mandatory counterattacks (which suck in several ways) with inflicting a "counter-attackable" condition, if the player attacks a monster with this kind of condition, it triggers a counterattack, which will generally be beneficial in some way, either by being faster, or hitting harder, or inflicting another condition.

I think this could be done even now, though hackily: by having a counter-attacks that only inflicts a status.

Offline deoxy

  • Survivor
  • ***
  • Posts: 1293
    • View Profile
Re: Opportunity based melee attack system
« Reply #6 on: February 27, 2017, 04:48:09 PM »
The "cooldown" concept drives me crazy - yes, I could use a palm-nose strike on that guy, but I used on the previous guy, so I can't just this minute, I'll have to just punch him instead.  Oh, now I can use it, yay!

Either there's some kind of condition that has to be dealt with (a status on yourself) or inflicted (a status on them), or you have to have the energy to do it (stamina).  Those two things are quite sufficient, I think.  Want to have some kind of "cool down" from doing SuperAwesomePunchInFace attack?  Make it take a lot of stamina, require the enemy to have some kind of "vulnerable" status ("off balance" for instance), or require a status of the player ("chi-focused" or something - takes an action to get it ready), or give the player a status afterwards that prevents it ("chi-drained" or such).  Don't have very many of these statuses, mind you, but have them overlap - if I can't SuperAwesomePunchInFace because I'm too tired from doing it a moment ago, there's no reason I should be able to SuperAwesomeKickInFace instead, since I'd be too tired to do that one, as well.

On top of just not liking the cooldown idea on the whole, I'd point out that we already have statuses and stamina - I don't think we should add another thing like cooldowns into the mix.

The idea of "offense/defense" sounds GREAT, though - when I'm dealing with a horde, and I'm out of stamina, my DPS drops by half, and that's really all there is to it (both good and bad).  If I want to try to get my stamina back up (say, to run away), there's really nothing useful for me to do but stand there and take hits.

Some kind of "just keep them back while I catch my breath" sort of thing would be great - I'm not using my full strength trying to put them down, I'm just batting their clawing hands away, or tripping them to delay them a few moments.  Stamina restores at normal rate, but there's no attack eating it back up (or some kind of significantly lesser usage).
This is the text that goes under the post, and there ^ is the post, so this is where it goes.

Offline Rysith

  • Zombie Food
  • *
  • Posts: 45
    • View Profile
Re: Opportunity based melee attack system
« Reply #7 on: February 27, 2017, 06:49:44 PM »

As opposed to any kind of player or martial art black/white -listing, I'd prefer to see attacks (defined in json of course) with one or more attributes stating the "goal" of the attack, such as "damage", "crippling", "defense", "avoidance", "delaying", "stunning".  The player would choose a goal for their attacks, basically switching "modes", and that would bias which attacks get selected.  Examples of how that might play out at the end.

I think I'd like to see that system be be somewhat skill-gated, which might address some of the anti-cooldown issues that deoxy raised as well - If I'm melee 0 / unarmed 1, even if I choose a focus there could still be 'suboptimal' techniques added to the list of things to try, and so I won't SuperAwesomePunchInFace every turn. As I acquired martial arts and became more skilled, the selection of techniques available would grow and the biasing would grow stronger[1] so that when someone is melee 10 / unarmed 10 and they choose "damage", they might be able to SuperAwesomePunchInFace almost every turn, which I think would be a nice way to demonstrate skill progression beyond the current "do more damage". It might also mean that lower-skilled characters could flail away with whatever setting because it didn't do much, but a skilled fighter needed to manage their settings more closely  - SuperAwesomePunchInFaceing every turn might be great for damage, but drain stamina quickly, and so a skilled fighter wouldn't just stay on "damage" all the time, but would alternate between damage and defense or avoidance as they needed to, much like an actually-skilled fighter.

[1] Possibly with the option to choose multiple goals, which would just expand the pool of possible techniques while focusing even more on the ones that did both - damage + stunning might heavily prioritize something like Brutal Strike that is slow but high-damage and provides a stun.

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5308
  • I code dead people.
    • View Profile
Re: Opportunity based melee attack system
« Reply #8 on: February 27, 2017, 11:38:35 PM »
The "cooldown" concept drives me crazy - yes, I could use a palm-nose strike on that guy, but I used on the previous guy, so I can't just this minute, I'll have to just punch him instead.  Oh, now I can use it, yay!
I understand where you're coming from, but IMO a cooldown system sits in between a totally random system like what Coolthulu proposes (and what df does) and a MUCH more detailed system.  As far as believability, random and cooldown are similar, both reflect the concept of, "situational factors influence relative value of different attacks" in a very abstract way.  Where cooldowns are better is they allow more flavorful attacks to happen periodically but consistently, where random throws any idea of consistency out the window.
Either there's some kind of condition that has to be dealt with (a status on yourself) or inflicted (a status on them), or you have to have the energy to do it (stamina).  Those two things are quite sufficient, I think.  Want to have some kind of "cool down" from doing SuperAwesomePunchInFace attack?  Make it take a lot of stamina, require the enemy to have some kind of "vulnerable" status ("off balance" for instance), or require a status of the player ("chi-focused" or something - takes an action to get it ready), or give the player a status afterwards that prevents it ("chi-drained" or such).  Don't have very many of these statuses, mind you, but have them overlap - if I can't SuperAwesomePunchInFace because I'm too tired from doing it a moment ago, there's no reason I should be able to SuperAwesomeKickInFace instead, since I'd be too tired to do that one, as well.
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.
To more directly address your example, you might not be able to execute SuperAwesomePunchInFace over and over again because now your dominant arm is extended, or the enemy is knocked back too far, or you're off balance after the last one, or a number of other things.  The question is, is it worthwhile to track all of those things and implement that level of detail in order to get the specific behavior?  I'm honestly not sure.
On top of just not liking the cooldown idea on the whole, I'd point out that we already have statuses and stamina - I don't think we should add another thing like cooldowns into the mix.
This idea fundamentally does *something* to vary which attacks are made.  Not adding, "something more than stamina" means rejecting the idea as a whole.  IMO randomly tweaking chance of success or damage output every turn is going to be less understandable and predictable than a simple concept like a cooldown.
The idea of "offense/defense" sounds GREAT, though - when I'm dealing with a horde, and I'm out of stamina, my DPS drops by half, and that's really all there is to it (both good and bad).  If I want to try to get my stamina back up (say, to run away), there's really nothing useful for me to do but stand there and take hits.

Some kind of "just keep them back while I catch my breath" sort of thing would be great - I'm not using my full strength trying to put them down, I'm just batting their clawing hands away, or tripping them to delay them a few moments.  Stamina restores at normal rate, but there's no attack eating it back up (or some kind of significantly lesser usage).
Glad you like that part, this concept was preexisting and I just wanted to make sure that it didn't get lost .
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 deoxy

  • Survivor
  • ***
  • Posts: 1293
    • View Profile
Re: Opportunity based melee attack system
« Reply #9 on: February 28, 2017, 03:07:49 AM »
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.

As much as I dislike it for the logical slap in the face, I do have to agree with your point.

To more directly address your example, you might not be able to execute SuperAwesomePunchInFace over and over again because now your dominant arm is extended, or the enemy is knocked back too far, or you're off balance after the last one, or a number of other things.  The question is, is it worthwhile to track all of those things and implement that level of detail in order to get the specific behavior?  I'm honestly not sure.

When I said, "Don't have very many of these statuses, mind you, but have them overlap" I really meant it - it shouldn't be a LOT of work to implement, because there should be very few statuses involved.

To crib from other systems a bit, even a single status goes a LONG way.  In 3rd edition D&D, there was the concept of "focused" for monks, where they had to do something to achieve a "focused" state; having that state allowed a few different things, some of which were fairly minor, and some of which were more major but cost you the "focused" state.  In 4th edition, there was the generally applicable "combat advantage" state - the classic "backstab" worked when you had combat advantage against the target for any reason, among other such things.

I would suggest at MOST 2 of each kind of state (good and bad), so four states, max.  Actually, we already have "stunned" and "down", both of which have an inherent penalty and suggest some kind of vulnerability, so I'd suggest only one more bad state, one that gives the vulnerability part with no inherent penalties - "off balance" or something.  One "good" state would probably be sufficient (like "focused").

As far as believability, random and cooldown are similar, both reflect the concept of, "situational factors influence relative value of different attacks" in a very abstract way.  Where cooldowns are better is they allow more flavorful attacks to happen periodically but consistently, where random throws any idea of consistency out the window.

Combat should involve a significant amount of randomness, at least against intelligent opponents... against zombies, maybe less would be OK, as you could pull the same trick as many times as you wanted.

SuperAwesomePunchInFace
SuperAwesomePunchInFace

If SuperAwesomePunchInFace becomes a thing around here, I am going to laugh.  A lot.  For a loooooonnng time.

I may have to make a mod that gives a martial arts style just for that.  Gives nothing but defensive stuff and a crit technique for x50 damage and half movement points, available at level 10 unarmed skill.  *snerk*
This is the text that goes under the post, and there ^ is the post, so this is where it goes.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: Opportunity based melee attack system
« Reply #10 on: February 28, 2017, 03:58:30 AM »
how about:

if you roll a Hit and roll high on a random die and pass a threshold (e.g. you roll 70 on a d100 and pass a 10 check):
you deal your primary damage and then:
get to roll to hit again on the same turn with a penalty and if you succeed, you do one of your fancy attacks from your fancy attack list. After attacking,  roll the d100 and if you pass the harder check now, you get to roll to attack again until you run out of luck or possible attacks. If your attack kills your target and you pass another 'lucky' roll you get to roll a ToHit on a nearby hostile enemy?


so you attack a zombie, hit him, 'pass a luck check', get to roll another to hit with a different attack  from your list of possible attacks, hit with it, roll luck and pass again, repeat.

Every other luck check ought to be more difficult than the last lest you want to be able to combo forever. It could be weighted or modified by some stats/statuses or whatnot. This is more passive than having to choose modes, prompts, going through menus or whatever, which is good for a game with thousands of possible enemies and encounters. Having to manually swap attack modes and styles would get cumbersome and tedious over time.



« Last Edit: February 28, 2017, 04:07:40 AM by viggolo »

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3551
    • View Profile
Re: Opportunity based melee attack system
« Reply #11 on: February 28, 2017, 09:21:34 AM »
if you roll a Hit and roll high on a random die and pass a threshold (e.g. you roll 70 on a d100 and pass a 10 check):
you deal your primary damage and then:
get to roll to hit again on the same turn with a penalty and if you succeed, you do one of your fancy attacks from your fancy attack list.

This would drop a lot of the advantages of the opportunity system. For example, attacks would no longer be "always good" - you'd want to remove bad attacks from the list just so that they don't eat up your fancy attack slots. This would mean either manual blacklisting (bad) or having to wear gloves to cover your claws just so that they don't aux-attack (horrible).

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.

Having a simple, mostly stateless, player-driven "attack routine" means that we can give player a combat AI which will almost always pick the best attacks for a given situation. It wouldn't require micromanagement.
By adding cooldowns to that, we now force the player to micromanage around the AI: we want to use the SuperAwesomePunchInFace against hulk, FlyingGroinKick against survivor zombie, then SissySlap against everything else until our good attacks cool down. But this would impair player's ability to influence combat: we want the good attacks to proc against strong stuff as soon as possible so that they can cool down, while we also want to use the optimal attacks. So manual "use SAPIF against hulk" doesn't cut it - it forces the AI to drop the attacks which could actually be BETTER than SAPIF (due to them gaining random turn advantage).

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.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: Opportunity based melee attack system
« Reply #12 on: February 28, 2017, 02:21:29 PM »
Our current melee system is pretty simple: when you attack, you attack with currently wielded weapon. Then you get bonus attacks due to mutations (if you have them).

How about this:
  • When attacking, game enumerates all possible attacks
  • Some of them are pretty weak most of the time: headbutts, elbow strikes, pistol whips
  • The attacks get some random permutation to accuracy/expected damage every time
  • The effectiveness of attacks is evaluated based on enemy (for example, armor is subtracted from damage)
  • Attacks are weighted somehow: usually just by DPS, but sometimes by being finishing strikes (dropping monster to 0 hp or less) or special effects
  • Best one is picked and executed


Game picking the most damaging and accurate (of all of them on average) available free attack from the list automatically is a pretty simple way to go here. I like this, even if it results in the player doing the same one-two punch over and over, it gets the job done and that's what matters. Disabling some attacks you'd want to avoid should also be possible (e.g. if the game automatically chooses an attack that always knocks an enemy away when you don't want that to happen)

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3551
    • View Profile
Re: Opportunity based melee attack system
« Reply #13 on: February 28, 2017, 03:26:11 PM »
Disabling some attacks you'd want to avoid should also be possible (e.g. if the game automatically chooses an attack that always knocks an enemy away when you don't want that to happen)

I totally forgot to mention that as an example of an undesirable attack, even though I kept thinking about it.

Knockback is probably the best reason to include that blacklisting, yeah.

Offline Rysith

  • Zombie Food
  • *
  • Posts: 45
    • View Profile
Re: Opportunity based melee attack system
« Reply #14 on: February 28, 2017, 06:23:29 PM »
Disabling some attacks you'd want to avoid should also be possible (e.g. if the game automatically chooses an attack that always knocks an enemy away when you don't want that to happen)

I totally forgot to mention that as an example of an undesirable attack, even though I kept thinking about it.

Knockback is probably the best reason to include that blacklisting, yeah.

I'd still like to be able to (attempt to) let the game know what sort of effects I (as the player) want, and let the game (as the character) work out what I can actually do based on some randomness and the character's skills. It seems appropriate that even if an unskilled character wanted to, they couldn't perfectly control what sorts of attacks they were doing, it would mostly just be swinging and hoping for a hit. Similarly, if the character has high skill I (as the player) don't want to have to repeatedly alter the set of moves that are being used (from 'only the fast, safe moves' for normal zombies to 'only the high-damage stunning moves' for brutes to 'moves with knockdown and knockback' to clear space for a retreat), I'd like to be able to choose categories of moves (potentially pre-defined, potentially that I've set up myself) that the character can (because they are high-skill) reliably pull off. If I don't want knockback I don't blacklist knockback moves, I choose a style that doesn't use them like 'fast attacks only' or something.