Hello!
I’ve been trying to figure out what’s the proper way to implement custom movements.
I want to make different skills which may involve special movements. Dash forward for a time with a constant speed, jetpack, dodge sideways with predefined distance and speed.
It’s really important that the implementation must work in multiplayer, since the game I’m making is multiplayer only.
What I tried:
- Launch: Sets character in “falling” state, even tho it’s not falling, and it’s more like adding a bonus velocity, rather than overwriting it
- Setting velocity: works well in single player, however when running on client(control) side, braking kicks in because I’m not giving “Acceleration”, only providing velocity, and it shortens my velocity, making my dash shorter on client side.
- Impulse: as documented, it’s only good for one time force
- Force: DeltaTime is calculated twice. Once when adding it into the velocity, and velocity itself is multiplied by deltaTime before adding into Position. So it’s not constant, heavily framerate dependent( not to mention it’s impossible to set it to a normal value ). Braking is also kicking in
What is currently halfway working: Setting velocity directly, but in my derived character movement component class, overwriting the CalcVelocity function, removing the “braking” calculation while my custom movement is on.
This is only partly working because on client side it can “jitter” at the end of the movement. Probably client is updating longer (or shorter) time than server is
Obviously this is a hack, and I want to know the proper way to do it, and preferably with client prediction( so the game does not need to wait until the server acknowledges the custom move ).