- Home /
NetworkManager Simulation Testing
Hi All,
I'm trying to improve my Unity multiplayer coding but I've been struggling a lot when dealing with basic lag.
I created a simple example by having a basic 2D player object with a player controller script that allows the player to move up/down/left/right.
From here, I made the net coding as efficient as I could. When a player changes direction, the new direction is [Command]ed to the server and then [SyncVar]'d back to all clients. When this happens, the player position is also SyncVar'd just to keep the objects locked nicely among clients. The packet transmission for this example is very, very light. Essentially, when a player changes directions, two Vector2D's are sent over the network. Nothing crazy.
This example runs flawlessly when I run two instances on the same computer. However, when I use this example on two different computers over the same LAN, which couldn't be more than 20ms latency, there is lag / odd behavior. Using the NetworkManager's network simulator on 200ms setting practically breaks the simple example.
Am I doing something that is fundamentally incorrect? Is there something that I am misunderstanding about Unity network coding? Is the Network Simulator working at all? If I can't even get any of my multiplayer projects to run over a LAN, how do people somehow create complex multiplayer games using Unity successfully? Anyone have good documentation on Unity network coding regarding this issue or best practices?
Thanks in advance!
Mr.Muffles
Your answer
Follow this Question
Related Questions
Lag Compensated Projectile 0 Answers
Multiplayer Game Highlight Material 0 Answers
how to sync object active with unet 0 Answers
Multiplayer 2 Answers
MLAPI spawn player prefab 2 Answers