Client mistakes itself for server!

Hnomer
Fri, 28 Jul 2017 22:35:58 +0000
Multiplayer & Networking

Hello! I was testing my simple multiplayer game and met a strange client behavior right after the client enters a server. In multiplayer simulation advanced settings, I unchecked “Use Single Process” to test some join-in-progress stuff. So server gets started like 10-20 seconds before clients loads in. In the character blueprint, I have a switch authority right after Begin Play. When the client enters the server, the client actually sees the message that was meant to be seen on the server, meaning that the client somehow went through switch authority having that authority, then the client sees the message for clients twice (that is ok because at that time there are 2 instances of characters: the server and the client).
So the way to reproduce this is:

1.Create character blueprint and set it to replicate.
2. From character blueprint BeginPlay event call Switch Authority and then call Print String with different messages for both Authority and Remote.
3. Inside GameMode set that character to be controlled.
4. Inside multiplayer simulation advanced settings disable “Use Single Process” (with this option disabled, messages won’t broadcast from client to server and otherwise, so they both will see messages, that are only executed in their worlds).
5. Set Number of Player to 2.
6. Start simulation in a New Editor Window.
7. Pay attention to what message server sees on his initialization.
8. After client loads ready his messages.

Not definitely sure that this is a bug, but for me, it looks just like one.

Additionally, after you test, whats above, you can make delay in at least 1 second after BeginPlay and only then call switch authority with messages and you’ll see the difference.

The expected behavior is: when the client joins he sees “remote” message twice, and server sees his “authority” message once.

2 posts - 1 participant