#NetworkTransform appears laggy on Host / Server Only

40 messages · Page 1 of 1 (latest)

burnt kindle
#

Hi! I'm new to Mirror and have been encountering an issue:

I'm testing a sample project using the default Mirror NetworkManager / NetworkManagerHUD with KcpTransport. My sample lets me spawn player prefabs that can be moved around with the arrow keys, and they each carry an Unreliable NetworkTransform in Client to Server direction.

To test I would typically open two built instances of the application and have one run as Host / Server Only and have the other run as Client. My issue is that movement of the client on the Host / Server instance appears very laggy. It looks like the client is teleporting around, almost like interpolation is turned off (I have it checked on in the NetworkTransform, so that's not the issue).

Interestingly, this only happens on instances running as Host / Server. If I open multiple clients, movement appears smooth on all clients - however, the Host remains slow and laggy. You can see what this looks like in the attached video. The video also shows that movement "fixes" itself over time by becoming smoother. Unfortunately, it doesn't always fix itself and the host will remain like this indefinitely.

I'm running Mirror on Unity 2019.4.33. I was wondering if anyone else has encountered this issue or knows more about what's going on?

I tried following this series of messages #🤝help-archive message but it didn't seem to help - I also see the same effects on the Tanks sample project. Maybe it has something to do with my particular project?

stable lynx
#

Yeah thats not normal, something to do with your unity setup or even pc.

#

Could you add an fps counter (frame rate, theres one in mirror folder)

#

And the ping prefab, so we can see latency.

#

Theres usually multiple causes.

#

You crossed out IP, are you testing localhost, or Lan/Wan IP?

burnt kindle
#

Thanks for the response, I'll provide the debug information you mentioned!

For your last question, I tested both localhost and LAN. The video is localhost (running on the same machine) but I left my device's IP in the field, so I blocked it out - but I suppose that's the same result as localhost. I also tested LAN on two separate machines connected to the same WiFi. I was able to connect as usual, but I still see similar behaviors.

stable lynx
#

Please test this with something like tanks example, so we can rule out anything you’ve adjusted. Will speed up the process.

burnt kindle
#

Here's a video with the sample scene Tanks. I added the "FPS" script and the scene already contained the "NetworkPingDisplay" script which I assume is the ping prefab you mentioned. Besides these, I haven't made any other modifications.

This time, we are explicitly running server and client on the same machine via localhost. The same behaviors were observed over LAN.

Left is the Host, and right is the Client. You'll see a similar behavior as my sample project above. I also noticed that the shooting falls behind a bit due to the angle of the cannon not synchronizing properly?

#

Let me know if there's any other information I could provide.

stable lynx
#

sweat how

#

Fps and ping look fine on both

#

I wonder if its unity 2019 version
Do you have 2020 or 2021?
Which mirror version roughly are you on?

#

@burnt kindle

burnt kindle
#

I have a suspicion… I’m on Unity 2019 and I’m using the Mirror 82.1.0 package from the GitHub releases

#

I’m kind of trialing Mirror right now (so haven’t purchased LTS) but the Mirror page on the asset store says it’s compatible all the way to Unity 2019, so I thought the latest package might still work? If I misunderstood the compatibility, would that be causing issues?

#

I do have a target for Unity 2019 in the short term for a project I’m working on. Is LTS required in this case?

stable lynx
#

Some Mirror code is different between unity versions, as Unity like to add or remove things 😁 its just one theory.
As the fps and ping being normal blew my first theories out the window.

#

ThinkEyes Not sure what else

#

Does same happen between editor and a build?
Or two editors

#

(All localhost is fine)

burnt kindle
#

Yeah, I see the same things between Unity editor and builds. Strange...

#

I think I'll try on a newer version of Unity to see if that changes anything. Do you have any other recommendations?

burnt kindle
#

Hmm... well it looks like the problem is fixed if I upgrade to Unity 2021 and run Tanks with an identical setup. Strange 🤔 but that rules out an issue with my specific PC.
Mirror does say it supports Unity 2019 - would this be a case that you need to use LTS? Or is there a last-known Unity 2019 version I could test out first?

stable lynx
stable lynx
burnt kindle
#

Awesome, I'll try that too. Is this with the latest Mirror version?

burnt kindle
#

Hmm... it still doesn't work for me on 2019.4.40, I see the same behaviors as before 😓
I tried 2019.4.40 with Mirror 82.2.0 on both Windows and Mac but I see the same results

#

Questions:

  • did you try it more than once? It seems like the networktransform fixes itself sometimes but not others.
  • is there any specific way you set up your project? Maybe something's off on my end. All I'm doing is creating a brand new Unity project and dragging in the Unitypackage from GitHub releases.
stable lynx
#

Im using mirror master, should be similar enough to latest release package.
🤔 It was definitely okay with non-2019 for you?
@burnt kindle

burnt kindle
#

Hm, I see... yeah, Unity 2021 has no problems and I tried connecting/disconnecting multiple times and stress testing it and it still worked

#

But not sure what may have changed from then to now

stable lynx
#

Searching Mirror folder for ‘2019’ probably has some defines that’l lead to different code depending on unity version.

#

Its sleepy time for me now, so will look tomorrow, unless yourself or someone else beats me too it.

burnt kindle
#

Cool, if I have a chance I'll take a look and see if I can find anything

#

Really appreciate the help so far!

brazen palm
#

Did you solve the problem?

burnt kindle