How to control the movement of client character from server?

I have learned the basics of the networking. and i am little bit confused on one thing

1. I want to control the player of the client like its movement from a server (listen). is this possible ? if yes can someone guide me on to this one as i am the beginner

Hi mohaib21

Any position changes will need to be sent to the server. As a rule of thumb, it is better to apply the movement on the server and have it replicate naturally down to clients.

Sometimes this isn’t possible such as multiplayer VR.

For multiplayer VR, the HMD and controller tracking is purely client-only, so you have to manually push the updated transforms to the server and get the server to broadcast the new values to all other connected clients. However, this is extremely expensive and often you need to add interpolation to make the movement smoother. Basically, the owning client will send an update every few frames (as every frame would be too much for the server to handle depending on how many clients are connected). In between these frames, logic on the client will smoothly translate the movement of the object in the world.

Hope this makes sense.

Alex

Basically you’ve got to push client player data (transforms) to your server. This can be stored in a .CSV file or some other type of data format. You must manually push data from the client to the server. Then you must make your changes to the data inside of the data file in the server. This means making custom functions with an Unreal install on the server. This can then get pushed back to the client.

Hello Alex,
thanks for the detailed answer and your time.

let me explain you what I want to achieve may be u can guide me in right direction.

actually I am making something like a remote or a wireless gamepad .
(A controller(server) as an application. controller other client.)
what should be the correct method of doing such thing?

Thanks

Hi mohaib21

I still don’t think I am following what you’re trying to do, I think it’s because of the terminology. However, I will point out a few things.

I just want to be clear, when you are using a listen server, the window which says “Server” is NOT the server. It is the client who is responsible for initializing and termination of the server.

So what you are seeing in the “Server” window is not what is happening on the server, its just another client window, so be careful you’re not getting confused by that.

Each client will have their own controllers (player controller). These controllers get registered with the server through the GameMode (see OnPostLogin). Player controllers are selfish objects in the sense that they cannot communicate with other player controllers. For instance, if you fire a Multicast event on a player controller, only the instance where the multicast was called will receive the messages.

If you want to send messages from one player controller to another, you will need to invoke the GameMode or another object to work as a “middle man” between them.

You can take a look at this question I answered: https://answers.unrealengine.com/questions/995167/spawning-a-number-of-actor-from-a-variable-of-play.html

In one of my later answers, I provide a PDF with a basic explanation of how messages can be sent between player controllers via the Game Mode.

I hope this is a starting point. If you still would like further help, please provide more information about what you’re trying to do. I.e. what are the core mechanics, how will users interact with the clients. What information do you want sent between the client etc.

Good luck

Alex