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"

Multicast RPC Issue [Update 8/12]

Update by eXi 13.01.2016: I moved the problem to the Bug Report section to get someone from Epic to read this and share some knowledge. Main problem why i push this is:

"Reliable Multicast disconnects every other client than the Server and the Client on which actor it was called. I, for example, call this on a Component in my PlayerController and only the Client that owns the PlayerController survives this call. All other clients get killed or something :X"


I'm in the process of understanding how to program for multiplayer, and I've hit a strange bump. I'm doing a very simple RPC implementation in my PlayerController class:

 void AMyPlayerController::ServerSetColor_Implementation()
 {
     MulticastSetBarrel();
 }
 
 void AMyPlayerController::ServerSpawnBarrel_Implementation()
 {
     if (GetWorld())
         GetWorld()->SpawnActor<ADynamicReplicatedStaticMesh>(FVector(0, 0, 500), FRotator(0, 0, 0));
         
 }
 
 void AMyPlayerController::MulticastSetBarrel_Implementation()
 {
 }

I'm running a listen server. Using DefaultPawn, default GameState, default HUD, and a custom PlayerController blueprint that extends from my custom PC class (which extends from PlayerController). The only things added from the default PlayerController class are the functions provided above. I have _validate functions set up but have not included them here, except for the multicast function which doesn't seem to require one.

ServerSpawnBarrel and ServerSetColor are called from blueprint input events in the PC blueprint. MulticastSetBarrel is not exposed to BPs. The ServerSpawnBarrel function runs without any issues. The issue arises when I call MulticastSetBarrel (called from ServerSetColor, which runs from an input event). If it is called from the server instance, all connected clients' camera snaps to the center of the world and the screen goes black after a few seconds. If the multicast function is called from a client (via the client calling ServerSetColor), the calling client and the server are unaffected, but any other clients' camera snaps to the center of the world and the screen turns black after a few seconds. Why would an empty multicast function cause such behavior?


UPDATE 7/15

To insure that there wasn't some unknown thing in my project causing the issue, I created a new Basic Code project. The ONLY thing I changed in the generated code was adding this one multicast function to the PC.

 UFUNCTION(BlueprintCallable, Reliable, NetMulticast, Category=Network)
 void MulticastTest();

 void ANetworkTestsPlayerController::MulticastTest_Implementation()
 {
 }

Calling this function from BPs on the server/listen client causes the same issue on all other connected clients. Am I just implementing multicast functions incorrectly or is this a bug with the engine?


UPDATE 7/16

I've downloaded the preview 4.3 build and the problem persists.


UPDATE 7/18

Setting the multicast function to Unreliable allows it to be called without killing the pawn (I assume that's what's happening?). However, I looked through the shootergame code and found a reliable netmulticast function, and I assume it works as it should. What's the trick?


UPDATE 8/12

I'm still having issues with this, so I set a breakpoint in VS and stepped through a ton of code. The general sequence of events is as follows:

  1. Input causes the reliable multicast function to be called on the server

  2. The multicast function DOES run on the client

  3. Immediately after the multicast function is run on the client, some deeper engine code is run

  4. In 4.3.1, DataChannel.cpp, line 1550, ProcessBunch(), the following happens:

  • The Actor variable is for some reason NULL

  • This causes SpawnedNewActor to be set to TRUE

  • From what I can tell, this causes the PlayerController to be re-initialized, and BeginPlay() is called

  • After pressing Continue in VS to resume running the game, the client loses control and the screen goes black after a few seconds, suggesting that the PlayerController has been despawned

All of this simply because I called a reliable multicast function.

Product Version: Not Selected
Tags:
more ▼

asked Jul 09 '14 at 11:39 PM in Bug Reports

avatar image

James Ordner
382 16 17 25

avatar image Osman Jul 14 '14 at 04:19 PM

I'm having the same problem. In 4.2 at the moment.

avatar image uced Dec 01 '14 at 06:04 PM

Hi,

Same problem here, in 4.6 preview.

Cedric

avatar image uced Dec 02 '14 at 11:32 AM

Not a solution but a workaround.

I used instead a replicated variable with notification on replication (ReplicatedUsing = OnRepFunction).

You can create a dummy replicated variable for the occasion if needed. Changing the variable on the server will trigger the OnRepFunction on every clients.

avatar image eXi Jan 13 '16 at 09:25 PM

Still having this issue when calling a "Reliable" multicast in a component that sits on my PlayerController.

Could someone from Epic explain us why this is happening?

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

5 answers: sort voted first

Hi,

Have the same problem with reliable multicasts in 4.6.1. (black screen, position reset, blocked input from other gamepads, even "shift + F1 does not function", etc..) Seems to be a bug. https://answers.unrealengine.com/questions/97569/client-cant-join-a-server-if-server-is-running-rel.html

more ▼

answered Dec 25 '14 at 06:27 PM

avatar image

Timbo
65 2 5 7

avatar image Matthew J Jan 14 '16 at 03:32 PM

Hello everyone,

This is very delayed but it seems that Timbo's question got the attention of Dave Ratti who gave a very detailed response in the link above and seems to of fixed the issue. If anyone is still having this problem, please refer to the other post for more information.

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

Setting the multicast function to Unreliable allows it to be called without killing the pawn (I assume that's what's happening?). However, I looked through the shootergame code and found a reliable netmulticast function, and I assume it works as it should. What's the trick?

more ▼

answered Jul 20 '14 at 03:59 PM

avatar image

James Ordner
382 16 17 25

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

I have now switched to 4.3 and the problem seems to be gone. Not sure what was wrong.

more ▼

answered Jul 20 '14 at 10:31 PM

avatar image

Osman
149 12 16 22

avatar image James Ordner Jul 21 '14 at 06:26 PM

I downloaded the binary 4.3 through the launcher (I usually use source) and the problem still persists. Did you do anything different at all?

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

Hi everyone,

I am having a similar issue right now and I might know the reason for this. This issue happens in my weapon equip code. I am using a Multicast function to ensure the actor equips the right weapon on all machines (yes I know I could do that with a replicated variable with notification). On the Server everything runs fine, but on the client the weapon I am passing as an argument is NULL. My guess is that this happens because the weapon actor was not yet replicated to the client machine. Why? Well I doubt that the engine sends the whole actor everytime you pass an actor variable as an argument to a RPC. I did not look in the engine source code, but I would guess that instead an actor identifier is send over the network and once received the engine does a lookup, finds the appropriate actor and passes that actor to the implementation of the RPC. (Well I would implement it like that)

That would also confirm uced's answer. He said to use a replicated variable with notification. But doing that he ensures that the function is only executed once it is guaranteed that the actor was replicated.

To summarize: The solution to this problem is to ensure all actors referenced in a RPC are replicated. I am going to test that out with my own implementation and see if I was correct.

I hope I managed to help someone with that answer.

more ▼

answered Dec 21 '14 at 11:28 AM

avatar image

jtpgames
21 1 5

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

The issue is that multicast rpc's should never be reliable and if they are, should only be called when all connections have finished logging in. I posted an answer with greater detail and possible solutions HERE.

more ▼

answered Dec 29 '14 at 12:15 AM

avatar image

MJ_01
822 38 39 241

(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