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 ZtekMiniGame · Aug 15, 2018 at 07:18 PM · networkingdedicated-serversocial networking

Run Multiple Dedicated servers

I am trying to make a social media app in unity (I know its not the best option to be using unity, but im most familiar with it and I don't want to learn a new type of programming) The way the social media app will run will be that you can create a party where you can invite friends and post inside that party. My issue is im not sure how I can run so many parties as individual servers and how it will have to create a new server every time. Also im not sure how I could keep the server running if the host of the party leaves the app. If anyone could think of some type of a solution it would be a lot of help. Thanks!

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 RShields · Aug 15, 2018 at 08:09 PM 1
Share

Don't run a new server each time. Have one server and each time a new party is formed, start a new thread.

avatar image ZtekMiniGame RShields · Aug 15, 2018 at 09:42 PM 0
Share

How would I make it so that a player could only see one thread when they accept an invite to a thread?

avatar image RShields ZtekMiniGame · Aug 15, 2018 at 09:58 PM 0
Share

Whenever you make a request to the server, require a key. The server would then need to manage all its parties in a way that only the key can link into the party.

You can separate the server update threads from the data, so you get really nice async.

Put together, it's probably something like

 private Hash$$anonymous$$ap<string, Party> parties;

 // When the server gets a request for a party, it tries to return this
 public PartyData GetParty(string key)
 {
     if (!parties.Contains$$anonymous$$ey(key))
     {
         return null;
     }
     else
     {
         return parties[$$anonymous$$ey].data;
     }
 }

(but don't actually use that, it's pseudocode.)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Strixie13 · Aug 15, 2018 at 10:20 PM

There are two main types of models you can do. Client-Server is where YOU own a server that runs the software and people connect. The other method is peer-to-peer, which involves passing around the "hosting" responsibilities automatically until nobody is left in the room. IE if person 3 was hosting the room and left, everyone would then connect to person 2 instead.

Keep in mind that you can have multiple groups on one physical server. Most MMOs have multiple areas and instances of people grouped up, but they all connect to the same server. It just redirects traffic. So don't think in terms of multiple servers. You will probably only have one, and then divide people up into groups ON that server.

This is a lot of networking stuff that you would need to learn. If you are hard pressed to keep to Unity it can definitely be done. Just a heads up, the time to learn all the networking code and do it through a game engine will take significantly more time than learning a few web languages and following the more traditional route.

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
avatar image
0

Answer by Glurth · Aug 15, 2018 at 10:44 PM

I would suggest something like this:
- Allow each user to join any number of "Parties"; this can be stored on the server as a list of party-names, along with the user's name and connectionID.

- Users may send a message to any party they have joined. (However you might choose to do UI for this.)

- This message is sent to the server, containing the text of the message, but, the client will automatically add the name of the destination party (like a header). Note: you may need to do some "encoding", for this, e.g. specify the message sent from client to the server will always be of the format:

 partyname|somecookydelimeter|the text of the message

(Or better yet, include this information in your MessageBase derived class)

-When the message is recieved, the server then finds all the logged on users, that have joined this party, and send the message to ONLY these users. (e.g. Rather than use NetworkServer.SendToAll, you can use multiple calls to NetworkServer.SendToClient )

-Expand on the concept to allow sending a message to multiple-joined-parties, at once. e.g.

  partyname|pdel|party2|pdel|party3|somecookydelimeter|the text of the message

(Or better, add a List/< string /> member to your MessageBase derived class.)

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

132 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom dedicated server application 3 Answers

Do player hosted servers cost me money to run? 1 Answer

Load Image from an dedicated computer server 1 Answer

What would be the most efficient way to host a dedicated server with the only purpose of storing uploaded strings? 0 Answers

Unity networking tutorial? 6 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