| ... | ... | @@ -91,6 +91,13 @@ As the Pawn is more involved, it gets its own [Pawn](#Pawn) section below. |
|
|
|
|
|
|
|
### Replication
|
|
|
|
|
|
|
|
The Toolkit contains a fairly simple replication approach that can serve as a baseline for your project.
|
|
|
|
Further resources on Unreal Multiplayer can be found in the [Multiplayer Network Compendium](https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/), which can be used as a nice starting point. This section does not want to teach replication in general, but just highlights where it comes to play in the toolkit.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
### Utilities & Fixes
|
|
|
|
|
|
|
|
**1. Utilities**
|
| ... | ... | |
| ... | ... | |