Need Help For Making a good looking Melee system

Hey Guys! I’m trying to make a combat system which would feel a bit more realistic to the player.

Currently I’m using various animations to test it out. For eg: When the player attacks the enemy it reacts with a proper animation. But sometimes these doesn’t feel that good. And there is another problem with this kind of approach is that, when the player hits various enemies, they all play the same animation.

I was thinking if I could do a physical kind of simulation to kick in at that exact moment it would look more realistic and every enemy might react a bit different. As I’m pretty new to this kind of thing, so I thought I should ask the experts on what kind of approach is best for making a good combat system.

Please Help, Thank You.

The way I do it is to use overlap events to determine a hit between weapon and enemy… and then, when those overlaps happen, to fire a capsule trace to determine the bone location of the hit.

In addition to playing the reaction animation, I also use a partial ragdoll simulation (using physics blend weights) and apply a force based on the impact normal and bone.

Looks like this:

Now, granted, my game is using a substantially more flexible ragdoll than you probably would, because of how the enemies are designed (they use a lot of axles and ball-sockets, so there’s very little expected constraint of movement, and that’s by design).

The other thing is, I don’t actually use reaction ANIMATIONS, just single-frame poses, and I let the ragdoll and animation blending do most of the heavy lifting. This makes the hits feel more dynamic though obviously less realistic, but I’m sure using less physics blend weight and more detailed animations would probably go a long way toward creating a more realistic reaction.

The sword trails are extremily awesome! How did you do those? Are they particles or animated textures? Thank you!

They’re AnimTrails being triggered by the melee attack montages. I just manually drew some horizontal weapon fanning of the same color as my weapon and trigger them from the center of the blade to draw that texture, using some really aggressive tangent calculation settings to make the textures deform really strongly with the curvature of the sword. Looks pretty cool for blades though it’s less than perfect for “wide” weapons like hammers and stuff (mostly because anim trails are 2D only and a sword is already a very flat surface so it looks pretty correct; my kingdom for a simple 3D anim trail renderer!)

The montage also uses a second anim trail to render past the tip of the sword with a variable width value (drawn from a curve on the montage) to extend the range of each attack at various points; this same value is also fed to the capsule half-height of the collision hitbox so that the visible range of the attack always constitutes exactly its effective range. I think this is a more important trick than the fanning itself, it makes the attacks look more interesting to be sort of pulsing through the swings.

OHHHH awesome RythmScript!
is there somewhere I could see/find out more about your game?

I post about it occasionally around here and frequently on /agdg/. Though I’m not super happy with the trail rendering; it’s funny, because I’ve seen your trail rendering from your trailer, Pres, and in a lot of ways I like it more. It seems more conducive to round trails; mine look great at the native 120 or so FPS I get in editor, but as the framerate decreases or attack speed increases I get really noticeable straightening which I’ve not been able to get around. I know there must be a way because you never see it happen in any action games later than the PS2-era ones which all used that default “refracting light” effect for weapon trails.

Are you using single anim trails and you just understand the tangent values better than me? Are you doing special particle systems per-swing to guarantee nice curvature even for very fast animations? Because your swings go even faster than mine and your trails never hexagonalize around those curves, it seems.

I meant your Whole game seems awesome much less your Trail…although I’ll guess “the grass is always greener” applies here I like yours far more than mine currently…I’ve a lot of problems with mine…anyways take a gander if you’d like…
download buttons on the right…drop the 3 folders in your content folder…Lots of problems once you take a close look…I’ll work on that stuff later…
Hope to see more of your game soon…I’ve watched that above link waaay too many times already…

@RhythmScript Now I’ve built an attack animation and a reaction animation corresponding to that attack. I’ve synced both animations so that when the attack montage occurs, the reaction takes place. I made both the player and the enemy to look at each other when the attack key is pressed. However, there is slight problem with this. There needs to be a particular distance between both of them in order for this to look right, otherwise there is lot of overlapping and stuff. How can I fix this issue?


Well, again, it’s a two schools of thought thing. For my part, I just let the overlaps happen, because that’s how videogames have been doing it for ages and it doesn’t seem particularly wrong to me. But at the moment of overlap, you could always set the enemy actor’s location to the proper one, or lerp to it, so that the animation plays properly.

But that’s the real problem with such “realistic” melee systems; in realistic melee combat, every reaction is totally unique based on the particulars of how the attack connects, like distance and angle, because it’s all physics driven; and the way the attack itself follows through is a reaction to this. It would be an enormous undertaking to try and develop a melee system that looked truly realistic (i.e. no overlaps between the attacker and the enemy, no disconnects between reaction and impact) which is why I say “don’t bother”. Just allow for the player’s attacks to pass through the enemy a little bit and accept that as part of the videogame aesthetic generally, or else be prepared for a monumental undertaking in terms of programming, physics simulation and animation design.

Ya that sounds reasonable for an Indie Game…Like the one I’m working on.

And I mean, not just indie games. Think of every fighting game you ever played, even the most recent and high budget ones… And with rare exception I think you’ll find that actor overlapping is par for the course. And those are games which are about literally nothing but melee combat.

I can think of like, ONE game which aspires to truly REALISTIC melee (Overgrowth) and it’s basically just a tech demo for the extremely advanced procedural animation systems it uses for that.