• 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 Mr-Muffles · Sep 11, 2013 at 12:29 AM · serverclientchoppy

Separate Client and Server?

I'm attempting to make a very simple prototype multiplayer online game. The first step is to simply have two players login and move their own sphere around, w$$anonymous$$le being able to see other players' spheres moving around as well.

I want the server to handle all actions, and have the clients simply request movements (Server authoritative). The server would send the players' movements to everyone so it updates at the same time.

Two questions regarding t$$anonymous$$s:

1) As the title states, should I be making the server in a seperate project completely? I've seen tutorials and videos on how to create somet$$anonymous$$ng similar to t$$anonymous$$s but they all seem to use the same client. I don't wish to make t$$anonymous$$s project easier, I wish do to t$$anonymous$$s project right.

2) I recall attempting somet$$anonymous$$ng similar to t$$anonymous$$s project a w$$anonymous$$le ago and was unable to make the movement "smooth" for the players. It would update, and it functioned, but the movement was choppy and warping. How do I solve t$$anonymous$$s issue t$$anonymous$$s time around?

Thanks in advance,

Mr.Muffles

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

Answer by Benproductions1 · Sep 11, 2013 at 01:29 AM

Hello,

1)
Personally I find it easier to make both the client and server in the same project. For ease of use I have (on multiple occasions) created a authoritative client-server model that can run both seperately and at the same time, allowing for players to both host their own servers and have dedicated servers. Maintaining two projects is really hard, and due to the way Unity works, the server project would also have to be built in Unity (if you want any sorf of Unity based functionality) and having to switch between projects continually to add simple features is just a waste of time.
In networking there is no right. There are definate no no's, but the rest is up to the situation and what you can work with.

Before you start making an authoritative server however, note that in all modern games that use authoritative servers, the clients do a bit more than just request movement. They also try to predict the movement that the server will send back, allowing for proper gameplay that is lag independant. Doing t$$anonymous$$s takes a quite advanced movement system. It's not easy but nessecary if you don't want your users to wait, possibly seconds at $$anonymous$$gh ping values, for their input to change anyt$$anonymous$$ng in the game.

2)
When doing anyt$$anonymous$$ng in multiplayer, you are never able to keep the refresh rate very $$anonymous$$gh, because the latancy and bandwidth usage would probably make the game unusable. I suggest a refresh rate of 15-20 times per second. On that note, because we are working in large steps instead of tiny steps like we get when using the framerate, we need to interpolate between the updated points. You can also Extrapolate to find the point that will probably happen, however that can get quite complex, expensive and is not very accurate. You can find enough information on Interpolation and Extrapolation on the internet. Both are good methods and both get used (sometimes together) in tripple A titles.

Hope t$$anonymous$$s helps and clears some t$$anonymous$$ngs up,
Benproductions1

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 whydoidoit · Sep 11, 2013 at 02:27 AM 0
Share

I'd just add that certain types of game work well by applying the principles of extrapolation and/or interpolation to things like steering behaviours. For example you would be sending the server the current steering heading and velocity of the player and the current rate of change of those things - this works much better than sending only positions and rotations (in suitable games).

Next up, if collision detection is important you can consider not using the normal methods (OnCollisionXXXX) for the moving player representatives and instead "sweep" rigidbodies through the scene for the actual path taken, reporting collision in this manner from the server. This can help when the server is informed of the actual path taken, rather than it interpolating from discrete positions - that probably is AAA stuff though.

avatar image Benproductions1 · Sep 11, 2013 at 09:08 AM 0
Share

Those are some very good points XD
Mind if I add them to my answer?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

Error: The requested address is not valid in its context. 1 Answer

Smooth network communication like Unity remote 1 Answer

Multiplayer - Can't Connect Me ? 1 Answer

Client with authority can't send information to server 0 Answers

How do I connect a client to a server? 2 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