[Network] Actor is Destroyed on 1 Client with no reason

Hi guys,

I am currently working on a multiplayer project, in which there is 1 or 2 “Players” and a “GameMaster” (which lead to 3 Clients).
At first I had the GameMaster being also the host (Server + Client), but now I am trying a dedicated Server, so the GameMaster is just another Client.

The GameMaster can teleport (change location) forcefully of the Players, and can also see through their eyes. I had really no problem doing so in the first architecture as it was on the Server.

Now I tried to adapt my code, and it seems to be finally done, BUT I have a really weird bug which appears:
When I teleport a Player character on SOME locations, its Character is being Destroyed around 5 seconds after the teleportation on the GameMaster’s client, but NOT on the Server neither on the Player’s client. What’s really weird is that it happens only on 2 locations and not on the others, and I never call any “Destroy” on the actor.

Here is the piece of code which do the teleportation from the GameMaster Pawn

Some insights:

  • ToServer TeleportSelectedUser is called from an “empty” PlayerController’s ActionInput Event
  • PostTPEvents is really just some minor calls such as hiding an object or activating a function
  • GetUserPawn / ChangeUserMawn are really just getters and setters. With (Server + Client) architecture, I was able to keep directly the PlayerController of the Players, but now the GameMaster client can’t know the other PlayerControllers, so I have done this workaround which is storing the Pawns instead and adding an index on my PlayerControllers.
  • Apart from few changes such as the previous one and handling some more networking, this code is almost exactly the same as what was fully functional with the (Server + Client) architecture for the GameMaster.

Does someone have an idea of what could trigger the “Destroyed” event of the PlayerCharacter of the other Player ?

Thanks,

It becomes weirder:
When the character is destroyed on my GameMaster (Client 1), if I decide to teleport the Player (Client 2) on a “good” location, it works well, and a new character is created on the Client 1, which behave normally (replicates movement from Client 2 etc).

But then, if I again decide to teleport it to a “bad” location, the character is once again destroyed with no reason…

I can’t understand what’s different between the “good” and “bad” locations, even less as when the GameMaster was a (Server + Client), everything worked fine !

I have found a workaround, and probably a start of understanding what was going on, but it is really not enough for me and I’ld like to have a full and proper answer. So I won’t my mark my question as “Solved”.

My GameMaster (Client 1) pawn was a Spectator pawn. I noticed that even when the Character for the User 1 (Client 2) was destroyed on the Client 1, it wasn’t neither on the server (as i said) nor on the User 2 (Client 3). The only difference I have found is the Users were using Character and not Spectator Pawns.

So, now my GameMaster uses also a Character and everything works fine. Nothing gets destroyed without reason. I guess the fact of being a Character raises some kind of flag saying that “I really to know everything’s happening” and not “I am here but tell me only what you considered is important to me”. I don’t know enough of UE4 inside out to fully understand this, but this is my guess.

Nevertheless, if you get a similar problem, you know how I found a workaround, but I am still waiting for a proper explanation.