2.2 - Network Relevancy [Part 2 - Function Replication Solution Attempt]


In order to view both Server and Client perspectives, on the Play dropdown, set the Number of Clients field to 2.

This example attempts to network the chest's behavior through the use of a Replicated Multicast Function. The idea is that the chest will call the multicast when it is interacted with, which will handle playing the visuals of the chest opening for all of the clients.

However, to demonstrate relevancy issues, this chest has been modified to become network irrelevant at a very short distance. Stand the client outside of the blue ring and the chest will be irrelevant to the client, even though it is visible. Now move the server to the chest to activate it and observe what happens on the client. The client does not see anything change at all! This is expected, as the chest is not relevant to the client yet. Move the client into the blue ring, causing the chest to be come relevant. Now what happens? Still nothing, which is not what is desired.

The issue with this solution attempt is that all of the actions related to updating the chest were sent through a replicated function. The client did not receive the function call do to relevancy and never executed anything to open the chest.

Blueprint Breakdown

In the BP_Relevancy_Replication_RPC Blueprint's Event Graph, you will notice that it inherits from the 2.1 example, however some modifications are made (also a ring is generated to demonstrate relevancy distance for this example). First, the OnChestTouched function is overriden and a new Chest Touch Multicast event is called. The Chest Touch Multicast event is called on the server and will then replicate the event to all remote machines since the event is set to Multicast.

Click for full view

The Chest Touch Multicast event itself then executes the Open Chest and Play Gold FX fuctions from the parent Blueprint which handle opening the chest and playing the associated effects.

If the chest is not relevant however, the client will miss the execution of this part of the script as seen in the images below.