Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'masterserver'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. So, I was taking a look at the help section when i noticed that a few people needed help making a simple multiplayer system for their game. I decided to make one. This package includes the following: -Directconnect.js -ServerHost(Both masterserver poll list, and custom server options ex: maxplayers n' more) -Chat script (m2h's with a little edit) -Serverhub script -Mini test player prefab -Demo scene -Instruction manuel I hope you enjoy it as much as I enjoyed codin it! http://www.mediafire.com/?ut7c6coch5ik39x Edit: I realized an error, If you created a password for your server, you cannot chat in the game. To fix replace the code in 'Serverhosting.js' with this: #pragma strict var serverPort = 8080; var maxcons = 10; var gamename = ""; var dedicatedboolean = false; var mainservercam : GameObject; var extradetail = ""; var networkpass = ""; var msg = ""; var Server = false; var Client = false; var refreshtime = false; var refresh = 1.5; var maxtime = 1.5; var pings = 0; var playerToInstantiate : Transform; var spawner : GameObject; var playerinputpass = ""; function Awake(){ if(gamename == "" && Server == true){ gamename = " Game:" + Random.Range(1,999); } if(Client == true){ MasterServer.RequestHostList("RegularGame"); } } function OnGUI(){ if(Network.peerType == NetworkPeerType.Disconnected && Server == true){ GUI.Box(Rect((Screen.width)/2-150,100,300,400),"Server options : "); GUI.Label(Rect((Screen.width)/2-140,150,150,50),"Server Port : "); serverPort = parseInt(GUI.TextField(Rect((Screen.width)/2-10,150,150,25),serverPort.ToString())); GUI.Label(Rect((Screen.width)/2-140,180,150,50),"Max Connections : "); maxcons = parseInt(GUI.TextField(Rect((Screen.width)/2-10,180,150,25),maxcons.ToString())); GUI.Label(Rect((Screen.width)/2-140,210,150,50),"Game Name : "); gamename = GUI.TextField(Rect((Screen.width)/2-10,210,150,25),gamename,10); GUI.Label(Rect((Screen.width)/2-140,240,150,50),"Dedicated Server : "); if(GUI.Button(Rect((Screen.width)/2-10,240,70,25),"Yes")){ dedicatedboolean = true; } if(GUI.Button(Rect((Screen.width)/2+70,240,70,25),"No")){ dedicatedboolean = false; } GUI.Label(Rect((Screen.width)/2-140,270,150,50),"Add Password: "); networkpass = GUI.TextField(Rect((Screen.width)/2-10,270,150,25),networkpass,25); GUI.Label(Rect((Screen.width)/2-140,300,200,25),"Additional server comments : "); extradetail = GUI.TextArea(Rect((Screen.width)/2-140,330,280,60),extradetail); if(GUI.Button(Rect((Screen.width)/2-140,400,280,50),"[Start the Server!]")){ MasterServer.dedicatedServer = dedicatedboolean; MasterServer.updateRate = 10; if(networkpass != ""){ Network.incomingPassword = networkpass; } Network.InitializeSecurity(); Network.InitializeServer(maxcons , serverPort); MasterServer.RegisterHost("RegularGame" , gamename , extradetail); } GUI.Label(Rect((Screen.width)/2-140,430,280,25),msg); if(GUI.Button(Rect(10,10,150,50),"Return to main area")){ mainservercam.active = true; //clear all the values serverPort = 8080; maxcons = 10; dedicatedboolean = false; gamename = ""; extradetail = ""; networkpass = ""; this.active = false; } GUI.Label(Rect(Screen.width-150,Screen.height-20,200,25),"Status : Disconnected"); } if(Network.peerType == NetworkPeerType.Client && Client == true){ if(GUI.Button(Rect(10,10,100,25),"Disconnect")){ Network.Disconnect(200); } GUI.Label(Rect(Screen.width-150,Screen.height-20,200,25),"Status : Client"); if(Network.connections.Length > 0){ GUI.Label(Rect(120,10,200,50),"Ping : " + pings + "ms"); } } if(Network.peerType == NetworkPeerType.Server && Server == true){ if(GUI.Button(Rect(10,10,100,50),"Disconnect")){ Network.Disconnect(200); MasterServer.UnregisterHost(); } GUI.Label(Rect(Screen.width-150,Screen.height-20,200,25),"Status : Server"); GUI.Label(Rect(120,10,200,50),"Current Players : " + Network.connections.Length + "/" + maxcons); if(Network.connections.Length > 0){ GUI.Label(Rect(500,10,200,50),"Server Ping: " + pings + "ms"); } } if(Network.peerType == NetworkPeerType.Disconnected && Client == true){ var hostData: HostData[] = MasterServer.PollHostList(); for(var i : int; i<hostData.length; i++){ if(hostData[i].passwordProtected == false){ GUI.Box(Rect((Screen.width)/2-250,10*5+30 * i,500,27),"Game Name :" + hostData[i].gameName +"|Host Info:"+hostData[i].ip[0]+":"+hostData[i].port+ "|Players : " + hostData[i].connectedPlayers + "/" + hostData[i].playerLimit); if(GUI.Button(Rect((Screen.width)/2+250,10*5+30 * i,100,25),"Connect")){ Network.Connect(hostData[i].ip , hostData[i].port); } }else{ GUI.Box(Rect((Screen.width)/2-250,10*5+30 * i,350,25),"Game Name :" + hostData[i].gameName +"|Players : " + hostData[i].connectedPlayers + "/" + hostData[i].playerLimit); playerinputpass = GUI.TextField(Rect((Screen.width)/2+100,10*5+30*i,150,25),playerinputpass,25); if(GUI.Button(Rect((Screen.width)/2+250,10*5+30 * i,100,25),"Connect")){ Network.Connect(hostData[i].ip , hostData[i].port,playerinputpass); } } } GUI.Box(Rect(10,10,280,200),"Master Server List"); if(GUI.Button(Rect(180,30,100,50),"Refresh list")){ MasterServer.ClearHostList(); MasterServer.RequestHostList("RegularGame"); refreshtime = true; } if(refresh < 1){ Debug.Log("Refreshing... Found games : " + MasterServer.PollHostList().Length); } if(GUI.Button(Rect(20,30,150,50),"Return to main area")){ mainservercam.active = true; this.active = false; } GUI.Label(Rect(20,90,250,100),msg); GUI.Label(Rect(Screen.width-150,Screen.height-20,200,25),"Status : Disconnected"); } } function OnFailedToConnect(error: NetworkConnectionError) { msg = "Network error: " + error; } function OnMasterServerEvent(msEvent: MasterServerEvent) { if (msEvent == MasterServerEvent.RegistrationSucceeded) { Debug.Log("Server registered"); } if(msEvent == MasterServerEvent.RegistrationFailedGameType){ Debug.Log("Failed on Game Type"); } if(msEvent == MasterServerEvent.RegistrationFailedNoServer){ Debug.Log("Failed no server"); } if(msEvent == MasterServerEvent.RegistrationFailedGameName){ Debug.Log("Failed No game name"); } } function Update(){ if(Client == true && refreshtime == true){ refresh = refresh - Time.deltaTime; if(refresh < -5.0){ refresh = maxtime; refreshtime = false; } } if(Network.peerType == NetworkPeerType.Server){ if(Network.connections.Length > 0){ pings = Network.GetAveragePing(Network.connections[0]); } } } function OnConnectedToServer(){ if(Network.peerType == NetworkPeerType.Client){ Instantiate(playerToInstantiate , spawner.transform.position , spawner.transform.rotation); } } function OnPlayerConnected(player: NetworkPlayer){ Debug.Log("Player connected"); } function OnPlayerDisconnected(player: NetworkPlayer){ Network.RemoveRPCs(player); Network.DestroyPlayerObjects(player); } function OnServerInitialized(){ if(Network.peerType == NetworkPeerType.Server){ Instantiate(playerToInstantiate , spawner.transform.position, spawner.transform.rotation); } }
×
×
  • Create New...