itch.io is community of indie game creators and players

Devlogs

V.0.1.1 Devlog - LH

Plight of the Gods
A downloadable game for Windows

"Undesired Movement During Heavy Attack"

Author: Liam Hans

Posted on: 07/12/24

THE PROBLEM

This week, I underwent the task of adding a bit more dynamism to our combat system. In my opinion, our combat felt a bit empty and "flighty", so I wanted to add a bit more oomph to some attacks - namely, the heavy attack combo. I find that combo attacks greatly benefit when some momentum and movement is introduced during the attack, so that was my goal. I intended to add an impulse to our player when they performed heavy attacks on both the initial attack and the following combo. However, I had a bit of a problem while trying to do this. Normally, adding an impulse to an object in Unreal is rather simple. All you need to do is ensure that object is simulating physics (literally via a checkbox that says "simulate physics") and then you just need to add a call to "AddImpulse" on that object and Bob's your uncle, you have an impulse. This does not work, however, on objects that don't simulate physics. And, you guessed it, our player does not simulate physics. There is a number of reasons why that is, which I won't get into, but essentially, I had to fake an impulse on our player. This similar problem occurred while I was attempting to add a combat roll to our player, so I had an idea where to get started. After a lot of deliberation and experimentation I decided upon using a timeline, which is some built in Unreal functionality that allows you to perform a certain action over a given period of time. So, I used a timeline and set my players velocity to a very fast speed for a very short period of time. This emulates an impulse being applied to my player. This worked pretty well, however I had another problem. When I performed this impulse my character could still move around in any direction, which resulted in some very odd and undesired movement. Below you can see a video of this odd effect:

THE SOLUTION

This was my solution. Now, all I needed to do was set the timing correctly and set the input to come back once the attack or combo was finished, et voila, our heavy attack now has movement. Below you can see an example of the finished product with this new system:

Download Plight of the Gods
Leave a comment