How does DMC 3's Ability System work?

I’m trying to figure out how does the Ability System for DMC3 work. Where, a weapon (using Rebellion as an example) has a 2nd Combo if you waited on the 1st Combos input (Attack > Wait > Attack)

Lock-On attacks are probably simple enough to make, I’m gonna assume I can just check if the player’s shiftlocked and using :Dot() to get the which side they’re moving to or something like that

Though one thing I’m still trying to wrap my head around is Crazy Combos eg. Mashing the attack button to unleash a more rapid hitting attack. I still can’t really figure out how this is done while also having the ability to increase the duration of the Crazy Combo by continuing to mash.

Psuedocode can really help especially if its within the MVC pattern since I’m still trying to touch up my usage on that alongside SoC so I’m assuming I’m gonna need some AbilityController or something like that. I’m just trying to make sense of how this kind of System is done

Note - I will be using frames to describe time in this example because it’s easier than raw time. For reference, 60 of these make up one second - literally 60 fps.
In this example, each frame allows only two input states; Attack pressed or Attack not pressed.

So to do this, you use a state machine, and track the time of things happening.
For your example, let’s give four states - Idle, Attack, Attack Combo, Delayed Attack, Rapid Attack
We set rules on how we can transition:

  1. Idle can only transition into Attack and only if the user has pressed.
  2. Attack Combo can only be access through attack - player must be in Attack already to transition into it.
  3. Delayed Attack can only be accessed through Attack.
  4. Rapid Attack can only be accessed through Attack Combo.
  5. If a player is already in an attack of any kind, they are locked in that attack animation for a set duration.

So in this example, all you need to do is watch the timing of the state to figure out what they do next.
e.g. player is in Attack, and at frame 10 they activate the input. Our rules say if it’s before frame 5, we do nothing because they’re still in the Attack animation. At frame 6, they can transition into Attack Combo. At frame 15, they can no longer access Attack Combo, but they can access Delayed Attack. At frame 30, if the player did nothing, transition them back to Idle.

What about Rapid Attack? How can you distinguish accessing another attack combo from a rapid mash? The trick is an input buffer.

You use an input buffer to match patterns, like a fighting game.
For instance - let’s represent your attack button pressed as O and unpressed as -.
Each frame, we take our input buffer (I will use a string to represent it here), remove the last entry and add on the new entry. It’s a queue!
Then, we only need to match it to find out what state to put our player in.
I’m going to use an input buffer of 6 frames, which is why I will use a 6 length string to represent it.
XXXXXX - player is doing nothing
XOXXXX - player hit attack on frame 2
XOXXXO - player hit attack on frame 2 and 6. This means the player pressed attack, waited for 3 frames, then pressed again.
XOXOXO - player is mashing attack like a madman

So using this, you can find out if they pressed once, or if they’re actively smashing that attack button.
Check this input buffer while they’re locked into their animations to see what they’ll do next, and queue it up.

It also has the neat benefits that you can do things like dragon punch inputs for some very complex input patterns.

To integrate it with MVC, you’d have the animation display for view. Inputs and animation timing must be handled through your controller. Your model contains the information on how cancels happen, and the current state. Roblox doesn’t like it but it’s really important you decouple animation tracks from logic. Don’t rely on marker events!!

Hope this explains it a bit

2 Likes

this def explains alot, this could potentially go well with my base framework since ability objects run on a timeline object (figured out to never rely on animationmarkers the hard way :wilted_flower:)

so I’m assuming within the abilities data i can declare a new Marker of some sort to change the characters state to the Delayed Attack during the ability.

pretty neat explaination, appreciate it! :]

Yep! The times I’ve done this, I typically use animation markers just to extract information on the timing, but never listen to the events. Give me a shout if there’s anything you’re unsure on!

1 Like