I am in the process of creating the skeleton for my third person action game and have run into a snag and am unsure as to how to proceed. I have seen conflicting information online (here on the forums, reddit and youtube) as to what is the appropriate means of accomplishing what i want for my game and am hoping to get a clearer answer.
Currently my enemies have are able to receive damage and apply hit stop/shake when damaged. After this effect i want to push the enemy backwards to improve combat feel. The problem is I cannot tell if i should be using the in built impulse node, the launch character node or as one person suggested setting the actor location to achieve this effect. I should be able to add the knock back logic onto the end of the hit stop function correct so that it is resolved immediately after the enemy takes damage correct?
Later on when i have all of my attack anims finished for the game i plan on making this system modular so that the different attack profiles can knock enemies back differing distances but for the time being i would like to know what is the appropriate method. I am currently using launch character to handle how the player charater dashes and that seems like a more correct usage of the node since its a controlled burst of movement that goes a set distance.
After trial and error i was able to get this working although i have my reservations as to how i set this up. I know this set up will need tuning since i intend to have attacks apply force in different directions. (i.e. knocking into the air, to the side etc) is there somethign wrong with how i did it for now that i should know?
Other than that - it seems unnecessary to Get the KnockbackForce, normalize it and then multiply it by 1500. Can’t you produce it with the correct size in the first place?
In general:
You will need to split your code in several general pieces especially if you want it to work in multiplayer:
Things on the attacker
Thinks on the hit actor.
Keep those separated as much as possible - the hit actor should never reference the attacker. The same goes for the attacker after the initial application. There is often a time delay between the production of the the damage and its application (projectile flying etc.) where you are not sure exactly what can happen with any reference. Try to get all relevant information in one struct with pure data only that you apply on the attacker.
Next you need to split your code on each of those (attacker and hit actor) in two pieces:
Visual - health bars, camera shakes, VFX, animations
Functional - movement, damage application
These pieces of code must be executed on different devices - the visuals are run on the client ONLY and must be entirely driven by the functional code. Functional things are run on the server and must be replicated to the clients somehow (best with replicated values). For example: health bars (client) are driven by health change (server); Animations (client) are driven by movement (server).
Apologies if the way i worded this post led you to believe there was going to be a multiplayer component, this is going to be a single player game only. I just wanted feedback on how this on hit knock back was being resolved and how i would go about setting the ground work for a more complex system in the future.
I am in the middle of making my first set of root motion driven attack animations for my game and will be importing those soon but before i did that i wanted to make the damaging system work how i have imagined it. Enemies take damage, apply hit shake and then are moved backward according to the players forward vector.