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 StrykerS. · Jan 19, 2014 at 02:03 AM · photonmultiplayer-networkingclient

How do I reconcile discrepancies between client side prediction and my authoritative server?

My problem is with my client side prediction system. Right now I'm using photon to do my networking and I'm using the master client as the server.

When I start to move everything seems to work fine but over time the simulation on the server and the predicted movement on the client de-sync. I tried just using a lerp to move the client back to the last known good state but the de-sync happens so often that the jitter makes the game unplayable.

Both the client and server use the exact same commands for translation, physics have been disabled, and the server receives the players inputs via a buffered RPC call so I'm not sure why the simulation would be different even with packet loss. Any help with this is greatly appreciated as I'm pretty well stuck on this one.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by HappyMoo · Jan 19, 2014 at 05:15 AM

The simulation is different because the commands reach each system at a different time.

Have a look at

http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

and this series of articles:

http://gafferongames.com/networking-for-game-programmers/

for a deeper understanding of your problem and ideas how to fix the problem.

Comment
Add comment · Show 9 · 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 StrykerS. · Jan 19, 2014 at 06:41 PM 0
Share

Yes I've read these already and have a lag compensation system. This is not the problem. The client saves it's state or snapshot (as valve calls it) every tick and the server sends its snapshot to the client every tick, both have network time stamps. When the client receives its snapshot it checks an array of previous snapshots for the one with the corresponding time stamp and validates that snapshot not the current state of the client. The problem is even though its checking this correctly they can be off by something like 2-5 units between the server and client after a bit of play and I can find no good way to reconcile this.

avatar image HappyMoo · Jan 19, 2014 at 06:54 PM 0
Share

send positions now and then.. this is needed anyways for new players and it allows you to recover not only from prediction errors and off-ti$$anonymous$$g(And you have this, you don't have completely in sync frames/fixedFrames), but also from package loss if you switch to the faster UDP etc.

so... positions every second and between that only commands/deltas

avatar image StrykerS. · Jan 19, 2014 at 07:50 PM 0
Share

Sorry but I'm not completely sure what you mean. If your referring to the rate at which packets are sent that's already being done. Inputs are sent from the client when there's a change using TCP i assume as they are sent using a buffered rpc call and transform data is sent from the server every 10ms, these are not buffered because they all have a time stamp and anything older then the last valid command is ignored.

avatar image HappyMoo · Jan 19, 2014 at 08:15 PM 0
Share

I don't understand how your state can deviate if you get a fresh copy from the server every 10ms. If you project the snapshot the server sends you back in time and then apply all your local commands that you sent to the server in the meantime and simulate forward till current time, you should have more or less the same as the server. Small deviations are fixed every 10ms.

avatar image StrykerS. · Jan 20, 2014 at 01:22 AM 0
Share

Okay, after hours of testing I think the problem happens when I send the input data to the server. I think what's happening is even when using a buffered call some times the packet gets dropped and if the player was supposed to move one unit based on that command that results in the server being one unit's worth of movement behind the client. Even knowing this, I'm not really sure what I would do to fix it.

Show more comments

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

20 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

Related Questions

Photon Server vs Dedicated Master Client with PUN 1 Answer

Callback for DNS entry error using Photon Networking 0 Answers

Unity Photon Transform movement applying to opposite prefab 1 Answer

Can players host a server individually on your game for free 2 Answers

How to share large image (Texture2d) across photon network? 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