Download

Spawning actor in player controller causes movement lag for clients

I recently added a ClientHudMessages class that I spawn in the player controller (and set the client controller as the owner). It’s purpose is simply for sending replicated calls from the server to the client for hud messages (without having to send a whole string over the wire).

An example could be a pickup message. It only needs to pass the class name of the pickup item in the replicated call and then the actual full message can constructed on the client side and sent to the hud. Just a simple way of reducing data that needs to send over the wire during network play.

The weird thing that’s happening though is, after this class is spawned, it causes very noticeable movement lag for the client during network play (not in singleplayer).

Here is the code where I’m spawning it in the player controller:



simulated function PostBeginPlay()
{
    super.PostBeginPlay();

    if (Role == ROLE_Authority && ClientHudMsgs == None) {        
        ClientHudMsgs = Spawn(class'ClientHudMsgs', self);
        ClientHudMsgs.SetupFor(self);
    }
}
}


Does anyone know why this would cause movement lag for clients? Note: ClientHudMsgs extends Actor (so it can have replicated function calls).

Thanks in advance.