#Predicted Inputs smoothing

8 messages · Page 1 of 1 (latest)

stoic totem
#

Fishnet Version : 4.4.7R Pro

Hi !
how do you guys manage player going too far when using predicted inputs for Future states ?
For instance, my player keeps running left then right, other people sees my player kind of teleport, since I am predicting that if the lastMoveData = running, now he should be running again
I tried some lerping but observers still see me kind of teleport (see attached video)

public void ReplicateMovementBehaviour(PlayerMoveReplicateData md, ReplicateState state)
        {
            var currentVelocity = pC.rb2D.Rigidbody2D.linearVelocity;
            var targetVelocity = new Vector2(
                md.HorizontalInput * pC.playerMovementConfig.moveSpeed,
                currentVelocity.y
            );

            pC.rb2D.Velocity(
                Vector2.Lerp(
                    currentVelocity,
                    targetVelocity,
                    pC.playerMovementConfig.velocitySmoothing
                )
            );
        }
stoic totem
#

@fierce needle any tips for this kind of scenario 😛 ?

stoic totem
#

i have enabled Adaptive Interpolation on the Player prefab, movements are not snappy anymore ! But ... i see other clients floating in the air for some reasons lol

stoic totem
#

By the way, I had already mentioned the Adaptive Interpolation issue here : #1167060429051269200 message

stoic ember
#

@stoic totem

what is the unitialized/default value of md.HorizontalInput? worth checking out predicted states, to see if you can modify the behavior during a predicted input

stoic totem
# stoic ember <@105735711059120128> what is the unitialized/default value of md.HorizontalIn...

thank you, forgot this guide was existing. I actually managed to solve my issue by following the code example, and actually limiting the number of predicted inputs.
Because otherwise I had like ~10 ticks of predicted inputs that were saying "go forward" so when the player stopped or changed direction, reconciliation was hitting hard
But now with the code you provided, i've limited them to 2 inputs in the future, so I still have prediction, but not that much, and if anything happens, reconciliation is less noticeable !

stoic ember
stoic totem