Search Unity

[RELEASED] MultiOnline : multiplayer online kit - V3 now available

Discussion in 'Assets and Asset Store' started by VirtuElle, Aug 16, 2013.

  1. fearlessneon

    fearlessneon

    Joined:
    Nov 8, 2013
    Posts:
    12
    I would like there to be a tab on the page where it list the games to say join official server and when they click on it it will randomly take them to a server i selected as official, but it will only take you to a server that i selected as an official server(Meaning that We created it not the users). I edited picture to show you its really bad i did it in paint.
     

    Attached Files:

  2. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Ok, so yes, it would be possible to do this. You'll have to code it, but it will not be very difficult.
    Once you'll have defined how find your official servers (by a special attribut, by id, by name...), you'll take the game list, filter it and create a new list with only the official servers.
    Once you have it, you can select the game randomly using Random.Range(0, yourOfficialServerList.Count-1), and you can make the player join the selected game using the function MNetwork:JoinServer().
     
  3. Sphelps

    Sphelps

    Joined:
    Jun 9, 2013
    Posts:
    243
    Has anyone synced this with unistorm yet!
    Also is there a way to skip the waiting room scene?
     
  4. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi, about unistorm I unfortunately cannot help you
    But about skipping the waitroom, that's possible and easy, go in MNetwork.cs and line 116 and 731 just replace
    Code (CSharp):
    1. StartGame(false);
    by
    Code (CSharp):
    1. StartGame(true);
    It will automatically skip the waitroom scene.

    Note: but in this way you will have no more the menu to select the game map which in in the waitroom (it will automatically load the first map of the list). So it you have more than 1 map, you'll have to put the map selection somewhere else.
     
  5. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
    I always get "Login failed : Error on your password." when I try to log in.
    Database is set up and the account is in the database, but I can not login, even after password reset.
     
  6. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi,
    Ok, could you please give me your invoice number (by private message), I need to know your version to be able to help you.
    I'll answer you ASAP when I'll receive it.
     
  7. Neoshiftr

    Neoshiftr

    Joined:
    Dec 5, 2012
    Posts:
    67
    I've got the latest version from the Store.
     
  8. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I answered you by private message
     
  9. nscyber

    nscyber

    Joined:
    Jul 14, 2014
    Posts:
    22
    hello,why i can't click join button on demo. when i click it nothing happens.
     
  10. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi, probably because the host has not open the game port on his router.
     
  11. jonkuze

    jonkuze

    Joined:
    Aug 19, 2012
    Posts:
    1,709
    Hi VirtuElle very cool Dedicated Server Update! I really dig the update man!! Great Job, although I have not used your Networking Asset for a while as Moved on to Photon Cloud for my current project. I still think your Asset is awesome, and great for anyone who wants to learn Networking easily... as it did help me early on...

    I think if you can somehow manage to create a Dedicated Server without the need of a Webplayer, or Client to Launch then this Tool will be the Best!! For example I hear you can execute a Unity Executable through Command Prompt. If you were able to make a Headless Dedicated Server this way that would be amazing!! But im sure not easy... Good Job anyway!! = )
     
  12. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi Kuroato, thanks for your message.
    About a headless Dedicated Server, you're total right, in fact, that was exactly what I wanted to do. I didn't imagine the dedicated server in an other way.
    I don't think that it would be difficult to do, but my problem was that the batchmode option is only available with Unity Pro (you have to build your .exe with Unity Pro to be able to run it from Command Prompt). So, I'm currently unable to this option because of that.
    But, if I get Unity Pro later, you can be sure that I'll add it !
     
  13. jonkuze

    jonkuze

    Joined:
    Aug 19, 2012
    Posts:
    1,709
    Would this Headless Dedicated Server contain Server Logic and Game Content or does it simply just serve as a Messenger to tell other Clients who is where, and who is doing what in the game?
    By the looks of the current Dedicated Server you created, it seems that it requires the actual Maps, Scenes and Data in the Dedicated Server Build in order for the Server to know what Maps to Provide to the Players Connecting... Only bad part about this is that the Headless or Dedicated Server Build Size can become large because it contains the actual Maps, Scene Data, Models, and Textures etc... but I guess that doesn't really matter as long as it is not putting a big Memory and CPU Load on Physical Server itself.
     
    Last edited: Jul 30, 2014
  14. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    In fact, the dedicated server works more as a messenger, to tell the positions to the other clients and to send and transmit RPC functions.
    But yes, it requires all the maps in the build, because when I made it I realized that it was impossible to receive/send data to players which are on a scene, if we don't have this same scene in the build. That's the reason why we have to put all the other scene in the build of the dedicated server. So yes, it can take a little place in memory, but it will change nothing about CPU load since these scene will never be loaded, they are in the build for just logical reason.
     
    jonkuze likes this.
  15. jonkuze

    jonkuze

    Joined:
    Aug 19, 2012
    Posts:
    1,709
    Still very good work regardless! The main purpose of Headless Server in my opinion is so that people can Host there Dedicated Game Server on say a Windows VPS or Dedicated Windows Server at a Datacenter or Cloud Host Provider. I tried to run the Unity exe on a Windows VPS and it didn't work because Unity exe requires a Graphic Card to run. So a Headless Server ran in Batch mode would totally solve this problem.... no need for a Windows Dedicated (physical) Server with Graphic Card to run the Current Dedicated Game Server.
     
  16. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    So with the RPC function I couldn't quite find a way of Setting a GameObjects active state.
    would you be able to provide and example for me by any chance?

    http://answers.unity3d.com/questions/415261/activedis-active-gameobject-by-rpc.html

    I tried this but I kept getting the error.
    Sending RPC 'TheLights' failed because the number of supplied parameters doesn't match the rpc declaration. Expected 1 but got 3 parameters.
    UnityEngine.NetworkView:RPC(String, RPCMode, Object[])

    Even though the author of the thread said that it worked for him.
     
  17. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    According to the error message, that's your call of the RPC which is false.
    What did you written ? For the example you give me, the call of the RPC function
    TheLights() which is given as answer must be like that:
    Code (CSharp):
    1. networkView.RPC("TheLights",RPCMode.Others,"false");
     
  18. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Yes, I totally agree with you about it, that's the reason why I wanted first do to a system which could work only in batch mode: in order to be able to put it on a VPS or a dedicated server, and just start it from few command lines... But for this time I didn't have the means to do that (because of Unity Pro requirement), and the fact the this system would requires Unity Pro is also a problem for me about my customers, since in this case the feature would be available only for people which have Unity Pro... And that's not what I wanted for my Asset.

    So, for this time I have put a first dedicated server option, it will allow me to know what thinks my customers about it, and how I could improve it in future.

    In any case, thank you very much for your comments and remarks, that's always very constructive and useful for me.
     
  19. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    Ok that seems to fix the Errors. This is my code.

    if(Input.GetKeyDown(KeyCode.Q)) {

    Gun1.SetActive(true);
    networkView.RPC("TheGun",RPCMode.Others,"true");

    }

    if(Input.GetKeyDown(KeyCode.E)) {

    Gun1.SetActive(false);
    networkView.RPC("TheGun",RPCMode.Others,"false");

    }
    }


    [RPC]
    public void TheGun(string Switch){
    if(Switch == "true"){
    Gun1.SetActive(true);

    }
    else if(Switch == "false"){
    Gun1.SetActive(false);
    }
    }

    However when the GameObject is set Active or False it shows this happening on the players screen that is doing it but not on all the other clients.
     
  20. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    I just purchased this asset.

    I'm stuck with database installation with the following error.
    Fatal error: Class 'PDO' not found in /home/quecom/public_html/multionline/functions/MODb.class.php on line 31

    The line 31 is $bdd = new PDO($dns, $this->user, $this->pass);

    Please help me figure this out.

    Thank you.
     
  21. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    I am working with my hosting provider to enable PDO extension for MySQL. I hope that will fix it.

    I will keep you posted.
     
  22. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    Enabling PDO Extension works.
     
  23. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    When I build for Web, I can't login ... with the status "wait" but nothing happen.

    I tested using PC build, working great.
     
  24. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Ok, so I guess you solved your probem about PDO.

    About the webplayer, I guess you have an error like that "SecurityException: No valid crossdomain policy available to allow access".
    As explain in documentation part 7.5:
    When you build for webplayer, the WWW functions (used in MultiOnline) doesn't work if your webplayer is not on the same domain as the web pages called by these functions (for security reasons).
    You just have to put your webplayer build in your web hosting (the same where you put the php pages of MultiOnline), and start the game from there, everything will work correctly.
     
  25. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    That's very strange, I tested your function, it worked correctly.
    Personally, I would not have written the function this way, but it works anyway.
    Where did you put this code ?
    I have put it directly in MPlayerNetwork, here is my version:

    In the Update() function:
    Code (CSharp):
    1.  
    2.         if(Input.GetKeyDown(KeyCode.Q)) {
    3.             gun.SetActive(true);
    4.             networkView.RPC("TheGun",RPCMode.Others,true);
    5.         }
    6.  
    7.         if(Input.GetKeyDown(KeyCode.E)) {
    8.             gun.SetActive(false);
    9.             networkView.RPC("TheGun",RPCMode.Others,false);
    10.         }
    And the RPC function:
    Code (CSharp):
    1. [RPC]
    2.     public void TheGun(bool activeGun){
    3.         if(activeGun){
    4.             gun.SetActive(true);      
    5.         }
    6.         else {
    7.             gun.SetActive(false);
    8.         }
    9.     }
    And that works perfectly.
    Note: in C#, the rule is to start the variables name with a lowercase letter, and only functions name with a uppercase letter. And also,please, use the code tag when you show me some codes ;)
     
  26. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    Here's a test website:
    https://www.que.com/pages/multionline

    It just wait forever. I know I have a good/dedicated VPS for this project. Maybe I missing something else.

    Help me troubleshoot.
    Thank you.
     
  27. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hum, yeah I see... it seems that the webpages don't send back any data.
    Did you well checked the box "run in background" when you build your game ?
    Try to build it with the script debugging, it could maybe help us to see what's wrong.
     
  28. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    Got it working ... thanks a lot.
    I'll take a break and do more testing later.

    The PC and Web (https://www.que.com/pages/multionline) are now in sync, it's working.

    Thank you,
    EM @KING.NET
     
  29. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    @VirtuElle

    It's working now. I moved the unity3d file from my cloud hosting to the same webserver.
    Later I will try FPS, what do you recommend for asset to use?
    And for the background, do you have any recommendation? I would like to use Top-Down Sci asset. Do you have any tips for me?

    Some recommendation for future features. Can you create/add Game Center Leaderboard for our users (bragging rights) to keep their stats, e.g scores, kills, etc.
     
  30. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Good.
    About some other assets, unfortunately I don't know it enough to be able to recommend you something.
    For the background/3d models, there will normally have no compatibility problems, so you can choose what you want.

    But about a FPS asset, you must know that you will have to do some modification in the code in order to make it work in multiplayer mode, so my advice would be to choose something not too complicated.
    Other important thing, in some FPS asset, the player is only "flying arm": the full player is not modeled, you just have 2 arms with a gun, it does no matter in a single game, but you cannot use it in a multiplayer game, you need a player which has a full body. So, be caution about it, and be sure that you have a full player, else, it will be very difficult to use your FPS asset.

    Thanks for your recommendation, I take it in note.
     
  31. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    Ooppps Lol I forgot to update the Dedicated server. Works perfectly now :)
     
  32. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    Say a player died and I wanted to set up a way of them re-spawning what would be the most stable way of doing that?
     
  33. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    Yeah. I need to setup a dedicated server for users. Do we have a written procedure or video that I can use?
    Thank you.
     
  34. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    @VirtuElle

    I've noticed that the maximum player is 10. How can I make it to 100 or 1000?
    The database is only providing players positions, will it degrade the performance of the game if the max is set to 100 or 1000 or 10000. Just curious what will happen?
     
  35. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    I'm watching your video "Change player tutorial". I would like to know if the 3rd Person Controller is a free asset that I can use for my development? Please share the link where to download the asset?

    Thanks.
     
  36. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    The function loadPlayer() of MSpawn spawns a player, so you can call it in order to re-spawn your player.
    That's a coroutine, so you must call it using StartCoroutine(), or maybe the better thing could be to create a new function in order to don't have to wait 1 second.
    You could use something like that for example (this function must be in MSpwan script):
    Code (CSharp):
    1. public void ReSpawnPlayer(){
    2.     // Search  a spawn for the player (randomly)
    3.     int rand = Random.Range(0, spawners.Length-1);
    4.       Transform spawn = spawners[rand];              
    5.     // Instantiate our player
    6.     Network.Instantiate(playerPrefab, spawn.transform.position, Quaternion.identity, 0);
    7. }
    And you can after call this function from any other script in this way:
    Code (CSharp):
    1. MSpawn spawnSrc = GameObject.Find("Spawns").GetComponent<MSpawn>();
    2. spawnSrc.ReSpawnPlayer()
     
    Last edited: Aug 2, 2014
  37. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    There is no video for that, just look at the doc, part 3.5, the page 40 explains how build a .exe with the dedicated server.
    No, 10 is just the default value that I put, because...I needed a default value !
    In fact, there is technically no maximum player numbers, it only depends of the capacity of the host's computer. You can change this value from the inspector in MGameParameter gameObject (in Resource folder). Look at the doc page 45, it explain all about the parameters you can set from this object, and how change the default min/max players.

    The player number is not used in the database, so you could have 100000 players in a game, it's the same for the database ! The only one question is about how many players the host's computer / the dedicated server can manage. The database doesn't provides the players positions, it only provides the available games.
    This prefab is in the package "Character Controller", which is included in Unity. To import it, just go in the menu Asset/Import Package/Character Controller, and that's all ;)
    This package contains many scripts for moving a player, and also the prefab I used in this tutorial.
     
    Last edited: Aug 2, 2014
  38. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    Thanks man that works Great :)

    At first when you die it would spawn Hundreds of new player Prefabs and crash Unity. So I did

    Network.Destroy(this.gameObject); So that it was destroyed before it could loop the respawn function.
     
  39. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I'm not sure I understood, why did it spawned hundreds of players ? Did you put the re-spawn function in a loop ?
     
  40. kinghack

    kinghack

    Joined:
    Nov 30, 2013
    Posts:
    54
    Because the old PlayerPrefab(dead) is still there executing the respawn function and making lots of Players. so that's why it needs to be destroyed.

    Because my respawn script works like this.
    if( Health < 0 )
    MSpawn spawnSrc = GameObject.Find("Spawns").GetComponent<MSpawn>();
    spawnSrc.ReSpawnPlayer()

    I'm getting the hang of the networking :) it seems u can put Network. at the start of almost everything.
     
  41. AlanPT

    AlanPT

    Joined:
    Jul 31, 2013
    Posts:
    32
    This is the path I would like to go next. My current client wants the simplicity of a dedicated server (he thinks his users aren't smart enough to port forward). I am tempted to just setup a computer on my own network running your dedicated version for now. I would be very keen on a gui-less version too. Cheers.
     
  42. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Ok, yes you must destroy your player before call the re-spawn function.
    You can use Network.Destroy() for that.
    Here is the list of all the network functions, it may help you: link
     
  43. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Thanks for your comment, yeah, that's the way I'll try to take for MO.
    About the GUI, that's true that it may be too intrusive for some people. But how would you like this gui-less version ?
    You would prefer something as a library with just a basic demo scene and create you own GUI from that ?
     
  44. atomlg

    atomlg

    Joined:
    Feb 11, 2013
    Posts:
    6
    Hello,after host migration i have problems with connection to new host.In game or in wait room,it dosent matter,in database game status is empty.
    And how to make fixed player name above head?
     

    Attached Files:

    Last edited: Aug 9, 2014
  45. ferygeps

    ferygeps

    Joined:
    Sep 26, 2013
    Posts:
    2
    Hi,

    I'm trying to load http://yourdomaine.com(/folder)/saveUser.php
    I get this error message:
    Parse error: syntax error, unexpected 'private' (T_PRIVATE), expecting ',' or ';' in /home/simpur/www/simpur/functions/MOUser.class.php on line 14

    Could you help me solve this problem
    Thanks
     
  46. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I thinks that's because your new host have not the game port open on his router.
    You can set it on MGameParameter, look at the doc part 4.2 (page 45)
     
  47. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I guess you changed something on MOUser.class.php, the line 14 is the line where the registration email is defined. Didn't you change this content and delete inadvertently the ";" in the end of this line ?
     
    Last edited: Aug 10, 2014
  48. atomlg

    atomlg

    Joined:
    Feb 11, 2013
    Posts:
    6
    I mean that the name did not fall when drifting, and has always been on 1 fixed location above the player's head.

    And If i leave the game,How can I get back to waitroom,not in main room?
     
  49. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    That's quite strange, and you have this problem only after an host migration ? If a player just exits the game, the name well disappears ? Which version do you use ?
    You can change the function ExitGame() in MNetwork (line 448 in V3), if you want reload the waitroom, just delete the player gameobject (don't disconnect the player of the network, and don't destroy the networkManager), and load the waitroom scene instead the main menu.
     
  50. Dionilson

    Dionilson

    Joined:
    Aug 11, 2014
    Posts:
    2
    The server and created by a player then that player will have to have a door open modem. There is only this option or an option of hosting on a dedicated server?