| ... | ... | @@ -96,7 +96,9 @@ Further resources on Unreal Multiplayer can be found in the [Multiplayer Network |
|
|
|
|
|
|
|
1. `RWTHVRGameModeBase`: The gamemode **only exists on the server**. It manages the new players and assigns the correct pawns as mentioned in the previous section. Be careful not to use it for client-side logic, as it simply won't exist there. However, it is very useful for functions you only want to be run on the server.
|
|
|
|
2. `RWTHPlayerState`: There exists one PlayerState for each player, and they are replicated to all other players. Therefore, this class is perfect for syncing information that is always relevant to all other players. As an example, the base class is extended by a replicated `PlayerType` variable.
|
|
|
|
3. `ClientTransformReplication`: In general, Actors/Components marked as "replicated", Unreal syncs basic things like their transform and attachment **from the server to the clients**. It does not sync transforms the other way round. If a player now modifies e.g. their pawn position, they only do this on their local machine. The `UClientTransformReplication` can be attached to your Actor to allow for Client-Side replication as well. It does this by simply sending an RPC to the server, asking it to modify the client position. This is then manually replicated by a UProperty marked as `ReplicatedUsing` to all the other clients. We're using a manual replication here for demo purposes and to save on bandwidth by using a different struct.
|
|
|
|
3. `ClientTransformReplication`: In general, Actors/Components marked as "replicated", Unreal syncs basic things like their transform and attachment **from the server to the clients**. It does not sync transforms the other way round. If a player now modifies e.g. their pawn position, they only do this on their local machine. The `UClientTransformReplication` can be attached to your Actor to allow for Client-Side replication as well. It does this by simply sending an RPC to the server, asking it to modify the client position. This is then manually replicated by a UProperty marked as `ReplicatedUsing` to all the other clients. We're using a manual replication here for demo purposes and to save on bandwidth. Ideally, we would only sync Inputs instead of full transforms.
|
|
|
|
4. `ReplicatedCameraComponent` and `ReplicatedMotionControllerComponent` are simple extensions to their base-classes that pretty much do the same thing as described in 3. Due to being in VR, we need to have some kind of client-authority, which is emulated in this way.
|
|
|
|
5. `VirtualRealityPawn`: The Pawn contains some additional functionality that searches and attaches the CaveSetup actor on the server to the Pawn corresponding to the PrimaryNode. This is then implicitly replicated to all clients, including the SecondaryNodes.
|
|
|
|
|
|
|
|
### Utilities & Fixes
|
|
|
|
|
| ... | ... | |
| ... | ... | |