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 Slences · Dec 07, 2015 at 04:00 PM · networkingtransformsynchronization

Best way to synchronize projectile transform in networked game?

In my game each player can spawn projectiles. These projectiles get spawned on the server, they move on the server and handle collision on the server. For synchronizing the position and rotation, I use the Network Transform script with a Network Send Rate of 29 and the mode: Sync Rigidbody 3D.

The problem however is, even if a client has around 20 ping in milliseconds, the movement already gets a bit jittery. I tried writing my own script to lerp the movement, but resulted in the same thing.

What would be the best way to keep the movement smooth even if the client has a little bit of latency? In big games like League of Legends is the movement being mocked of projectiles? But how is the collision being handled? Thanks for reading!

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
1
Best Answer

Answer by srylain · Dec 08, 2015 at 09:11 AM

May be wrong, but I'd think your projectiles are jittery because they're not updating at the same frequency the game is since you're only sending the positions 29 times a second.

Not sure how doable it would be (and how well it would work with higher amounts of lag), but if you could send the start position of each projectile, its trajectory, and its speed you could get away with not having to send the positions over the network (although without more work this'll only work with projectiles that go in a straight line) by having the clients update the movement of the projectiles themselves.

You would then need to send a timestamp of when the shot was fired, so that when the clients receive that data they know how far ahead to put that projectile to account for ping. Depending on someone's lag, this will make the projectile appear farther away from where it should spawn the more lag someone has, but it'll at least let everyone see the projectile in the same place.

You'll still run all of the collision and everything on the server, and you could also do some collision on the client to tell when the projectile hit something so it doesn't go through it because of the delay between the server and client. But that's just if you want to hide some lag.

I haven't tried any of this, but it seems to me like it might work. If it does, it'll reduce quite a bit of network data too since you would normally be sending the transform of every projectile.

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 Slences · Dec 08, 2015 at 09:50 AM 0
Share

I've given the start position, speed and other variables to all clients (as SyncVar) and update the movement for each client individually and I must say it works quite fine even with a latency of around 40-50 ms. I indeed only handle collision on the server.

The only problem is that when for example having a ho$$anonymous$$g rocket (a projectile that does not only move forward in one direction). The target (SyncVar) of a ho$$anonymous$$g projectile has to be set on the server. I imagine If this target changes quite a couple of times, the position of the projectile will be not really accurate compared to the servers' projectile position.

Anyhow, I haven't really had a problem yet using this strategy so thanks for answering :)

avatar image srylain · Dec 08, 2015 at 01:51 PM 0
Share

Glad I could help. I haven't tried networking any sort of shooter yet (I've only done some small projects like Tetris and a Guitar Hero/Rock Band clone I made) and those games are surprisingly lag tolerant.

As for ho$$anonymous$$g projectiles though, unless your players can move really fast you should be able to update the projectiles in each client just fine. To hide the fact that the projectile could potentially miss on someone's screen, you could just have an explosion effect big enough to try and hide the lag.

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

41 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

Related Questions

How can I get objects with local authority in my scene to update their positions when running networked? 1 Answer

In unity3d client “push” an object with a rigidbody2d slower than the host 0 Answers

How to get transform syncing over network to work? 1 Answer

How to sync non-player objects movement in multiplayer game? 0 Answers

Looking for a good starting point for area instancing in an MMO setting 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