To put things into context, I have a character class in my game Metal Heads, which when the player taps A, the character is given an impulse upwards…think Flappy bird, but it’s vertical.
I have had this mini-game working for the longest time in offline mode, but when it comes to online, using anything except the Jump node causes lag for clients, whenever they hit A, their character kind of teleports upward which is rather jarring and not enjoyable.
I recently tried the Jump node with a jump velocity of 600 and removed the jump count limit so that the player can continuously jump over and over.
The problem is that the Jump velocity seems to be the Z velocity limit whenever jumping. So it doesn’t matter if the player taps every 0.25 seconds, or every 0.025 seconds, the character will not be able to go faster than a Z velocity of 600.
Which means when the camera speeds up, the player can’t keep up with it, and players all end up dying.
Increasing Jump velocity is not an option…if anything, I actually want to decrease it, but allow each jump to add to the character’s upward momentum.
I do have my own Z velocity limiter of about 1200 to prevent players launching upward at Mach10 however (this limiter has been disabled whilst testing the Jump node)
This is just using Add Impulse on the character movement component to move upward and this is the desired movement I am aiming for, however is bad for online play.
I did look into the Character.cpp class and found the following code…however this is for **ACharacter::ApplyDamageMomentum **and I can’t find any limitations in velocity in relation to the character using the Jump function.
// limit Z momentum added if already going up faster than jump (to avoid blowing character way up into the sky)
{
FVector MassScaledImpulse = Impulse;
if(!bMassIndependentImpulse && CharacterMovement->Mass > SMALL_NUMBER)
{
MassScaledImpulse = MassScaledImpulse / CharacterMovement->Mass;
}
if ( (CharacterMovement->Velocity.Z > GetDefault<UCharacterMovementComponent>(CharacterMovement->GetClass())->JumpZVelocity) && (MassScaledImpulse.Z > 0.f) )
{
Impulse.Z *= 0.5f;
}
Removing the limiting code didn’t do anything as expected since it has nothing to do with the jump, but I thought I would try anyway since I can’t find anything else that is limiting momentum/Z velocity.
Am I missing something really obvious inside of my character’s blueprint? Or is there a better method of doing what I want to do? (bare in mind, once again I have tried launch, I have tried impulse, add force, set velocity etc to try and move the player up smoothly in an online game and none of them work well except the Jump function.
I’m betting it’s one of those annoying, stupid simple problems, but I’ve tried so many different things out over the last 5-6 hours now and my brain is fried trying to figure this out.
Does anyone have any ideas on how to resolve this problem?
Thank you in advance!