Hi everyone,
I had another question in the past. Short version: “How the heck is the pawn-controller-principle working?” You can read the details at the end of this post.
Finally I understood the principles of a pawn, a character and a controller. I got like this:
A Pawn is an accumulation of multiple components, held by a wrapper. A pawn can hold a mesh, a transform component and many more components.
A character is a special pawn. Usually, it has a move component and a camera.
A controller can possess a character. By this a player can give inputs to the controller that will move the character (or any other pawn).
I had to understand this to set a clients position and rotation on a server and the send the updated values to the client.
But the rotation only gets updated on the first call. This is my blueprint:
In this given BP I set the transform of the player pawn on the listen server as a variable and replicate it. This transform is applied to a client player pawn with a slight modification: the clients yaw rotation value should be 45 degrees lower than the listen servers yaw rotation value.
When I start the game it looks like this and it’s correct:
The upper window shows the server preview of the scene. Player possess the PlayerController[0]. On the left you can see the visual representation of the client that spawned. It’s yaw value is -45.
But as I move I experience this:
The second player pawn is rotated correctly in the server preview but not on the client. What’s wrong with this?
If anyone could give me a hint I’d highly appreciate it.
Kind regards,
Oli
OLD QUESTION:
I’m struggeling with the understanding of CharacterController, Pawn and Character, especially when it comes to networks. Here is what I try to achieve:
Let’s imagine a multiplayer scenario. I got a listen server and up to 8 clients. The clients get controlled by the server. On the server I’d like to control a humanoid character in first person view. So he is based on the Character class, that has a camera. His transforms should be provided to the clients. They have to use these transforms to be set to the same position. The rotation will be modified on the client-side. The clients don’t input anything. They a just look into the scene (through a camera).
I’m able to set up a custom game with a custom default pawn and custom default character controller via blueprints.
But: What do I have to do to make the clients follow the server? Do I have to spawn a different character controller? What is about spectator pawns? From what class the clients have to derive from? Should I use AIControllers to control the clients?
I’m only working with blueprints due to the inability of reading c++.
Any bit of help is highly appreciated.
Best,
Oli