I read the networking guide from beginning to end and understand all the concepts. The problem I have is that I don't understand how it fits together. Is there a tutorial in which you actual create a networking game or something like that? I tried to make a networking game with what I knew, but for some reason no one could connect... If there isn't one, could someone make one, or try to explain it to me? Thanks for an help in advanced.
Have you tried the networking example yet ? (http://unity3d.com/support/resources/example-projects/networking-example) And don't worry about others connecting just yet. Try to connect to yourself on localhost first (without worrying about masterserver, NAT punchtrough etc.) Just run two apps on the same machine.
Ok, I'll look up the networking examples. I am gonna have to find out how to run Unity twice, though.
File->Build. You can build the project as a web player, or standalone. If you build as a web player you can open it in multiple browser windows.
You can also start the game from the console (which I find the most convenient way of starting up multiple instances) or use "right-click/show package contents" and then go down to Contents/MacOS/<yourGameName> - double click on that as often as you want the game to come up. Oh, also you can do "build run" a couple of times to start a couple of instances of your game. Opening the editor two times ... hm ... I did that for a while but ended up not being sure if I severely broke something, so I wouldn't recommend it (and if you still want to do it - make a copy of your project and make a copy of Unity and then make sure you don't "cross the streams" ;-) ).
Hi, I tried to make a networking demo. All it is supposed to do is create a server on the master server and verify if it's there. For some reason, when I run it, I get the "AAAGH! ERROR!!!" printed on the screen. Did I register my server wrong? It detects no servers, but it doesn't seem to create on right. Any help? Also, I will just use build and run, I was trying to use multiple Unity's and it was all weirdness. I tested this code just be running it in Unity, no multiple clients or anything. Here is the code: Code (csharp): var GameType : String; var DefaultGameName : String; var DefaultDescription : String; function Awake() { // Make sure list is empty and request a new list MasterServer.ClearHostList(); MasterServer.RequestHostList(GameType); } function Update() { // If any hosts were received, display game name, the clear host list again if (MasterServer.PollHostList().length != 0) { var hostData: HostData[] = MasterServer.PollHostList(); for (var i:int=0; i<hostData.length; i++) { Debug.Log("Game name: " + hostData[i].gameName); } MasterServer.ClearHostList(); } else { Network.useNat = !Network.HavePublicAddress(); Network.InitializeServer(32, 25002); MasterServer.RegisterHost(GameType, DefaultGameName, "TDM "+DefaultDescription); } if (MasterServer.PollHostList().length != 0) { hostData = MasterServer.PollHostList(); for (i=0; i<hostData.length; i++) { Debug.Log("Game name: " + hostData[i].gameName); } MasterServer.ClearHostList(); } else { Debug.Log("AAAGH! ERROR!!!"); } } Thanks for any help in advanced.
I am working on some flow charts for how the Networking demo works. I looked it over for a couple hours and then decided mapping out the flow of all the function calls would be a good idea. When I'm done drawing them out in OpenOffice, I'll PDF it and post a link. It helps a lot to see how this stuff works. I'm a newbie with networking, but it's my top priority, so I'm diving into it