Make character decelerate when you release input (with replication on dedicated server)

Hi :slight_smile:

I am trying to make my character decelerate instead of stopping immediately. Ground friction wont solve this because it affects horizontal movement (don’t want character to ski) so I need my own implementation. Feels like character movement is missing this setting altogether.

I check if there’s any horizontal movement, if there is, I store the current horizontal acceleration, I check if the timeline is playing, and if it is, I stop it.

Here is an image of my setup:

This causes the character to jitter when I stop moving. I assume that the server doesn’t agree with the character’s position or something along those lines. I don’t know where to look to fix it because I’m not sure and I’ve spent hours trying each possibility I can think of.

I do not think the Event Tick can affect the server like inputs can even if it’s using Add Movement Input. Am I wrong? The entire idea here is that there isn’t any input.

Any help on how to set this up properly would be appreciated. Thanks!

Vaei- the character by default does decelerate when you release input. There is a built in variable you can adjust I think called “braking deceleration walking” that applies some deceleration when you let go of the input. Your character is still subject to slowing due to the friction in the level so you may also have to adjust that to get the effect you’re looking for, but it should be simpler to achieve than making a whole new function as you did above.

Ah… I specifically mentioned it because this wasn’t a solution :open_mouth: … The default ground friction is high, yes. Putting braking deceleration on 0.000001 while ground friction is as low as it can go without making the character slide across the ground when he runs around is nowhere near sufficient. I want him to actually slow down to a stop, not just have a tiny bit of blend time for the animation.

Okay, well another approach is to reduce friction only when you are not currently hitting any input keys. When you press an input key again friction gets set back to normal. Together with the lower braking I think you could achieve what you are looking for.

I’ll try it tomorrow but I still need to know the way to make a system like this on a dedicated server. I’ve actually tried asking a few times over the past few months and I never get a response that’s helpful in that regard so I still haven’t been able to learn anything

Now that I’m properly awake, this wont work. It has the exact same issue as my method I’ve already implemented. There is no pressed/released for input axis such as a controller, and I’d have to map WASD to an input to sort of fudge the system along… ultimately, I’m going to have to resort to event tick which is back at square 1.

And I see that by some… cosmic abnormality… no one on this forum has any idea at all how to replicate anything to do with the player on a dedicated server… not like any game needs that… How many of these posts and how many months is it gonna take for an actual answer! >.< Waste of time… All I want to do is affect the player via it’s movement and have it actually work on the server/clients. But it doesn’t seem possible and no one knows despite every authoritative game needing it… All these tutorials deal with really basic stuff like variable replication or input events which isn’t going to help.

Will your method work on the server/single player?

I can’t execute anything on the server via tick if it’s a dedicated server, so no.

As for the single player I’ll have to check later.

I’m in the same boat as you as far as fully understanding how to implement replication in blueprints, but here’s a few threads I found helpful as a starting point:

I know this is an old topic but could be useful to others if there is an answer here that actually works when all CharacterMovementComponent settings fail to help. Well, hopefully this just might:

I had similar situations, last time I was doing a car with the character movement component. Yes. Horrifying but not even remotely hard if it’s just for a simple top-down game.

Anyways, as long as I’m not using MoveTo calls for the AI (as in I have to write my own if I want to) I can just control the input itself. As in player input is stored in a “TargetInputValue” vector variable and when it’s longer than our current Input vector, we override, but if not, we use vinterp or something to slowly approach it instead - you can freely control this part however you want it.

In fact if you feel insecure about client side control about this you can still do a server side validity check on the input/velocity numbers but that’s probably not really that necessary unless you are doing a highprofile, competitive game.