Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Skidmark · Jun 06, 2012 at 07:45 AM · networkingtransformmultiplayerposition

Network Tutorial Interpolation - TPS Auth

I am going over the tutorials now and trying to understand the nuances of interpolation. Using the Authoritative Server scene provided in the Network Tutorial, Lerpz get spawned and can run about atop a small plane.

I have modified this script to make the MainCamera for the connected player track his Lerpz instance. This caused problems that I can solve with input axees. But as I was trying to solve them, I carefully examined the GraduallyUpdateState script to figure out why interpolation wasn't addressing my problem. I noticed something that I don't understand.

I don't think that the client Lerpz facings are being corrected, just their positions. Is there a reason for this? An array of State structures is being carefully maintained and one of the attributes of this structure is the Quaternion "rot". Yet when the client Lerpz position is out of tolerance, only the position gets updated. The facing is never checked against rot, nor is it updated.

Please tell me why. Is the rotation somehow corrected elsewhere? Does it never need correcting? Is correcting it more trouble than it's worth? Code follows.

GraduallyUpdateState.cs:

     internal struct  State
 {
     internal double timestamp;
     internal Vector3 pos;
     internal Quaternion rot;
 }

 ...
     Vector3 m_NewPosition;
 ...
     IEnumerator MonitorLocalMovement() {
     while (true) {
 ...
             else if (m_PredictionAccuracy > m_PredictionThreshold) {
             
             // Find how far we travelled since the prediction failed
             Vector3 localMovement = m_LocalBufState[j].pos - m_LocalBufState[0].pos;
             // "Erase" old values in the local buffer
             m_LocalStateCount = 1;

             // New position which we need to converge to in the update loop                
             m_NewPosition = m_BufferedState[0].pos + localMovement;

             // Trigger the new position convergence routine                
             m_FixError = true;
 ...
             }
     }
 ...
     void Update () {
     double currentTime = Network.time;
     double interpolationTime = currentTime - m_InterpolationBackTime;
     if (m_IsMine && m_FixError) {
         Vector3 difference = m_NewPosition - transform.position;
         transform.position = Vector3.Lerp(m_NewPosition, transform.position, difference.magnitude);
 ...
         }
 }

}

Comment
Add comment · Show 2
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 nastasache · Sep 03, 2012 at 01:35 PM 0
Share

I am facing with the same kind of question, spending time with no success in understand how Lerpz rotation it's passed/working/corrected on TPS-Auth example. Position looks passed via RPC (as keyboard inputs values), but rotation are not passed via RPC and I don't understand how it is corrected by Gradually Update State. I'am trying to adapt the TPS-Auth example to a FPS-Auth one, but I'am in running in some headaches with rotating the character using mouse. $$anonymous$$aybe the input mouse have to be send via RPC along of keyboard inputs, prior of correction rotation with State Synchronization? If don't use keyboard, Quaternion rot = transform.rotation looks missing point (whatever, nothing about rotation are serialized ) since we don't have any RPC about rotation. Processing and correcting rotation maybe it's a lot more complicated. I am deeply lost in understanding this schema.

avatar image Skidmark · Dec 27, 2012 at 03:42 AM 0
Share

I haven't been working on this since the end of my summer vaction. Sorry for the delay. I am gradually revisiting the my project.

First off, approach-wise, using the $$anonymous$$ultiplayer Tutorial resulted in a lot of convoluted code and in the end, it still didn't quite work right. I managed to find a copy of the Zero to Hero Guide and that code was much more concise and it worked immediately. These days, the Zero to Hero stuff is more difficult to find. I think the person that created it now supports Photon Networking.

But I absolutely did have to also pass the rotation data from the server to the client where it overwrote the extrapolated rotation for the object.

I noticed things progressing out of sync, rotation-wise, after slam$$anonymous$$g the vehicle into walls. I think that there is a random element in these collisions that, if handled by both the client and the server, results in things getting increasingly desynchronized. You'll notice your vehicle's facing skewing worse and worse after each crash.

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Help|sync movement in multiplayer 1 Answer

Can you create a Stand alone server for your game? 0 Answers

a child object that inherits only position from parent 2 Answers

View PvP scores on screen in real-time 1 Answer


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