Client cant join a server if server is running reliable rpc
To reproduce this:
Client can join:
-Create a new project using THIRD PERSON BP template project
-Open level blueprint
-Add a custom event, set replication property to multicast, DONT CHECK RELIABLE yet
-Call the custom event on event Tick in level blueprint
Simply like this
-Launch the game with 2 clients, it work
now to reproduce the bug so the client cant join:
-Check RELIABLE property on the custom event
Is that even a bug or is it normal? if it isnt a bug how a client can join a game if the server is running a game with reliable rpc running on it ?
asked Sep 13 '14 at 12:06 AM in Bug Reports
In our latest main branch I've changed the functionality so that if a connection has no viewer (no PC or associated owning actor yet) it will not receive multicasts, whether reliable or not. The reasoning for this is:
The fix is straight forward. I don't think it will be in 4.7 though. You will need to add it manually until then. ProcessRemoteFunction looks like this:
(Adding the check to Connection && Connection->Viewer is what is important).
A side note!
You may want to rethink your approach if you are sending a multicast RPC in every tick. This sounds to me like you are replicating state via events. If you have some state that is constantly updating, you should replicate it via a replicated property and let the replication system handle sending it to everyone. RPCs should be used to replicate events. Properties should be used to replicate state.
answered Jan 09 '15 at 03:17 PM
Dave Ratti ♦♦ STAFF
I am sorry this post was not addressed earlier. I was able to reproduce this behavior in 4.5.1 and have entered a bug report for our developers (UE-4901). I will let you know when I see an update. Thanks for the report!
answered Nov 01 '14 at 07:33 PM
I've been digging through the source with 4.6.1. Your main issue here is that you are calling a reliable multicast on the tick event. Multicasts are designed for non gameplay important events and should remain unreliable. When made reliable, the call to the client is "forced". If the reliable multicast rpc is called before the client is done logging in, because it is "forced", it thinks it is a broken or new instance of a previous connection.
I came up with a fix but requires editing the engine source.
change \Engine\Source\Runtime\Online\OnlineSubsystemUtils\Private\IpNetDriver.cpp at line 320 from
Now, if the multicast is unreliable, it behave as before. But if it is reliable, it won't be called on the client until the Connections owning actor is not null. In this case, I believe that the owning actor needs to be a player controller or else the connection will still be closed.
Another option that doesn't involve changing the source code is to not use reliable multicasts until after all clients have connected to the host. If that is not an option, use reliable multicasts sparingly and it should be a very rare occasion that the connection is dropped when the client tries to join.
answered Dec 29 '14 at 12:01 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here