SakeTami
Megan Fox
Megan Fox

patreon


Three ways of doing hitstop (which adds weight to hits)

Right, so, hitstop! Lemme just start by showing you what I mean.

This video has hitstop: https://bsky.app/profile/glassbottommeg.bsky.social/post/3llilnykdvs2l

This does not: https://bsky.app/profile/glassbottommeg.bsky.social/post/3llilpz33722l

See the difference? No? Ok, look at this,

See how when the orange guy punches the blue guy, they both freeze for a sec, and that adds weight to the impact? That's what we're doing here. This is in um, pretty much every fighting game, most action games, it's standard.

There's a bunch of ways of doing it in your games! But. The one you might reach for initially might be bad for a bunch of reasons. So let's start there.

HitStun via Time Dilation

This one's the easy, obvious one. Whole world slows down or stops at moment of impact. Most engines have a way to set current time dilation, not gonna go into it, you get it.

Now why might this not work? Couple o reasons:

The first two are the obvious reasons, but the third's worth discussing, because it's why you might want to do the time dilation approach even if you only care about single-player. If the whole world freezes when you hit, then the slowdown from the hit doesn't impact your gameplay. Messes with your button timing a bit, but it doesn't cost you anything.

On the other hand, if only you and the person being attacked freeze on hit? Everything else is still live. That isn't just an effect anymore, what you're doing is making your attack animation slightly longer if it hits something. This does two really cool things:

So let's talk about how you do HitStun without time dilation.

From here on out you'll be looking at this dumb little Unreal actor component I made to test this stuff. Absolutely do not duplicate this yourself. This is a dumb way of applying hitstun. Build it into your character. But. This does technically work and functions fine. But don't! I'm replacing this after I finish this blog! Anyways,

I apply it in the I-just-had-damage-applied-to-me handler like so,

and its internals look like this, because I've set it up to optionally do everything we're about to discuss,

Now let's dig in

HitStop By Freezing Animation

This is what the above code's set up for right now, and it's what you saw at the very top in my original video, and it's generally what I recommend. Doing things this way "only" snaps the animation. Doesn't mess with gameplay. It does impact anything that's animation timed, but since all it does is extend the animation a bit, generally? You're safe. You probably won't launch anything to the moon due to 30/60fps differences, it won't radically alter attack timings, etc.

This is also totally safe to use online! Since it only influences apparent animation state, hey, do whatever you want. Which is why it shows up in, for instance, Dragon's Dogma. No seriously, go watch footage of the original (and I think the sequel)!

But hey we can get weirder,

HitStop by Freezin Animation (and apparent position)

The above code flips to this mode if you do, this,

And it's really uh. Weird: https://bsky.app/profile/glassbottommeg.bsky.social/post/3llk2kndlyk2l

It gives King of Fighters 98, or any of those older 2D fighters where they really weren't shy about snapping between frames/motion. It isn't appropriate for our use case, but I can certainly imagine games where you'd absolutely want this. This is also still quite safe, since again, character's still moving normally. All you're messing with is the visual representation and slight animation timing stuff, same as before. Only additional impact is, since you're lagging the whole mesh, you're probably also lagging your hurtboxes, so might slightly change how and when attacks hit.

But moving on! Let's try one more!

HitStop By Local Time Dilation

In Unreal terms, this means CustomTimeDilation, which is time dilation that only applies to this specific actor. Looks like this in practice: https://bsky.app/profile/glassbottommeg.bsky.social/post/3llk2toh2uk2l

I can't put my finger on why, exactly, but this feels. Weird. It should be more or less identical to the others, but instead, it's softer? But not nothing? I dunno. Watch it, draw your own conclusions.

My main argument against this one is: look at what it does to the attack's timing. You launch into the air a split second faster than the enemy now, and you're falling as they're rising. Given how narrow the timing is on this thing (the hitstop is 0.05 seconds in this example), that likely makes the impact of this approach massively framerate dependent. Personally, I don't like my FX messing with my gameplay that much.

Though all that to the side, this is also an argument against using time dilation for your hitstop period? This complaint would apply even if it were global. So yeah!

In Conclusion

Personally, I'd stick to one of the approaches that has minimal impact on gameplay. Anim freeze, or even the anim + position freeze, both of those have minimal risk and should behave more or less the same at any framerate. They even work online!

Time dilation, eh, either doesn't work online, or maybe does (CustomTimeDilation might be safe to replicate over a network but might mess the concurrency of stuff up depending who knows) but still has the above issues.

Still though, this is very much a style thing, so be yourself! Check the above out, decide which you like best, use it. Ciao.


More Creators