- Home /
How to make an online server.
I am making a fishing game where you can battle against each other online. but I dont know how to join a server and how to make a server please help.
this is my code till now:
pragma strict
MasterServer.ipAddress = "127.0.0.1";
var remoteIPadress = "192.168.0.13";
var remotePort = "";
var listenPort = "";
var useNat = true;
var myIP = "";
var myPort = "";
var MaxPlayers = 10;
function Start () {
//PlayerScript = GameObject.Find("spritenaorobot(Clone)").GetComponent(OnTriggerEnter);
}
function OnConnectedToServer()
{
Debug.Log("Server connect");
GameObject.Find("Cube").transform.position.x = -5;
}
function OnServerInitialized()
{
Debug.Log("Server Initializied");
GameObject.Find("Cube").transform.position.x = 0;
}
function RefreshHostList()
{ //typename
MasterServer.RequestHostList("Uniquegamename");
}
function OnGUI ()
{//sort of Starting server
if(Network.peerType == NetworkPeerType.Disconnected){}
if(GUI.Button(Rect(5,5,80,30),"Connect")){
Network.useNat = useNat;
Network.Connect(remoteIPadress, remotePort);
}
if(GUI.Button(Rect(5,40,80,30),"Startserver")){
Network.useNat = useNat;
Network.InitializeServer(MaxPlayers, 25000);
}
remoteIPadress = GUI.TextField(Rect(5,100,120,30),remoteIPadress);
}
i am 14 years old so it could be a dumb question.
greetings Paul PS:I am dutch so i could have made some mistakes in spelling.
Answer by Florensie · Oct 19, 2014 at 08:56 AM
Maybe this could help: http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/
Btw, I'm also dutch (Belgian) and 14 years old. :)
hoi
oke fijn dat ik ook iemand van mijn taal er bij heb ik zal kijken of de link iets is voor mij alvast bedankt voor de reactie.
english Okay nice I also have someone of my language when I will see if the link is something for me thanks for the comment