please tell me what you did ive been trying to fix my client side prediction for a rigidbody based character controller for a pretty long time now and i cant
Checkout my guide github.com/DoctorWh012/Client-Side-Prediction-Physics It's a bit outdated but should get you 70~80% there, also getting the CSP to be 100%smooth was not possible for me, that's why the movement in my game is client authoritative now
I would love to see your tutorial on this, after struggling with this for a long time myself I came across one of your posts in the Unity forums. And really happy to hear you found a working solution for this.
yeah mate, the tutorial may take a while, im not very good at making videos, but heres a guide a wrote github.com/DoctorWh012/Client-Side-Prediction-Physics
I have looked for some videos about client side prediction with real networking, and i dont quiet understand what is going on but, it seems awful when you do that with autosimulation try to place ur player movement script at last place in 'script execution order' list I tried to manually simulate physics in my racing project, and got 'laggy' vehicle until i have placed my controller script in last place in my case the problem was - i simulate physics in the 'middle' of physics tick
@@d0c_dev the other thing i found in your github project because of MovementTick logic - the Physics.Simulate method called twice, that method affects whole scene and not the only object you are working with, that can cause 'accelerated movement' bug, because you are manually simulating in single instance of the game, and that's where i found logic in turning off physics for rigidbody...
@@d0c_dev i just couldn't get why are you making player kinematic between frames (yes, in your code it doesn't affect twice, because player physics is kinematic) when i wrote last message - i found that you run twice MovementTick method - one is for MovementInput (look Update method -> SetInput->MovementTick), other for server simulation from PlayerInput class (look Input method, as i understood - it is rpc method -> HandleClientInput -> SetInput) i dont think that you can get rid of issues if you are simulating for client and server in single instance of game, it probably would work fine with dedicated server, may be better way to correct 'host' game is to Sleep the rigidbody and Wake, but even better for host is to simulate once as Authoritative server :D
I can show you my game's code, feel free to call me on discord D0c_Dev#2699, I think im not getting what you are trying to say, i'd appreciate if you know a better way to do this than the way i did :) Edit: are you talking about applying the movement for all players in a single method? cause that is in the plans, That would take a lil bit more time lol and i heavily just need to get the game to a playable state, so im doing things as fast as i can
this is too darn complicated. I don't understand how you can have smooth gameplay or any of these multiplayer game have smooth gameplay. if you release your move forward button, the server still pushes your character forward for a couple of milliseconds, so how can any game possibly be smooth if releasing a movement key will always have a delay on the server?
Great job! I am at a similar point as you are when you made this video. I've gotten my movement to be super smooth, even at 500 ping, but my slide and wall kick I haven't figured out at all yet. :(
If you have any kind of coyote time or jump buffer or anything that uses time you should change to a frame based approach, i gave up on client side prediction yesterday as even after a shit ton of work i only managed to get the movement on the client to feel 80~90% right
Hi~ I just encounter your channel today~ cheers Amazing~ may i ask, which network solution are you using? Unity netcode/ fusion/ mirror/ fishnet ? if you are using netcode, you dont need clumsy to simulate lag, there is a network debug component that does that. If you are using fusion, it comes with client side prediction feature, you just have to set it. but still, this is pretty amazing you pulled it off yourself. Great Job!!
First comment can i get a pin?
Heck ya you can!
please tell me what you did ive been trying to fix my client side prediction for a rigidbody based character controller for a pretty long time now and i cant
Checkout my guide github.com/DoctorWh012/Client-Side-Prediction-Physics
It's a bit outdated but should get you 70~80% there, also getting the CSP to be 100%smooth was not possible for me, that's why the movement in my game is client authoritative now
I would love to see your tutorial on this, after struggling with this for a long time myself I came across one of your posts in the Unity forums. And really happy to hear you found a working solution for this.
yeah mate, the tutorial may take a while, im not very good at making videos, but heres a guide a wrote github.com/DoctorWh012/Client-Side-Prediction-Physics
I'm really struggling with this especially with physics based movement waiting for ur tut does it support unity Netcode
As long as you can send and receive messages it should support almost anything, im quite bad at making videos but one should come soon!
@@d0c_dev yeah ofc it is, waiting 4 ur vid thnks bro
@@salahwalker7261 Hey so if you are still struggling with CSP I made a guide on how to do it github.com/DoctorWh012/Client-Side-Prediction-Physics
I have looked for some videos about client side prediction with real networking, and i dont quiet understand what is going on
but, it seems awful when you do that with autosimulation
try to place ur player movement script at last place in 'script execution order' list
I tried to manually simulate physics in my racing project, and got 'laggy' vehicle until i have placed my controller script in last place
in my case the problem was - i simulate physics in the 'middle' of physics tick
I may try and do that, but i managed to get it to feel nearly 100% by autosimulating the physics and disabling my jump buffer
@@d0c_dev the other thing i found in your github project
because of MovementTick logic - the Physics.Simulate method called twice, that method affects whole scene and not the only object you are working with, that can cause 'accelerated movement' bug, because you are manually simulating in single instance of the game, and that's where i found logic in turning off physics for rigidbody...
All the rigidbodies from the player ik not simulating are kinematic so they are not affected, but how does it run twice?
@@d0c_dev i just couldn't get why are you making player kinematic between frames
(yes, in your code it doesn't affect twice, because player physics is kinematic)
when i wrote last message - i found that you run twice MovementTick method - one is for MovementInput (look Update method -> SetInput->MovementTick), other for server simulation from PlayerInput class (look Input method, as i understood - it is rpc method -> HandleClientInput -> SetInput)
i dont think that you can get rid of issues if you are simulating for client and server in single instance of game, it probably would work fine with dedicated server, may be better way to correct 'host' game is to Sleep the rigidbody and Wake, but even better for host is to simulate once as Authoritative server :D
I can show you my game's code, feel free to call me on discord D0c_Dev#2699, I think im not getting what you are trying to say, i'd appreciate if you know a better way to do this than the way i did :)
Edit: are you talking about applying the movement for all players in a single method? cause that is in the plans, That would take a lil bit more time lol and i heavily just need to get the game to a playable state, so im doing things as fast as i can
this is too darn complicated. I don't understand how you can have smooth gameplay or any of these multiplayer game have smooth gameplay. if you release your move forward button, the server still pushes your character forward for a couple of milliseconds, so how can any game possibly be smooth if releasing a movement key will always have a delay on the server?
Great job! I am at a similar point as you are when you made this video. I've gotten my movement to be super smooth, even at 500 ping, but my slide and wall kick I haven't figured out at all yet. :(
If you have any kind of coyote time or jump buffer or anything that uses time you should change to a frame based approach, i gave up on client side prediction yesterday as even after a shit ton of work i only managed to get the movement on the client to feel 80~90% right
@@d0c_dev Oh wow, okay, thank you very much! What method are you planning on using now?
@@raisgamesnz325 Client Authoritative movement with Server Authoritative Shooting, and a option to kick hackers out of a match
Hi~ I just encounter your channel today~ cheers
Amazing~
may i ask, which network solution are you using? Unity netcode/ fusion/ mirror/ fishnet ?
if you are using netcode, you dont need clumsy to simulate lag, there is a network debug component that does that.
If you are using fusion, it comes with client side prediction feature, you just have to set it.
but still, this is pretty amazing you pulled it off yourself. Great Job!!
Hey mate, i am using Riptide by Tom Weiland, a kinda lower level approach, i managed to get it 100% working now
Thanks for sharing, very helpful☺