Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
9
Question by ReaktorDave · Jun 24, 2015 at 10:27 AM · physicsnetworkingmultiplayer

UNET Network Transform Component lags

I'm using the Unity 5.1.1 UNET network transform component for a multiplayer game. Movement is done by using the rigidbody2d component. However, even on clients running locally (=connected to "localhost") there is way too much lag between server and client.

You can use the following demonstration project for unity to reproduce my problem. Box2D Network Transform Demo Project

Simply open the ControlBox2D.unity file in the Unity editor. Build the scene twice, start one as host and one as client. On the client window, press "s" to make your coinbox jump. On the host, press "s" to make your coinbox jump together with the client's coinbox on top of it. Notice the input lag on the client side.

The jump is done by adding a force to the object's rigidbody2d.

On the Cube2D prefab (it's located in "Assets/Scenes") you can check the settings of the Network Transform Component. It is set to sync it's Rigidbody2D. Using syncmode "transform" would produce very jittered movements. Next, check the Network Identity Component. It is not set to "local player authoraty", as this would not allow the coinbox below to jump. The coinbox above it would refuse to move it's position if set to "local player authority".

Now on the Cube2D prefab, activate the option "Client Side Prediction". This should reduce input lag on the client by adding the force on the server and on the client. However, all I'm experiencing is jittered movement.

For testing purposes, I deactivated the network transform component and activated the option "ClientSidePrediction". This way, I bypassed the network transform component and only relied on rigidbody actions being correctly sent over the "network". Due to scripting, it only works when pressing jump on the client! Interestingly, I cannot observe any input lag neither on the server nor on the client and the movement is completely smooth.

So my questions are:

  1. Why does the Unity Network manual recommend to use "local player authority" when it obviously breaks the physics system for all clients?

  2. Why does the UNET network transform component introduce that much lagging by default even when connected through localhost?

  3. What is the best workflow for making the rigidbodies sync smoothly in multiplayer games without adding any artificial latency on top of the internet latency? Should I avoid the UNET network transform component for a multiplayer game with physics based movement or am I using it the wrong way?

networktransformlag.zip (126.9 kB)
Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cariaga · Aug 04, 2015 at 04:25 AM 0
Share

wow nobody answered? I'm curious too.

avatar image sovredcat cariaga · Sep 18, 2015 at 01:02 PM 0
Share

Did you ever figure this out? In my project it's smooth for me on the host but on the client it lags behind a lot.

avatar image james69lemon · Sep 26, 2015 at 01:36 AM 0
Share

Yeah I too would love an answer on this. I'm curious if I'm doing something wrong or if UNet might just be slightly limited at the moment

avatar image ODINKONG · Oct 13, 2015 at 08:34 PM 0
Share

Why hasn't this been answered? I just got 5.2 and the network transform is even worse that it was before. I am able to set the send rate to 0 for the player and it is smooth as butter. However when this is done on an enemy object the enemy doesn't move at all. Setting it to 29 seems somehow much faster and smoother than setting it to 1. This makes no sense what so ever to me. I really need some help here.

avatar image BGog ODINKONG · May 10, 2016 at 01:32 AM 0
Share

Why wouldn't it be smoother when you set it to 29 vs 1? It is how many updates to send per second. So 29 updates per second will be faster and smoother than 1 update per second.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ODINKONG · Oct 15, 2015 at 04:14 AM

ok I seem to get a pretty good sync if I set the send rate to 29 and make the snap very high while keeping the movement threshold and the interpolation low. However it still seems very in accurate in intense quick combat situations.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chom1czek · Nov 19, 2015 at 01:58 AM 0
Share

It doesn't look bad as it was before or I just got used to it :D

avatar image
0

Answer by zfscgy · Jun 21, 2017 at 03:49 AM

If only using the command functions to sync, sometime server and client will accumulate very small offsets to a very big one, especially when the game is large and need a lot of physics...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

best way to make a multiplayer physics heavy game (3000+ rigidbodys) 2 Answers

Networked Physics 0 Answers

Changing rooms and spawning players with Multiplayer Example 2 Answers

bouncing a puck of a vertical wall through code 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges