Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Ultimate Unity Networking project - Add multiplayer to your game today!

Discussion in 'Connected Games' started by MikeHergaarden, Jan 25, 2011.

  1. acropole

    acropole

    Joined:
    Aug 13, 2009
    Posts:
    152
    Ok. IMAO your project better fit in script package or extensions than in full project.
    Does it handle dead reckoning, server side physics raycast with lag compensation and other kind of stuff like this ?
    Sending and receiving data is not enought in multiplayer games.
     
  2. shiba_nivengo

    shiba_nivengo

    Joined:
    Apr 20, 2011
    Posts:
    16
    Hi!
    I've just downloaded the tutorial but I connot start with it because I don't know how to do this step: "Run M2HNetworking ->Reset buildsettings from the Unity menu to fix this."
    Please, could anybody explain me, step by step, how to run Run M2HNetworking ->Reset buildsettings. I cannot find any option in the Unity menu to make this.
    Thank you very much.
     
  3. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    it should be there, next to other options. However; Editor scripts will not compile if you have compile errors.
    Please check your console for any compile errors (marked red). Fix those, after which the menu item will appear.
     
  4. orbital

    orbital

    Joined:
    Apr 22, 2011
    Posts:
    1
    Leepo, can you please send me by email the GameSettings.cs script? i have downloaded the latest version multiple times and i think that my folder or pc is bugged, and the script dont appear in the folder.
    email: rafaelc47@hotmail.com
     
  5. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Sure thing, there's not much to this script. Mailed it.
     
  6. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    A question Leepo,

    Is this script ok to use for multi crewed vehicles i.e.. Driver and gunner in the same vehicle.


    Jeff
     
  7. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Yes and no: The project is a general tutorial/introduction to Unity networking which will show you how it all works and how you could make your design work welll for mutli crews. There are no scripts ready for such an implementation but it isn't too much work.

    What you'll need to focus on is to ensure that the car movement is very smooth for all passengers.
     
  8. Caps

    Caps

    Joined:
    Jul 23, 2010
    Posts:
    21
    Hey Leepo,

    I'm very interested in your tutorial. But before I purchase, I'm interested in setting up a non-authoritative setup.

    Do you think your tutorial will help me?
     
  9. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    488
    Hello,

    I thinking of purchasing this to setup multiplayer for my webplayer game (which will be a facebook game) and I have a few questions:

    first off I was reading the posts and read this:

    ---------------------------------------------
    Originally Posted by rmele09
    I am sorry I phrased my question wrong, however I appreciate your response. What I meant was can I have several games of 4 vs 4 or 6 vs 6 going on at the same time, possibly leading into thousands of players total? My game will ideally have small matches of 16 players max, I am wondering how many of those games can you setup with this method? If the game is popular could it handle hundreds or thousands of these small games at once? I am new to networking and I am sorry if that question is not asked correctly. Thank you for your time.

    You can have thousands of players, playing in seperate servers of size 4-32 players or so, yes.
    I.e. we have Crashdrive and Cubelands with +-800 concurent players playing multiplayer on 500 servers or so

    The thing is, the server are player hosted and only the masterserver is the required connection from our/your side.
    -----------------------------------------------

    1) Will purchasing this show you how to set up the server?

    2) When you say +-800 concurrent players playing multiplayer on 500 servers. How would I do the same? Are the 500 servers part of Unitys Master Server that have to be split up or are the 500 servers something I have to setup where I get my webhosting can you please explain this part Im a total newb at this stuff ;) and would like to do the same kind of thing you did with cubelands(I have created a full working game with unity and javascript though kind of like Crashdrive).

    3) has anyone tried using this with facebook through the canvas (iframe) and would this also work with on facebook? because thats what I'll be developing for.

    Any information would be greatly appreciated!!!

    I've looked into photon/ectrotank(es5) a little bit trying to figure out the best solution but the learning curve is tough so Im hoping this can be a good solution instead.

    And Im guessing if it can handle fps type of games this would also be able to handle a racecar type of game?
     
    Last edited: May 2, 2011
  10. Myister

    Myister

    Joined:
    May 1, 2011
    Posts:
    3
    I am curious of the same thing. I too am wanting to make a multi player game online and run it through FB. So as soon as someone gets the answers to the ones above. Please inform me lol
     
  11. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    488
    Im thinking if you have it setup in your game it should also work on facebook because it through and iframe (the canvas that is) so it should just work or Im guessing. The question Im asking is how do you setup the 500 servers? To have +- 800 concurrent users?
     
    Last edited: May 6, 2011
  12. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    488
    Anyone? I don't really want to spend 85 dollars and not be able to figure this part out. Any help greatly appreciated. I'm hoping to purchase it this weekend, next weekend at the latest :)
     
  13. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,071
    You don't, the players of your game do.

    When someone elects to "host" a match of your game using Unity's built-in networking and the master server, they become a server on their own IP address/computer. The master server is just a database that maintains a list of active matches of your game and their corresponding host's IP addresses and whatnot.

    This is also how games like Gears of War and Halo Reach work on Xbox Live.
     
  14. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Yep, see legend411's post :).

    For clarity:
    It will provide you all information you need to get started. It shows how to host and join games and how one can use the master server in Unity. How to setup the master server is documented by Unity.

    The servers are actually normal users hosting a game.

    Unity multiplayer works everywhere. It does not matter where the webplayer is deployed.
     
    Last edited: May 9, 2011
  15. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    488
    Thanks Guys!!! That really clears up a lot of my misconceptions :) And consider one more copy sold!

    I love the forums and you guys are great!!!
     
  16. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,071
    Leepo... I've built about half my game on top of example 2 of Ultimate Networking, but I bought it the day you released it. How much is different between the most up-to-date version and the version I'm running? I've combed most everything and haven't noticed anything, except for some missing monobehaviors which I fixed myself.
     
  17. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    488
    The Ultimate Unity Networking Project is AWESOME!!!
    Im starting to actually understand some of this and I just purchased it today :)

    I am having issues with controlling other players though? from Tutorial 2/Tutorial2A1 to Tutorial 4. I'll do my best to explain:

    I connect as Server(start server button, in the Editor(Unity)) and then in the web player build as Client (connect as client).

    In the webplayer build I can move the cube around independently but when I switch back to Unity and move the cube, both cubes will move instead of just one cube moving? I haven't made any changes to code or anything like that.

    Also if I stop the play button inside of unity or click disconnect inside of Unity (editor) the web player build will also be disconnected and not become the server. Im not sure how to resolve these issues?

    Any Idea why this is? Im using Mac osx 10.5 and Unity 3.3.0f4

    So hopefully someone can help me sort this out :)

    This is pretty awesome!

    Edit:
    Maybe this is happening because its on the same computer? which would have the same Ip address,since no one else has posted this issues.
     
    Last edited: May 21, 2011
  18. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    The new updates were mostly bugfixes for scripts that somehow acted up (because of the asset store upload?). So Example2 hasn't changed and I believe I didn't touch the MultiplayerFunctions.cs either. So you should be fine :).

    Zeek: Sorry for the late reply. Looks like you've been able to figure it all out by now.
    As for the movement, pretty weird. I'll have to check it out to verify if that's something new in 3.3.
     
  19. Commando

    Commando

    Joined:
    Feb 15, 2011
    Posts:
    7
    hey . well i'd like to share my problem , which i got , with u which is really basic but gave me the creep
    well recently i just designed a multiple online game and i just uploaded it on my website server
    but the problem is that it's not possible for some other guys to be server . they are only able to play the role of client but it does work for me always to be a server and i have no difficulties . i just want u to help me to get through this problem in order to let others to be server and master the game . so pls let me know of ur helpful solutions . thanks
     
  20. luistorrao

    luistorrao

    Joined:
    Jun 19, 2011
    Posts:
    4
    Hi, I need some urgent help from anyone there, I guess it is a dumb question:

    I just bought it and in the .pdf it says to "Run M2HNetworking ->Reset buildsettings from the Unity menu to fix this."

    How should I do that? I can only find "FixBuildSettings" in the "Editor" folder and I dont know how to run it. Could you please explain it in a very simplified manner?


    Thanks in Advance
     
  21. luistorrao

    luistorrao

    Joined:
    Jun 19, 2011
    Posts:
    4

    lol, found the answer in an older post, and yes, It really was a dumb question ^_^
     
  22. ochoa_power

    ochoa_power

    Joined:
    Jun 20, 2011
    Posts:
    2
    Hi Leepo,
    First of all i would like to apologize for all the mistakes i can make writing english, because i don’t write it very well.

    I bought your Ulitmate Networking Project to make my board game online.

    I introduce you how I have set my game just to let you see all the possible causes for the problem.

    In my board game I have two scenes. In the first one I create the main menu, and also create the network connections using your Example 3 scripts. Besides I use the persistent script not to destroy the gameobject with the MultiplayerFunctions attached when the next level is loaded. I want to warn you that I do all the scripting in Javascript, despite the MultiplayerFunctions script is written in C#. Anyway, there’s no problem here, and I know it because testing the chat, both server and client receive the messages sent by the other one.
    Next the game scene is loaded, the second one. As I have no many scripts, I attach all of them to just one GameObject, besides I attach a NetworkView component (observed = null, statesync = off) to this GameObject.

    Well, in one of my scripts I create the board. However there are randomly placed items, so I let the server to choose the positions, and then send them to the client using RPC. And here I find my problem. I don’t know why the items are only placed in the server’s board and nothing happens in the client, but some error messages appear in the console:

    NullReferenceException
    UnityEngine.Object.Internal_InstantiateSingle (UnityEngine..........)
    NullReferenceException
    UnityEngine.GameObject.GetComponent(System.string.type)(at .....................)
    NullReferenceException: Object reference not set to an instance of an object
    Boo.Lang.Runtime.RuntimeServices...................

    Looking for the solution I find a post explaining that you can't call an RPC function in the Awake funcion, because at this moment Unity still hasn't attached the NetworkView components to any GameObjects. They say it surely is a Unity's bug, and propose a solution but it does not work for me. The link of the post is this:

    http://forum.unity3d.com/threads/31014-Looking-for-RPC-in-the-wrong-networkview

    Finally I attach the most important code to you to throw an eye:

    private var Board;
    …….
    function Awake(){
    if(isMultiplayer){
    createBoard();
    if (Network.isServer){
    placeItems();
    }
    }
    }

    function placeItems(){
    ………
    while (i<num_items){
    …….
    networkView.RPC("instantiateItemRPC", RPCMode.All, posx, posz, i);
    ………
    }
    }

    @RPC
    function instantiateItemRPC(posx:float, posz:float, i:int){
    var newItem = Instantiate (Item, Vector3(posx, 0.4, posz), Quaternion.identity);
    newItem.transform.Rotate(90-transform.eulerAngles.y,0,0,Space.World);
    newItem.name="Item"+i;
    Board.FicharItem(posxInt,poszInt,newItem.transform);
    }

    So, this is my problem. I would thank you a lot if you give a possible solution because I’m desperate.
    Thanks again!!!
     
  23. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    "you can't call an RPC function in the Awake funcion"
    You can. But this gameobject needs a networkview assigned.

    Might it be that you're calling RPC's ON the object that you spawn? If so, they need an networkview on their prefab.
     
  24. ochoa_power

    ochoa_power

    Joined:
    Jun 20, 2011
    Posts:
    2
    Thanks a lot for answering me, but i'm afraid that's not the problem, because the RPC's i'm calling are in scripts not attached to any prefab.

    I thought that maybe it could be because i can't locally call Instantiate(...) on server and client using RPC , i mean, as i want to instantiate the prefab on server and client, i should use Network.Instantiate, however i can't do that because i need the prefab variable to pass it as a parameter in "FicharItem" (this means RegisterItem in Spanish). I could call Network.Instantiate instead of locally call Instantiate on each one, just if it's possible to pass a GameObject as a parameter of a RPC function, is this possible somehow?

    Also i thought that it could be because you need to call RPC everywhere you want it to be executed, i mean, for example if i call a RPC using RPCMode.All, does the networkView.RPC need to be executed in server and in all clients? If so, that could be the problem because i call "placeItems" just in the server, but the networkView.RPC call uses RPCMode.All as you can see in the code attached above.

    Thans in advance!!
     
  25. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Sorry ochoa; Your problem could be anywhere at this point and your post don't help me in figuring out where to start. You seem to be confused by the very basics. Please check out my tutorial (again) and have a good look at the examples there. Feel free to use those as base for your projects.
     
  26. Headingwest

    Headingwest

    Joined:
    May 3, 2011
    Posts:
    153
    Hi Leepo,

    I've been working through your multiplayer tutorials, excellent stuff and well worth the money.

    I then decided to start a new project and cut out all the tutorials except for example 2 and tutorial three (the one you recommend basing a new project on) so i have example 2 lobby with tutorial 3 authoritative server game.

    I have an issue is with server disconnects. I'm using your c# files instead of the Javascript ones as I prefer working in C#.

    But when a player disconnects their cube isnt deleted from the servers scene. Also if the client closes the window rather than disconnecting properly it kicks out a Null reference on player.owner.

    Ive been trying to work out whats going wrong and found a strange line of code:

    Tutorial3_Spawnscript.cs line 49

    Code (csharp):
    1.   void OnPlayerDisconnected(NetworkPlayer player)
    2.     {
    3.         Debug.Log("Clean up after player " + player);
    4.  
    5.         foreach (var scripta in playerScripts)
    I'm not sure why it's not kicking out a compile error as that looks like JS to me not C#

    It never finds the player script and never destroys anything

    Code (csharp):
    1. No objects for the given player ID were deleted 1
    2. UnityEngine.Network:DestroyPlayerObjects(NetworkPlayer)
    3. Tutorial_3_Spawnscript:OnPlayerDisconnected(NetworkPlayer) (at Assets/M2HNetworking/Tutorial 3/C#/Tutorial_3_Spawnscript.cs:102)

    Ive change the foreach loop to a for loop

    Code (csharp):
    1. for( int count = 0; count < playerScripts.Count; count++)
    2.         {
    3.            
    4.             Debug.Log("playerScripts item" + count);
    5.        
    6.                
    7.             if (player == playerScripts[count].owner)
    8.             {//We found the players object
    But it falls over on playerScripts[count].owner

    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object

    Any pointers as to what im doing wrong appreciated. (Probably something stupid).
     
  27. agramma

    agramma

    Joined:
    Jun 20, 2011
    Posts:
    12
    Hello!

    I'm trying to make a multiplayer game by using the example 4 of the M2H networking. My problem is that players can only connect locallyto my game and other players on the web can't connect to an existing game. I've read in another thread tha this is a bug in the new version of unity, and I should change the code in the multiplayer connect script, but I don't know what I should exactly. Could you help me or give me some advice, because I really can't figure out how to solve this problem :(.
     
  28. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Leepo,

    I have purchased and downloaded the project. I have also just now read thru the entire thread here. I sent you some PM's about some issues I've encountered, but I see that at least one of these was already mentioned here (the mis-matched line endings). My bad. I should have found this thread before I PM'd you, but I encountered the package thru the Asset Store, not the Forums.

    I need to say that right now, I agree with what Scorch says at 03:57 PM on 02-02-2011

    There isn't a good example of how to NOT use Network.Instantiate.

    I see that you've started to create an example on not using Network.Instantiate with Tutorial #4. Can Tutorial #4 be expanded?

    This may be a case of expert versus beginner, and I am sure this example makes sense to someone who already knows network coding, but for the newbie, there is not enough information to explain what is going on and what is needed to avoid using Network.Instantiate and why.

    The title of the tutorial is: "Tutorial 4: Manually instantiating networkViewIDs" but it doesn't explain how to do this nor what's going on in Tutorial #4. It's only half a page and barely touches on what the tutorial scene is supposed to be about, but doesn't actually explain anything.

    The Tutorial mentions "Tutorial 4 is all about the Game manager script…" but the tutorial doesn't go thru the GameManager script in any detail. I'm diggin' thru the script trying to make heads and tails of it, and it makes some degree of sense. As a tutorial, however, it would be nice to be walked thru the script and have it explained. This seems to be more of an "example" than a "tutorial".

    Moreover: Tutorial #4 mentions: "Using manual allocation instead of Network.Instantiate() gives you a lot of more power, plus it forces you to write a clear player handling class and I therefore highly recommend this."

    Can you elaborate? What is a "clear player handling class"? Why should we use this and how should it be used? Have you included an example of this class in your code? If so, can you help me understand what this is, how it works and how to use it? If this player handing class in NOT included in your code example, can you help us out with an explanation on how to build our own?

    This all may sound silly and n00bish, but I am very new to networking and I was under the impression that this project would help people with no networking experience.

    -

    I think the information presented in this project is "good". It is, however, not a complete system. And as a "tutorial" I would prefer a little more in-depth explanation as to the "why" and "how" of the code so one could more easily understand it and expand on these concepts. Currently it seems to be more of a collection of "examples" which if we can find a way to understand them on our own, we can expand on them at our own risk.

    I am sure I'll have more questions as I move from the "tutorials" into the real "examples"…
     
    Last edited: Jun 24, 2011
  29. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Just a quick note for testing connections using both the tutorial and example scenes: I simply created two stand-alone players, each with a different name (M2HTester01, M2HTester02) and this seems to work well. If I need a third player, I use the editor, or I suppose I could build a third application. What I like about this is that the built players have all of the scenes available without futzing in the editor with swapping and playing scenes; also the real-estate is low on the screen without all of the editor windows. When building I give each app their own icon and splash image (attached).

    Be aware that the clear drawback is you cannot see any of the console messages unless you edit the existing scripts to forward the Debug.Log message to the screen somehow and all standard Unity console message will not be visible.

    $2.png $1.png
     
    Last edited: Jun 24, 2011
  30. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    I'm in the middle of finishing a licensing deal. As soon as that's dealt will I will answer the above questions and address the mentioned bugs/confusion. Hopefully this weekend.
     
  31. theletter7

    theletter7

    Joined:
    Jun 24, 2011
    Posts:
    14
    I bought your tutorial pack and so far so good but Im wondering how i can make the client side spawn a different type of player instead of cloning say the box :S

    p.s yes i am new hence why i bought a tutorial pack XD
     
  32. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Headingwest:
    I have added fixes for your problems, I will update the package today.
    The nullreff is probably because it never deletes players that left, leaving them null after destroying the GO.

    The main change is:


    agramma:
    Its not a bug, but a common problem because of your router or firewalls security settings. You can configure your router to allow connections or set up a proxy server, which is harder.

    TheLetter7:
    This is a very basic unity question that you should already be comfortable with before using this tutorial. It's as simple as creating a new prefab and assigning them in the inspector.

    Little Angel; 3 Days Ago at 11:36 AM.
    I a
     
  33. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Leepo: It seems your response to me was cut off. I only see "I a". I've sent you an email, but we can keep that conversation in eMail.

    Other conversations aside:

    I'm pushing thru the examples and trying to get my HotSeat/Pass&Play game working using the Master Server with Lobby paradigm working. I have it working locally, and can get it to connect on my own computer using any combination of Web, Mac Stand-alone or Editor. I have deployed the webplayer onto my hosted webpage, and the HOSTING web-player stalls after selecting "Go To Lobby" (from Example 3). The webplayer is successful with the steps "Host a game", but after entering (or using the default) values for the Server Title and Max Players (ignoring password), the script stalls and doesn't get to the "Lobby" screen. JOINING has no problems.

    I have not yet found the issue.

    Does anyone have any additional information? Have I missed something? Is it not possible to Host a game from a webplayer? More info as I dig deeper into the scripts related.
     
  34. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
  35. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Leepo: No problem re; the email. I'm pushing through this.

    When it comes to the webplayer - this is only an issue when "deployed", eg: Uploaded to my site (http://www.theantranch.com), so I'm unclear how I can access those logs. The webplayers work fine locally, and they connect fine when deployed. I'm going to import MessageManager into this project to get Debug.Log info on screen, and I'll see if I can get a little further information.
     
  36. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Ah - it's a different issue rather than deploying the webplayer.

    I cannot host two instances of my game.

    I must have had another instance of the game at the lobby level. edit: (Actually any one instance of the game At lobby level or beyond - running, etc. - will prevent any additional games from entering the lobby.)

    I find that I can connect fine with several (two) stand-alone instances, the editor and a firefox and safari page running, I just cannot host a second game.

    What seems to be happening is that if I have one of the instances at the lobby level (or beyond), I can't take any other of the instances to that level. They choke when clicking "Go to lobby". I'm still searching thru GameLobby.cs and it's connections to MultiplayerFunctions.cs trying to figure out how it all works to find what's stopping it from connecting more than one instance of the game.

    I've tried different game names, but that's not it.

    Have I missed something?

    -

    Additional Information:

    It seems that if I take one instance to the Game Stage (eg: Running) and even if I quit or finish the game and return to the starting screen, sometimes other games still can't create a lobby. It seems I have to physically quit the standalone applications or close/refresh the webpages containing webplayers, or in one case, close the editor.

    If I go an look at "Join a game via the list" I see a game running, but I can't find any instance running it.

    I let one of the stand-alone applications act as a host, and then tried to host a game from the editor to view the console, when when clicking on "Go to lobby", this is the error:

    -

    Ok - Officially stumped.

    Code (csharp):
    1. public int defaultServerPort = 20000;   //optional
    This is listed as "//optional". The code depends upon having this defined, but even if I don't set a value, 20000 is still being passed thru the system. I have no clue what port ranges are used for or what ports should be listened to. Nor if I should just generate either a random port, or if one is being used, just start cycling thru port values. I'll admit, I'm afraid to start monkeying with this value, especially when the comments in the code indicate that some port choices are illegal!

    I'm afraid I'm going to need some guidance on how to implement multiple lobbies for multiple games, or how to create one super-lobby where games can be created, populated and played in separate rooms.
     
    Last edited: Jun 28, 2011
  37. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    You CAN view the webplayer log (it is still executed on your machine locally). For it's location, see: http://unity3d.com/support/documentation/Manual/Log Files.html


    The problem you are experiencing is that you can only host one game per port simultaniously. Use a different port on the second host to solve this. There is no dead-easy method to check if a port is being used though. It could be possible though(...?).

    In practice your users will never host two games anyway. And (dedicated)-server administrators will know about this limitation.
     
  38. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Tho' I'm not intending to at this point, if I were to put up a web-player on the internet, am I correct in what I'm hearing: It is the port on MY machine that's busy, NOT the port on the machine hosting the webpage. So I can be confident that if there are two user machines involved, there will be no port conflict from the game?
     
  39. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    Yes. The webserver only hosts a file...like it hosts images....when you browse to a webpage you download the images(and unity player) locally and run them on your own machine.

    The port will almost never be a problem in practice. (What users run the same game simultaniously on the same PC?).
     
  40. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Mmm... Got it. So I've just tripped myself up in trying to stress-test the system. I'll try to get multiple devices running.

    Thanks!
     
  41. theletter7

    theletter7

    Joined:
    Jun 24, 2011
    Posts:
    14
    Yes thank you I figured it out over the weekend :) I just over complicated it to myself at first.
     
  42. cozza13

    cozza13

    Joined:
    Dec 13, 2010
    Posts:
    64
    This is a great project.

    Two questions:

    1. How do you get the updates when you make and changes?
    2. How would you build the ability for the client to pick a character they want to use. e.g. selecting a male or female character.
     
  43. Headingwest

    Headingwest

    Joined:
    May 3, 2011
    Posts:
    153
    Thanks for you're reply.

    That's great news, do we just re import the package ?


    Also I do agree with little Angel about tutorial 4. Individually the tutorials are excellent. But they all point towards an ideal solution that is hard to create. Each tutorial does things in a different way making it confusing to figure out the best way of creating and authoritative server that manually assigns network ID's. Every-time I try and modify a project to create this ideal system you allude to in your tutorials I fail.

    In the end I have a frontend menu from the master server tutorial with an Authoritative server but im still using network Instantiate. It would be nice if there was a bare bones example of a project done the way it should be :)


    FINALLY:

    Have you tested this stuff on Android at all. My project works fine on webplayer / editor / windows standalone. And seems to work fine on Android initially. But then crashes out constantly. for one wonderful moment I had my phone hosting a server and web player and standalone joiing and all playing each other. Since then it hasn't run again :(

    Edit: I made a second version of my project from my .svn repository and it ran first time. Second and subsequent times it crashes just as or after you host server. I then built and ran your Master Server example project and the same thing occurs. Host -> Level loads (in this case black screen of course) then crash.

    Edit 2: The demos that don't use the Master Server example code Run fine. But those that do , ie the FPS demo also crash in the same way.

    Edit 3: It actually crashes if I just leave it on the Menu without even hitting the host button.

    I'm on a HTC Desire.
     
    Last edited: Jun 28, 2011
  44. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Headingwest: I can say that the project I have added this networking package to (primarily from Example #3, Lobby) runs fine on web, mac, editor and iPhone. Oddly, my iPad crashes when I try to run this new build. I'm unclear whether this is a networking issue or some other coincidental thing.

    SO, I guess I'm saying it's working with "Unity Networking" on at least one of my mobile devices, but I have no experience with Android devices yet.

    -

    When it comes to the tutorials, I really really like the way they start: Explaining one facet of the networking issue, then adding in one or two new elements and showing a new example. I just feel that they need to continue in this direction with several more tutorials, each adding more and more detail until there is a fully working example.

    I too am using an example (#3) stapled onto my game, but I'm very unclear how or why it works and every time I monkey with it, it falls over. As much as I want a module to plug into my game, I also want to know how I can modify it successfully.
     
  45. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    TheLetter7: Can you let us know how you did it, just for the continuity of the thread?

    Cozza13 : I don't understand #1. Can you re-phrase that and try again? Are you talking about a player's changes in the game? You may have a typo (the "and"?), but I don't get it yet.

    #2: I'd use an RPC method of some sort where the player picks a character, and then when the click "Enter World" it runs an RPC call that includes the CharacterID and uses that CharacterID to instantiate that model.
     
  46. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,071
    What part/parts are you referring to?
     
  47. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Well - pretty much all of it.

    The complex relationships of all of the scripts are somewhat convoluted. For someone new to networking, I'm finding a great deal of this under documented and under commented. I'm figuring out how things are working by "tracing cables" in the flow of logic and testing and adding log lines to see how they fire and what they trigger, etc..

    How does this package add a player? How does it delete or remove a player? How does it clean itself up? There are some cleanup issues - and Leepo seems to be on top of them - but I was completely lost as to where to find them if I needed to fix them.

    Moreover, simply updating the skin is taking a little bit of effort, as I want to move away from Unity's OnGUI as I'm targeting mobile devices, yet this system relies deeply on Unity's OnGUI to create functionality in ways that I was not expecting.

    I'm sorting thru it, one thread at a time; and there is a lot of work here - it's just slow going.

    -

    That's not to say that this package is not good. It's a complex and finicky subject. For a n00b, there are some unanswered questions still.
     
    Last edited: Jun 28, 2011
  48. Headingwest

    Headingwest

    Joined:
    May 3, 2011
    Posts:
    153
    Thanks for the info, my Boss has run a build on his iPhone and it worked. But fell over on his Google Nexus so it's looking like an android only problem.
     
  49. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    974
    I have not tested Unity networking on Android. And on iOS only limited.
    However, if it doesn't work it could be an android issue. The only thing that could be bugged on my/our part is if we are using some fancy .net features that get stripped away or ar not supported (e.g. List<bla>).
     
  50. cozza13

    cozza13

    Joined:
    Dec 13, 2010
    Posts:
    64
    @littleangel. to clarify my first point. I am wondering how we update the project when an update or a fix is made to the Neworking project.

    Another question is: Is there a tutorial out there on how to get the Construction worker character to work instead of the cube in the demos?