x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Blueprints - Rotation of pawn is only set on first call

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:

alt text

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:

alt text 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:

alt text

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

Product Version: Not Selected
Tags:
more ▼

asked Nov 28 '14 at 08:20 AM in Blueprint Scripting

avatar image

Huppys
68 3 4 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I got it! Finally! The key component was the replication of the root component of my player character.

I forgot to set the actor root component replication to true. It seems a replication of an actor is not necessarily able to set the rotation of an other actor. The default player pawn of my scene, set in a custom Game Class, contains all logic for the component replication. I made sure the pawn is not rotated by the controller as well as my camera is independent from it.

At "Event Begin Play" I set the replication for the root component, the camera component and a (I guess the right name is) scene component (acting as a child of the root component but as a parent for the camera component) to true.

For the authority in the game: Mouse and keyboard input move the root component of a character "with authority". So I made sure my whole blueprint is mostly executed on a machine with authority by the node "Switch has Authority". The root component only gets rotated around its yaw. Only the child scene component gets rotated around pitch and roll. The camera component has a relative rotation of (0; 0; 0), relative to the scene component.

For all remote players: Their location is determined by the authority. So the location of the root component just gets replicated and can be read by the remote clients. Their root component yaw rotation is set by the authority/server. Their scene component pitch and roll rotation is set by the authority, too (based on its pitch and roll). For each remote controlled player in the game, the camera component gets a relative rotation around yaw: Index in array multiplied by 45 (from 45°, I have eight cameras in this scene for a 360 degree projection) and substract 45°, so the second remote player is seeing the same as the server.

In the end not that complicated, if you understand the principles of pawn replication, variable replication and component replication. In this case no pawn replication nor variable replication is set. Only component replication.

This is the final result:

alt text

Best,

Huppys

more ▼

answered Dec 11 '14 at 12:04 PM

avatar image

Huppys
68 3 4 9

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question