Lag Spikes - Server and Client on Same Machine (cont'd)
-
I encountered this same issue as the other thread with the same name and resolved to try to figure out the cause.
Original Thread (2016):
https://the-starport.com/forums/topic/5790/lag-spikes-server-and-client-on-same-machineSimilar Thread (2010):
https://the-starport.com/forums/topic/2600/odd-lag-running-fl-and-server-on-same-machineTo bring others up to speed (again), the issue only occurs when running Freelancer on the same machine that you’re running FLServer. There are frequent stutters that result in the imagine freezing and the mouse unable to move. This is very disruptive, particularly in combat. It does not affect clients connecting to FLServer from a different machine.
The only thing I could come up with is that 0 Ping causes problems with sync. FLServer is not fast enough for 0 ping and the client will pause waiting for data from the server; particularly NPC spawns. I guessed this might be the problem based on my very crude knowledge of MP programming in Unity. MP coding, due to latency, is like trying to predict the future and to rubber band everyone back in place.
The fix? Introduce lag/latency.
There is a utility used to introduce artificial lag to Localhost (ie. 127.0.0.1 loopback) called Clumsy. Running it with a Lag of 125ms causes a return time of ~500ms according to the server selector. This in turn creates a buffer for FLServer to get “ahead” of the client.
While this did not eliminate all pauses, it did eliminate the majority of them. From multiple times a minute, sometimes back-to-back, to only an occasional one every ~5 minutes for me.
I hope that someone else can test this and see if it also works for them. There may also be better utilities to accomplish this. I don’t know what effect this will have on other clients, but if you’re playing alone on a server you’re running at least it will minimize the freezing.