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 Goldy58 · Mar 19, 2015 at 10:07 AM · networkingmasterserverpong

Master Server and Faciliator connection

Hello. This is my first time ever have to ask a question about Unity, as I understand most concepts of this engine. Before my question a small details of what I'm about to ask: I have Unity 4.2, I have downloaded the Master Server and Faciliator, and place them into the Dedicated Server of which I host. I am making a small Pong Game to test my Networking skills so I can be ready to make this next project I have in mind to be ready, but first I am making a small Network Test system to fully understand of how to connect and receive, and yes, its port forwarded. I have made a Hosting Server test on 1 Unity program and registered a hosting game to the Master Server with Faciliator settings to it. It works well, and seen both consoles have accepted it.

And please NOTE, that this is the tutorial I am following for the pong game:

Unity Networking: The Pong Game

Here's the script of the Server

     using UnityEngine;
     using System.Collections;
     
     public class MultiplayerManager : MonoBehaviour
     {
         // Assuming Master Server and Facilitator are on the same machine
         public string MasterServerIP = "xxx.xxx.xxx.xxx";
     
         void Awake()
         {
             Debug.Log("Starting Master Server");
             // set the IP and port of the Master Server to connect to
             MasterServer.ipAddress = MasterServerIP;
             MasterServer.port = 23466;
     
             // set the IP and port of the Facilitator to connect to
             Network.natFacilitatorIP = MasterServerIP;
             Network.natFacilitatorPort = 50005;
     
             Network.InitializeServer(4, 4848, true);
             MasterServer.RegisterHost("Game_Pong", "Goldy's Test Server", "Just testing this MasterServer out");
             Debug.Log("Master Server Started");
         }
     }
 }

Ok, now that the server is made, now for the client. So I did everything from the tutorial, but only got the Networking part to find the type of game, and get the list if available, even though it didn't say where to try to find them, like an IP address or someting. Anyways, so I followed this, and put in some Degub.Log into certain part to make sure I am getting the connection I need to get the list of games. Now, the Debug log said there is some servers up of the gameNameType i found, which is Game_Pong, but it didnt list them. I am wondering is there a full comment on how to show the list of servers than to just explain them as a short conversation? Because these types, as i am seeing them, are like quick tutorial of how to connect, instead of giving a full understanding and code idea

Here's the client to get the connection and list them.

 using UnityEngine;
 using System.Collections;
 
 public class MultiplayerManager : MonoBehaviour
 {
   // are we currently trying to download a host list?
   private bool loading = false;
 
   // the current position within the scrollview
   private Vector2 scrollPos = Vector2.zero;
 
     void Start()
     {
         // immediately request a list of hosts
         refreshHostList();
     }
 
   void OnGUI()
   {
     if( GUILayout.Button( "Refresh" ) )
     {
         refreshHostList();
     }
 
     if (loading)
     {
         GUILayout.Label("Loading...");
     }
     else
     {
         scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(200f), GUILayout.Height(200f));
         HostData[] hosts = MasterServer.PollHostList();
         Debug.Log(hosts.Length);
 
         for (int i = 0; i < hosts.Length; i++)
         {
             Debug.Log(hosts.Length);
             if (GUILayout.Button(hosts[i].gameName, GUILayout.ExpandWidth(true)))
             {
                 Network.Connect(hosts[i]);
             }
         }
         if (hosts.Length == 0)
         {
             GUILayout.Label("No servers running");
         }
 
         GUILayout.EndScrollView();
     }
   }
 
   void refreshHostList()
   {
     // let the user know we are awaiting results from the master server
     loading = true;
     MasterServer.ClearHostList();
     MasterServer.RequestHostList("Game_Pong");
   }
 
   // this is called when the Master Server reports an event to the client – for example, server registered successfully, host list received, etc
   void OnMasterServerEvent( MasterServerEvent msevent )
   {
       Debug.Log("Might have found some servers");
     if( msevent == MasterServerEvent.HostListReceived )
     {
       Debug.Log("Found some servers");
       // received the host list, no longer awaiting results
       loading = false;
     }
   }
 }

Comment
Add comment · Show 4
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 Goldy58 · Mar 19, 2015 at 02:00 AM 0
Share

Anyone please? I'm looking for a fast response from anyone who know of ow to fix this and get it connecting to get the list of running servers from the $$anonymous$$aster Server and Faciliator.

avatar image Goldy58 · Mar 27, 2015 at 06:53 PM 0
Share

this makes me sad, as there is noone answering to this, and i have waited patiently for any reply. I'll just have to figure this out myself then if noone wants to answer, as i seen other questions after me, and gets a fast reply.

avatar image Addyarb · Mar 27, 2015 at 07:02 PM 1
Share

Don't take it personally. Networking questions get predictably slow replies. There's nothing easy about networking, and even intricate tutorials don't seem to cover the full grasp.

I personally recommend you look up GTGD (Gamer to Game Developer) on YouTube. He's a really great tutor and goes over all of the intricacies of networking with Unity's system. He also has a really great s$$anonymous$$m package called GTGD S2 (season 2) which covers exactly what you're talking about (using master server and facilitators).

Also, could you restate your question? I got lost trying to search for exactly what you're trying to ask, which may also be why you aren't getting a response.

Good luck!

avatar image Goldy58 · Mar 29, 2015 at 01:52 AM 0
Share

@Addyarb Thanks for the reply. Ima have to look into that Season 2 of GTGD. He does have really great tuts on making $$anonymous$$ultiplayer, which i like.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Server reports IP to MasterServer as 127.0.0.1 0 Answers

check if ip is on server 0 Answers

Password on a server (MasterServer) 1 Answer

MasterServer.RegisterHost causing a bad frame rate? 1 Answer

Game wont initialize with MasterServer Build at home 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