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
2
Question by Azaldur · Oct 12, 2012 at 05:00 PM · rigidbodynetworksynchronizecannonball

Synchronize Cannonballs(networking)

Hi, If you just instantiate a rigidbody cannonball via RPC on all clients, it is not guarenteed that it lands on the same spot on all machines, because auf the unstable physic engine. What do you do in this case? Synchronize the rigidbody.position and rotation(maybe even velocity) as well on all the clients every frame, as you would do it with the player characters? Wouldn't that waste too much bandwidth?

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 Fattie · Oct 12, 2012 at 07:53 PM 0
Share
  1. one of your iPads is the server of the game

  2. run normal physics on that. throw the ball on that one.

  3. of course, use the "normal" "correct" RPC call - the one that only sends messages to ONE client

{Note -------- Unity also offers a "send this message to everyone!" version of RPC. This "send to everyone" version of RPC is useless for conventional networking, it seems to be just a novelty. In conventional networking where the "hub" server is in control, and that server tells the various clients what to do, of course you individually talk to each person-X in different ways. Never use "network instantiate" or the strange "talk to everyone" version of RPC.}

  1. on the client, just puppet the position of the ball - it's only a line of code really

RT $$anonymous$$P networking is NOT REALLY THIS EASY, but it will get you going. To do it like in Real Racing, you have to sort of use almost what you could call an AI system to continually guesstimate where everything is. But before you can begin to work on concepts like that, totally master just puppeting the positions. Good luck!

avatar image Azaldur · Oct 12, 2012 at 09:03 PM 0
Share

Hi, thanks for your answer :). I don't really know what you mean with the correct RPC call? Can you make an example? You wrote that the RPC call should only send to one client, but all clients need the correct position of the ball. With puppet you mean just sync the position of the two balls over the network every FixedUpdate?

avatar image Fattie · Oct 13, 2012 at 12:03 PM 0
Share

look at teh RPC manual page, use the form at the BOTTO$$anonymous$$ of the page. cheers

2 Replies

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

Answer by sgmongo · Oct 12, 2012 at 06:05 PM

I avoid the physics engine like the plague because of issues like this. If you can I would suggest coding the movement yourself. If not, operate the original on the computer/server that spawned it. And create a separate network object, that is tied to the original. Use RPC updates from the original every FixedUpdate to orient the network one. Use Network.isMine check to delete the the extra one from the originating computer/server. It should be relatively inexpensive to send a single transform's worth of data at that rate. I've used this Shadow entity setup before to great success.

Good Luck!

Comment
Add comment · Show 2 · 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 Azaldur · Oct 12, 2012 at 09:06 PM 1
Share

Hi, thanks for your answer :). Is it also okay to just sync the position with OnSerializeNetworkView ins$$anonymous$$d of using an rpc? But when you just sync the position, the cannonBall stutters from one position to the next. So do you also apply a lerp from the current position to the new received one? I just tried this but then the position is not correct.

avatar image sgmongo · Oct 13, 2012 at 12:22 AM 0
Share

Probably lol, as with anything, testing is required.

The stuttering is due to the network send-rate. ($$anonymous$$ost likely)

Edit->Project Settings->Network Click

In the inspector should be a variable called "Sendrate"

For online games I suggest this baby cranked up to at least 40. That should quell the beast for the most part. If that doesn't clear it up you could setup a smoother setup like lerp (I'd probably use transform.Translate directly, never trusted lerp that much.) that will buffer the shadow entity, but it will misreport slightly behind on all the cannon-ball clients. Its really up to you how accurate it needs to be. $$anonymous$$illiseconds/inches don't really matter to your average game.

Also if this clears things up, I would appreciate a thumbs up. Been working to increase my standing. :)

avatar image
1

Answer by Ashkan_gc · Oct 13, 2012 at 01:32 PM

The best thing to do is increase the size of your objects a little so the little difference will not matter much. Then synchronize rigidbodies if you really want to use rigidbodies for that. The best way to handle it is using a diterministic formula yourself instead of using the rigidbody because your main problem is that different players will do the instantiate in different times so their results will be different (objects moved in different amounts in clients). The rigidbody's inaccuracy is a few decimals after the decimal point in the float number so it's not the main problem, if you use a formula of your own, then after instantiation you can see how much time you are back from server and then move the canon based on that. If you delay your clients behind server for 100 miliseconds or so, then you should not have much problems.

For now focus on making it work either with rigidbody synching or any other method and later on optimize it after you really find out the experience that you want.

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

12 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

Related Questions

[PUN] Rigidbody ball synchronization 0 Answers

Desync between host and client. 0 Answers

Unity networkedrigidbody 0 Answers

Synchronizing First Person Controller in a Master Server connection in elevation and azimuth 0 Answers

Two gameobjects with rigidbody aren't colliding in network game 4 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