Search Unity

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

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

  1. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I'm not sure that I understand your question: there are two options: the dedicated server, and the players which host the game. You can use there two options together, or use just one.
     
  2. Dionilson

    Dionilson

    Joined:
    Aug 11, 2014
    Posts:
    2
    [QUOTE = "Virtuelle, pós: 1731053, membro: 187316"] Eu não tenho certeza que eu entendi sua pergunta: há duas opções: o servidor dedicado, e os jogadores que hospedam o jogo. Você pode usar lá duas opções juntas, ou usar apenas um. [/ QUOTE]


    And how do I set a dedicated?
    Players need to have the door open on the modem to host the game?
     
  3. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    103
    not supported with Android?
     
  4. atomlg

    atomlg

    Joined:
    Feb 11, 2013
    Posts:
    6
    MUser hasn"t public NetworkPlayer networkPlayer;.If I add it,how MUser finds NetworkPlayer?
    Code (CSharp):
    1. foreach (MUser playerInstance in menuSrc.networkSrc.playerList) {
    2.             if (Network.player == playerInstance.networkPlayer) {
    3. }
     
  5. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
     
  6. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    No, there is currently no mobile version.
     
  7. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I'm sorry but I don't understand, your code doesn't work ?
     
  8. atomlg

    atomlg

    Joined:
    Feb 11, 2013
    Posts:
    6
    if
    Code (CSharp):
    1. namespace MultiPlayer {
    2.    public class MUser {
    3.      public NetworkPlayer networkPlayer;}//empty
    4.  
    Code (CSharp):
    1. foreach (MUser playerInstance in menuSrc.networkSrc.playerList) {
    2.             if (Network.player == playerInstance.networkPlayer) {
    3. }
    MUser networkPlayer is empty,and (Network.player ==
    "Could not find network player in the gamesetup playerlist!"
     
    Last edited: Aug 12, 2014
  9. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    You have to change the two constructors on MUser line 22 and 34 in order to add and set you new attribute. And also change the code in the places a MUser is created: in MNetwork, line 719, 688, 119 and 113.
    For finish, you must also change the parses functions in order to add the new attribute (else you will have errors) :
    Add your new parameter in UserToString() - line 48 and UserToObject() line 53.
     
  10. atomlg

    atomlg

    Joined:
    Feb 11, 2013
    Posts:
    6
    I've been added all parameters in MUser and MNetwork,;
    Code (CSharp):
    1. public class MUser {
    2. public int isscore;
    3.         public NetworkPlayer networkPlayer;}
    4. // Constructor with variable in string
    5. public MUser(string isscore){
    6. this.isscore = int.Parse(isscore);
    7.         }//MUser
    8. // Constructor with variable in real types
    9. public MUser(int isscore){
    10. this.isscore = isscore;
    11.         }//MUser  
    12. // Transform the MUser object parameters on a string
    13.         public string UserToString(){
    14. +"$"+isscore.ToString();
    15.         }//UserToString
    16.         public static MUser UserToObject(string parseUser){
    17.             string[] values = parseUser.Split('$');
    18.             return new MUser(values[8]);
    19.         }//parseUser
    20.  
    Code (CSharp):
    1. if(!isGameServerRebuild){
    2. MUser(playerDataSrc.score));
    3.         } else {
    4.  
    5.             playerMigrationList.Add(new MUser(playerDataSrc.score));
    6.         }  
    7.  
    And and elsewhere too add all parameters.

    Im trying add an option to the player.
    Code (CSharp):
    1.     [RPC]
    2.     void UpdateScore(NetworkPlayer player ,int currentscore){
    3.         bool found = false;
    4.         foreach (MUser playerInstance in menuSrc.networkSrc.playerList) {
    5.             if (player == playerInstance.networkPlayer) {
    6.                 playerInstance.isscore=currentscore;
    7.                 found=true;
    8.                 break;          
    9.             }
    10.         }  
    11.         if(!found){
    12.             Debug.LogError("Could not find network player "+player+" in the gamesetup playerlist!");
    13.         }
    14. ;      
    15.     }
    And i see this error: Debug.LogError("Could not find network player "+player+" in the gamesetup playerlist!");
     
  11. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I sent you a private message.
     
  12. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hello
    i have a problem. Everytime my player spawns in the host always spawns in first and when the other players join into the game all the players spawn outside of the map and it is extremely laggy. What can i do to fix this issue?
     
  13. ferygeps

    ferygeps

    Joined:
    Sep 26, 2013
    Posts:
    2
    Thanks for your comment, the problem has been solved :)
     
  14. Noamd

    Noamd

    Joined:
    Aug 14, 2014
    Posts:
    1
    Hi can you make a tutorial how to spawn a player in team a and b ? With kill massage? I am new in c# programming and i have some problems :/
     
  15. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hi!

    So far, I really enjoy your asset! It is really handy! But before I go do something I might regret, I have 3 questions that would be very appreciated!
    1. Is this like Photon network? Like do you need a external server for the hosting to work? Just wanted to be 100% sure.
    2. Can I change the GUI simply without breaking everything? :p
    3. Is there a way to change the email thingy with registration?
     
  16. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Is it on a new map you added or in the default map ?
    How many spawn did you put , did you named it correctly, and well put it on your map ?
    The players spawn on the spawn points, so, maybe the problem is the position of your spawn points
     
  17. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    No sorry there is no tutorial for that, and I cannot make a tutorial whenever a user fails to do something. I have done the tutorials necessary for the installation, adding features which are not in the asset is your job...
    But if you don't code in C#, you can use this convertor, and also, when you create new scripts, that may be js scripts.
     
    Last edited: Aug 15, 2014
  18. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    No, you just need a simple web hosting, which can be a free hosting, as AlwaysData

    In this new version there is a way to add very easily GUI skins on the menus and change the background. Changing all the GUI is also possible, I tried to separate the GUI functions to the other functions as much as possible. So I think that if you have already coded a little bit it will be possible without problem, since you will understand how work there GUI functions. In the other case, it may be a little more difficult.

    Yes, you can totally deactivate the registration email, and also put the content you want in this email (that's explain in the documentation)
     
  19. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Thanks for your response! I really like the way it is made with the waiting room, login system and all that. But when I got to try and edit the GUI... Was not possible. It is kinda messy sorry to say. Can you please tell me how I do so you can get like the variables for like the login name, login password, email and all that. I can not find them anywhere!

    But anyways, I love it! It really helped me get my game ready! Thanks
     
  20. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    What do you want to do exactly ?
    If you just want change the content of there variable, you must do it from the inspector, from MText gameobject (doc part 4.4 - it's on "Show MO menu text").
    If you search where are these variable in the scripts, they are declared and used in MOMenu. The declaration is on the top of the script, and the display is on the different functions which start by the word "Display". For example, the login menu is displayed by the function DisplayPlayerLogin() line 672 - the register menu is displayed by the function DisplayPlayerRegister() line 693.

    Does it help you?
     
  21. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Thanks again!

    And the thing I want to do is completely change the login, register and main menu. I kinda have my own style for the main menu. :p

    But thanks again!
     
  22. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Great! That's nice to do the menus as you want it, I hope you'll can do it without any other problem.
     
  23. antiant777

    antiant777

    Joined:
    Aug 29, 2013
    Posts:
    5
    I get an error :
    Warning: PDO::__construct() [pdo.--construct]: Premature end of data (mysqlnd_wireprotocol.c:553) in Z:\web\vrjam\functions\MODb.class.php on line 31

    Warning: PDO::__construct() [pdo.--construct]: OK packet 1 bytes shorter than expected in Z:\web\vrjam\functions\MODb.class.php on line 31

    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file'
     
  24. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi,

    According to your error message, that's a problem about your MySQL password, I have never seen this error from now, but I found this on Internet which could solve it:http://laravel.io/forum/04-16-2014-solving-mysqlnd-cannot-connect-to-mysql-41
    And check also that the file logData.php which is on functions folder contains well the good data for the MySQL login (you must import it from your web hosting before check it, because this file is filled during the database installation)
     
  25. antiant777

    antiant777

    Joined:
    Aug 29, 2013
    Posts:
    5
    another error on the host alwaysdata

    Fatal error: Call to a member function fetchObject() on a non-object in /home/novelstep/www/web/functions/MODb.class.php on line 127
     
  26. Sergasteam

    Sergasteam

    Joined:
    Mar 1, 2013
    Posts:
    113
    345345.png Hello, i always get a bug. When Client and Server pressed Exit button in game and will create new game on Server again without closing application and when Client connect again to host then Client see last spawned player object and it is unimportant to a client or server. Thank you for my last wish, i saw there are players names on objects. I would like to see in the new version to be able to restart the level with the confirmation of all clients and servers, as well as the respawn of the players when they were killed. Thank you!

    P.S. Where need paste a code like this?
    Network.RemoveRPCs (networkView.viewID);
    Network.Destroy (networkView.viewID);
     
    Last edited: Aug 20, 2014
  27. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    That's strange... Did you changed anything in the code ? When exactly do you have this error ?
     
  28. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    I'm not sure I understand, the client see the last player prefab, or just the last player name ?

    Yeah, this feature was asked by many users, so I decided to add it in this new version. About your new queries, I take it in note, but I don't promise anything.

    The best place would be in MNetwork, in first in ExitGame() function, line 449.
     
  29. antiant777

    antiant777

    Joined:
    Aug 29, 2013
    Posts:
    5
    I didn't change any code at all. but i understand the problem. the variable is non-object in original code. and we are running it on recommended alwaydata server
     
  30. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Yes, I know that, but you shouldn't have this error. When exactly do you have this error ?
    This error may happen for many reason, so I need more details. Check that your database is well installed, this error may come up when the fields of the database doesn't match to the fields searched by the sql query.
     
  31. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    Hi was looking at your asset and wanted to get something clarified...

    knowledge of unity's network class is needed as the asset online provides an online feature correct?
     
  32. Sergasteam

    Sergasteam

    Joined:
    Mar 1, 2013
    Posts:
    113
    the client see the last player prefab.
     
  33. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi,
    Knowledge of Unity network class will be useful in order the integrate MulltiOnline to your own game (in a multiplayer game the functions must be call using RPC functions, so that's not exactly the same as a single player game).
    But you needn't any specific knowledge to just set up the asset, you can look at the installation tutorial and the "How change player tutorial" to have an idea about it.
     
  34. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    And the two lines : "Network.RemoveRPCs (networkView.viewID); Network.Destroy (networkView.viewID);"
    didn't solve that ?
     
  35. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Always having a problem with this asset!
    This asset does NOT get along with Realistic FPS prefab asset! I have tried multiple times over and over saving and changing code! When i thought multionline would allow me to have a multiplayer game ready in a few minutes! Well its been a few months now still trying to figure out all of the bugs!
    both my players will spawn in the game and one will be outside of the map for some reason! i have checked the spawns they are fine everything should be working but nope i always have a problem!
     
  36. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
  37. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hello quick question!
    I have discovered why that bug was happening that i posted before!
    the MPlayerNetwork script will not allow me to attach it to multiple gameobjects! If i do not do this MPlayerNetwork will not recognize the components to disable in the MPlayerNetwork Script! Is there a way to attach the MPlayerNetwork script to the main gameobject and access components to disable in other gameobjects parented to the main one?

    I believe if i fix this bug the multiplayer should work correctly!
     
  38. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    First thing, I cannot ensure the compatibility of MO with all the other asset of the asset store.
    Making several asset working together may be a hard job, and may require to have a good level in programming, since it will require to understand the code and the working of the differents assets.
    The prefab of the FPS assets are sometimes no adapted to an online game, they are quite complicated and difficult to integrate. So that may be quite hard to use a FPS asset for a multiplayer game.

    So, you can have your multiplayer game in few minutes when you use your own prefab that you fully understand, but when you use other assets, that's always more difficult.

    Just use :
    Code (CSharp):
    1. this.GetComponentInChildren<ScriptName>().enabled = false;
    instead :
    Code (CSharp):
    1. this.GetComponent<ScriptName>().enabled = false;
    in the Start() function of MPlayerNetwork()

    ... But why did you attached MPlayerNetwork to multiple gameobjects???
     
  39. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265

    Thank you for your response im glad to know that i am getting some help working with this bug! The reason why i put the MPlayerNetwork script to multiple gameobject was because it would to recognize a script called "Ironsights" or "Gunsway" unless i put the script in those 2 gameobjects that they where attached to! But when i had multiple MPlayerNetwork scripts it would give me a null reference expectation!
     
  40. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    No problem, yes, you cannot have multiple scripts MPlayerNetwork on the same gameObject or in some child of a main gameObject.
    So, did the function GetComponentInChildren() solved your problem ?
     
  41. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Sadly it did not, I am working around the clock trying to solve this problem! Thanks for trying to help tho!
    Realistic FPS Prefab is very hard to work with in multiplayer games!
     
  42. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Do you still have the NullReferenceException ?
    It points the line 48 of MPlayerNetwork, if you changed the script, what do you have in this line ?
    Il looks like that's the display of the player name which make the error, maybe you could try to disable it.
     
  43. sandroe

    sandroe

    Joined:
    Aug 30, 2014
    Posts:
    10
    hy kuraoto...may i see source code for left klik to move script..?
    i always fail when add script mouse click..thank's before
     
  44. sandroe

    sandroe

    Joined:
    Aug 30, 2014
    Posts:
    10
    error1.JPG Hi VirtuElle,

    I've use this kit, but when I add a mouseClick script, i alway get error "Null Reference Exception"
    Here is the script :
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class mouseClickNew : MonoBehaviour {
    5.  
    6.     public float PlayerMoveSpeed;
    7.     private Vector3 TargetPosition;
    8.     private Transform PlayerTransform; // Use this for initialization
    9.  
    10.     void Start () {
    11.         PlayerTransform = transform;
    12.         TargetPosition = PlayerTransform.position;
    13.    
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update () {
    18.         // deklarasi kecepatan perpindahan objek
    19.         float amtToMove = PlayerMoveSpeed * Time.deltaTime;
    20.    
    21.         // perpindahan player setelah klik kiri pada lokasi (plane)
    22.         if(Input.GetMouseButtonDown(0))
    23.         {
    24.             Plane playerPlane = new Plane(Vector3.up, PlayerTransform.position);
    25.             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //ALWAYS ERROR HERE
    26.             float hitdist = 0.0f;
    27.        
    28.             if(playerPlane.Raycast(ray, out hitdist))
    29.             {
    30.                 Vector3 targetpoint = ray.GetPoint(hitdist);
    31.                 TargetPosition = ray.GetPoint(hitdist);
    32.                 Quaternion targetRotation = Quaternion.LookRotation(targetpoint - transform.position);
    33.                 PlayerTransform.rotation = targetRotation;
    34.             }
    35.         }
    36.         PlayerTransform.position = Vector3.Lerp (PlayerTransform.position, TargetPosition, amtToMove);
    37.     }
    38. }
    39.  
    I always get error in line 25...
    Thank's Before :)
     
  45. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Hi,
    Did you tried it with the "cube player" ?
    If yes, I think that the problem is that the camera attached to the player is not a "main camera".
    So just add the attribute on the top of your script:
    Code (CSharp):
    1. public Camera camera;
    Drop your camera there from the inspector, and replace the line 25 by this:
    Code (CSharp):
    1. Ray ray = camera.ScreenPointToRay(Input.mousePosition);
     
  46. sandroe

    sandroe

    Joined:
    Aug 30, 2014
    Posts:
    10
    Thank's VirtuElle,
    That's very helpfull...mouse click script already active now...but i get a new problem...
    for example :
    when i click in a plane, the object move not in a coordinate that i clicked..but move in other coordinate...
    but in a another project without using MultiOnline this script run normally...
    whether it should be added another script ?
    Thank's before :)
     
  47. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    That's quite strange...
    Did you well disabled your script for the other players, as explain in the doc part 5.1 ?
    You must put this in MPlayerNetwork, line 18:
    Code (CSharp):
    1. this.GetComponent<mouseClickNew>().enabled = false;    
     
  48. sandroe

    sandroe

    Joined:
    Aug 30, 2014
    Posts:
    10
    Hi VirtuElle..

    My problem is solved... It's happened because "Camera" is so far from my plane...When I sett the camera near with the plane....the script mouse_click run normally....
    But, I appreciate to you because yo always answer all of question from your client....Thank you very much VirtuElle..
     
  49. VirtuElle

    VirtuElle

    Joined:
    Jan 27, 2013
    Posts:
    458
    Thanks for your message, I'm glad you successfully solved your problem.
     
  50. thanhle

    thanhle

    Joined:
    May 2, 2013
    Posts:
    162
    i did test with my friend but , can't go room game
    i use this demo to create a room game with my account
    http://inteldesign.alwaysdata.net/webplayer/MultiOnline.html

    then my friend use other internet ( not in same lan )
    he login then he can see my room but he can't join in my room created
    error ( impossible to connect to this host )
    How ?
    multiplayer online kit use to play game online right ?
    but i don't know when i test in my computer with 2 webBrowser it work , but when i test with my friend it not work !
    I have something wrong ?
     
    Last edited: Sep 3, 2014