Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by LK84 · Jan 12, 2017 at 10:19 AM · physicsnetworkingserverclientsynchronization

Networking physics with HLAPI

Hi, I'm creating a very physics heavy based multiplayer game. So far I have tried three options for the physics calculations:

  1. All physics calculations are run by the server and all GameObjects whose movement depends on the physics have a NetWorkTransform component attached.

  2. All physics calculations are done locally by the clients.

  3. Physics calculations are done by server andall clients and I'm trying to synchronize them with NetworkTransforms

All 3 options causing issues:

  1. Causes discontinuous, non-natural looking behaviour on the client side

  2. Since physics calculations are not deterministic + delayed Input due to latency leads to different movement on all clients and sometimes different game results

  3. Actually the solution I am most optimistic about to work, but right now it's pretty jerky. I think thats because every frame the server is correcting the clients calculations (What is actually the right thing to happen but I'd prefer to have it smoother).

I'm wondering if there is any chance to get this work using UNETs HLAPI. Or is using NetworkTransform not sufficient and I have too look deeper into how Network Syncing works and maybe use the LLAPI/ Transport Layer (Haven't worked a bit with it yet and was hoping to avoid it).

Comment
Add comment · Show 3
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 LK84 · Jan 12, 2017 at 08:50 PM 0
Share

Setting the Netowrk Transform Send Rate to the maximum value improves it a little bit but still not perfect and I'm not sure if this is the optimal solution

avatar image ThaiCat · Jan 14, 2017 at 01:15 PM 1
Share

There is a chance to get this work using UNETs HLAPI, but using NetworkTransform is absolutely a no-go. I had the same issue or maybe still have it. $$anonymous$$y solulution was to make custom NetworkTransform, in which i sync needed vars just via [SyncVar] attribute, and a Networktime class to have a reference to a time variable that is exact same for everyone. then in my NetworkTransform i calculate predicted position and rotation, that should happen not now, but when next sync event occurs, and change rigidbody angular and normal velocity the way, it will be in that calculated position and rotation when next sync event occurs. Works 10x times better than unity's built-in NetWorkTransform, but still poorly. Has it's own bugs if not synced for a long time, because physics is very very different from what is happens on server

avatar image LK84 ThaiCat · Jan 14, 2017 at 01:26 PM 0
Share

Thx, right now I'm really considering swithing to PHOTON. All the tutorials and documentation about UNET just seem to scratch the surface.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mhernandez88 · Feb 12, 2018 at 11:29 AM

For #3 you are going to want to seperate two ideas Interpolation and Extrapolation. You are also going to want to have a couple of variables Position Snap Distance - how far off do we correct Rotation Snap Distance - how far off do we correct Interpolation Back Time - how far back do we go in messages in order to smooth Extrapolation Time Limit - how far forward can we extrapolate physics Extrapolation Distance Limit - how far from last network position can we extrapolate physics

Extraplation will consist of basic calculations using rigidbody properties.

You will want to make sure to be syncing Velocity and maybe even Angular Velocity

I am currently working on this, I got the smooth syncing working mostly, but you need to fool around with the variables.

By the way, you are going to need to simulate latency and update interval

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

111 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 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 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 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 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 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 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 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

Need help getting "Server Reconciliation" to work. 0 Answers

Sending texture updates from client to server 1 Answer

Unity networking tutorial? 6 Answers

How to check when a new client/local player is loaded? 1 Answer

How can i make multiple game instances in one server or multiple servers? 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