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"

Replication Question

Im very new to networking and Im struggling with the logic of how Replication works.

My main question is how does this not print the ints on every client?

alt text

My understanding is that the SERVER will collect the Random Ints and then I can tell all of the clients to print this number passed by the RPC, am I missing something basic or is this a bug? Thanks in advance!

Product Version: UE 4.22
replication2.png (152.9 kB)
more ▼

asked May 07 '19 at 08:42 PM in Blueprint Scripting

avatar image

13 3 7 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Replicated Actors are first spawned on the Server and then Replicated/Spawned on the remote clients. The Server can't send the RPC (Multicast) before the Client has spawned the Actor. This is why nothing happens when you call the RPC on BeginPlay.

Solution 1

Make a replicated variable set to "Instance editable" and "Expose on Spawn" and have the Server use SpawnActorOfClass and input the variable into the SpawnActorOfClass node. This will ensure that the clients will spawn the Actor with the variable already set.

Solution 2

Instead of using an RPC (Multicast) set the value in a variable set to "RepNotify". Then the Clients can print the variable in the OnRep_ function. Replicated variables might skip intermediate values as it only sends the latest value if it can.

more ▼

answered May 07 '19 at 10:15 PM

avatar image

901 3 4 8

avatar image ProzackPH7 May 09 '19 at 01:06 AM

Thanks, I ended up going to the Slacker Discord and got help there and it helped me understand what I was missing. Basically I didnt understand the concept of Actors being spawned at different times.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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