I have issues with replication some variables from Character Movement Component. In my game I want to add gamepad support. The left stick is for movement, the right is for changing face direction.
When character is moving without pressing right stick, bool “Orient Rotation to Movement” sets TRUE inside Character Movement Component and bool “Use Controller Rotation Yaw” sets FALSE inside Character Defaults.
With pressing right stick these two bools become visa versa.
[Watch Video][1]
Changing these two variables from client to server sides don’t replicate, but from server to client works well. How can I fix this?
So the problem here is that things never replicate from client to server (the character movement component has special code inside that handles this for movement input). So if your variables are set to replicate then you need to set them on the server and then they will replicate out to the client. If you have any kind of lag though you won’t get an instant response so you really want to set them on both the local client and the server.
Do something like this for each variable. The custom event executes on the server and is reliable. It takes the setting from the player for what to set it at.
Glad you got it working. That’s weird that making it reliable would cause that kind of problem.
You have to be careful with spawning on the server and sending the command back to players if they have some lag it will feel like the game is super unresponsive and slow.
I would use a console command in the level the put in some lag around 100 or 200 ms to see how it responds under possible expected network conditions.