Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

uMMORPG Official Thread

Discussion in 'Assets and Asset Store' started by mischa2k, Dec 29, 2015.

  1. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    I have successfully converted uMMORPG to use a MySQL database, including some optimizations to improve performance. There is a .zip file attached to this post with the required files. It uses version 1.62 of uMMORPG, which is the current version at the time of this post. It also uses version 6.7.9 of MySQL Connector/Net, which is the most current version that is compatible with Unity. It is compatible with MySQL 5.0 - 5.7 and has been tested with MySQL 5.7.11 and 5.7.16.

    Converting your project to use MySQL is only recommended if you have experience with databases or are at least prepared to go through some 3rd party tutorials. Try it on a fresh uMMORPG project first.

    Quick Installation:

    - Unzip the attached file and put Database.cs in the Scripts folder of your uMMORPG project.

    - Put MySql.Data.dll in the Plugins folder of your uMMORPG project.

    - You will need MySQL server installed on your local machine or remote server/VPS (not included lol).

    - Use uMMORPG_MySQL.sql with a tool like MySQL Workbench or HeidiSQL to execute the SQL contained in the file to setup your database and tables.

    - Modify the connection string in Database.cs to match your MySQL database details.

    Additional Information:

    The idea behind the conversion was to seamlessly integrate MySQL with the current version of uMMORPG, while still providing some optimizations to improve performance. As such only Database.cs has been modified.

    You can remove all SQLite dll files from the Plugins folder of your project if you wish. However System.Data.dll is still being used, so don't delete that from the Plugins folder!

    SQLite uses broad data types, which are not compatible/optimal with MySQL. Therefore all of the data types in the database have been changed, while still retaining compatibility with their corresponding C# data types. Here are some notes:
    - In the C# code uMMORPG has a set limit of 16 characters for account names and character names. Therefore in the MySQL database VARCHAR(16) is used for these columns. Using a small text type here is good because account names and character names are searched regularly with the WHERE clause in queries.
    - The password is hashed and is always 40 characters long, so CHAR(40) is used.
    - The C# code used Convert.ToInt32 in numerous places, this has been removed and the appropriate INT data type is used in the database instead so no conversion is necessary.
    - SQLite did not support the BOOL data type. With MySQL TINYINT is now being used for bools. TINYINT(1) or BOOL could be used, but TINYINT allows for more numbers while still being small (for example if you want to use the banned column to additionally represent Admin or GM status).
    - Anywhere the BIGINT data type is used in the database, it is because the C# code is expecting a Long Integer and BIGINT is the equivalent data type.

    uMMORPG uses natural Primary Keys for the accounts and characters tables (ie. names instead of id numbers). At first I thought this was a problem, but after some research I discovered that there is a whole debate online about natural Primary Keys, and they can be used efficiently. In the case of the design of uMMORPG there are some advantages to using natural keys, however it requires proper indexing to be efficient. Primary Keys are automatically indexed (think of looking for a name in an indexed phone book, compared to a random list), and where these natural Primary Keys are referenced in other tables the corresponding columns have been Indexed. You can see this at the bottom of each table in the .sql file. This allows for fast queries with the WHERE clause. I have ensured that whenever the WHERE clause is used, at least one of the columns being searched is either a Primary Key or Indexed column. This will greatly increase performance as the database grows.

    LIMITs have been added to queries where the maximum number of possible results is known. For example the maximum number of active characters an account can have is set in the C# code to 4, so LIMIT 4 is used in the corresponding query.

    For the CharacterSave method, INSERT INTO ... ON DUPLICATE KEY UPDATE has been used instead of REPLACE INTO, as it's faster. This is because it will update the row if it exists rather than deleting and replacing it.

    The word `character`, is a reserved keyword in MySQL and causes an error if used as a table name or in a query. It has been used for multiple column names in the original database. Preventing the error for the name was a simple matter of wrapping the name with the ` symbol ie. `character`, which allows reserved keywords to be used as table names and in queries.

    Auto incrementing Primary Keys have been added to each table that didn't have a Primary Key. We are using the InnoDB engine which creates a hidden 6 byte Primary Key for a table if none is assigned which can potentially cause problems, so now all tables have assigned Primary Keys.

    When a connection is opened a query is sent that forces communication between the client and database to use the UTF-8 character set for all queries and results. This is to avoid problems with databases that have been configured incorrectly. For example there is an issue if Latin-1 is used as the default character set for queries and results. If you wish, this can be removed if the database has been configured correctly to use UTF-8.

    There are more optimizations that can be implemented, but I believe this to be a solid base to work from if you wish to use a MySQL database with your project.

    Let me know if you get it working, or if you have any problems ;)

    Edit: If you are having issues getting it working check this post:
    https://forum.unity3d.com/threads/ummorpg-official-thread.376636/page-64#post-3026725

    Edit: I am planning to update the MySQL mod once the Add-On system is released. While we are waiting for that, there is another user who updated Database.cs to a later version of uMMORPG and shared it. That post can be found here:
    https://forum.unity3d.com/threads/ummorpg-official-thread.376636/page-64#post-3028873
     

    Attached Files:

    Last edited: Apr 11, 2017
  2. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    This is nice, works with XAMPP. But doesn't this bring in security risks, like couldn't someone decompile the unity file and find the database.cs and get the connection string?
     
  3. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    For that case there is for example workaround by using global defines, like example wrapping server side commands/methods with special tags (conditions). I`ll try find tomorrow link about it.

    Try look at this - https://github.com/prime31/P31UnityAddOns/blob/master/Editor/GlobalDefinesWizard.cs
    And video about it


    Basically you can wrap everything which should be visible for server for example with
    #if Server
    // here comes the code
    #endif

    And of course you need to defined them on editor (there will be new menu "global defines"). I put the file from the github into Assets/Editor (make the folder called Editor if you dont have it) .
    Also i can't remember at the moment, if i activated global defines only when i was building client package or also when i builded server package. Basically if you got time, try and find out. I`ll try confirm it later myself too.
     
    Last edited: Feb 16, 2017
    mischa2k likes this.
  4. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    I have a couple of questions about uMMORPG:

    1) With Navmesh, can you jump by pressing space?

    2) I managed to fix the whole rotating around objects while going forward thing for the WASD control by removing the NavAgent's Steering Angular Speed (setting it to 0), since the character rotates via the direction of the camera. However even though locally it shows the character rotation, it doesn't show the rotation of the character on other clients. Is there a script to synchronize the Character RotY that is good on bandwidth?

    On the good news I managed to code my Crafting system from scratch :D I also made loot drops via items instead of the UI gump.

    Even though this is more or less for MMO, I am using it more centered around online/lan. Think Minecraft to be honest as I am going to be implementing voxel terrain as well. I just love the idea of Server Authoritative, especially since if any game design aspects change the preparation of Server is still there (think Trove now xD).

    More or less I am trying to have a Cube World styled random world with simple Minecraft styled controls. I already implemented Mobile controls (First finger controls movement, second finger controls rotation). So I got that covered, however just trying to figure out the NavMesh system and jumping.

    Thanks in advance.
     
  5. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Can I see a screenshot of your game using this kit when it is exported to mobile?
     
  6. ianmhart

    ianmhart

    Joined:
    Mar 16, 2014
    Posts:
    28
    looking for for party system :)
     
  7. MHolmstrom

    MHolmstrom

    Joined:
    Aug 16, 2012
    Posts:
    115
    If you manage to temporarily disable navmesh and then enable it once grounded again, would require checks in the statemachine from player.cs I think :)
    Or you could use curves like when you use off navmesh, this woulf make a jump look like one but not sure if it lerps up on objects etc.
    NavmeshAgent controls movement of an object in every dimension, so it just overrides your attempts to move an object in vertical direction. It moves exactly along the navmesh itself. Try to make player's model a child of a NavmeshAgent and move it up and down when jumping using transform.localPosition.
     
    Last edited: Feb 16, 2017
  8. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    @vis2k Is there away to exclude all the server content out of the client? That way its an proper client.

    Like maybe some kind of code to tell unity to remove this on builds? "I think the unet phase 3, will do this for the standalone simulation server."
     
  9. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    For a public client build, just delete the connection string. You would only have the connection string in the server build. Vis2k suggested another approach could be storing the connection string on the server in a separate file.

    Yes that would be good. Phase 3 needs to hurry up and get released :)

    Does this actually make it possible to remove the connection string from a client build so if you decompile it, it's not there?
     
    Last edited: Feb 16, 2017
  10. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Good morning everyone! Working on my MMORPG monetization guide today.

    Thanks for sharing, I added it to the documentation.

    1) Kind of. You can easily play a jumping animation when pressing Space. It will look like a real jump, but they won't be able to actually jump over an obstacle. You can of course use colliders for everything and implement real jumping too, but it would require more computations on the server. Right now all we need is the Navmesh, no Physics at all - which is really great to keep computations at a minimum.

    2) You could just use a very simple one. Like the included NetworkName, just rename it NetworkRotationY and instead of serializing the name, serialize transform.rotation.y. One float isn't going to kill your bandwidth.

    Good luck with your project!

    Looks exactly the same as on standalone:
    7df570ac-cf79-41af-b26b-601c95e86b3c_scaled.jpg

    Clients need to know about the SyncVars and the Commands, servers needs to know about the RPCs. The only thing you could do is wrap every command with something like #if SERVER.

    I think what we really need here is IL2CPP for Standalone. This way the game would be compiled to assembly code and all the C# code would be gone. Maybe ask the Unity IL2CPP people, the more they hear about it the more likely we will see it.
     
    jria likes this.
  11. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    Surely actual mmorpgs, doesn't include there server files inside the game client it self lol.
     
  12. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Normal MMORPGs also use two separate projects, one for the client and one for the server. With UNET it's all in one project, so we don't have to write twice as much code. The client and the server are 95% the same for us. I am not sure if it matters that people could see the command source code if they wanted to. There is no magic happening there. CmdUseItem uses an item, CmdSetTarget assigns the target variable, etc.
     
  13. MHolmstrom

    MHolmstrom

    Joined:
    Aug 16, 2012
    Posts:
    115
    @vis2k what about root motion? I heard anout a workaround by setting the agentspeed to 0.1 but feel like scripting would be more solid, ideas? Because I feel like most people will try to make a third person mmo :)
     
    tequyla likes this.
  14. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    Hello,

    in RPG game and others, skills depends on attributes. User raise the Attributes when lvl up.


    is possible to set this rule in uMMORPG or is it only mana cost with fix value ?

    +++
     
    Last edited: Feb 16, 2017
  15. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    How about the fighting of monsters ? and the shortcut keys for potions? Is there a difference on the interface between PC and mobile? there's no D-Pad or buttons.
     
  16. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    We need to work together and get working a scene switcher solution for this, so we can have different instanced scenes. One big crowded scene isn't for me :(. A mmorpg without this, is whew.
     
    camta005 likes this.
  17. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Where can I get character sprites ? because I want to add another class like black smith .
     
  18. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    You can design the game with multiple scenes, ready for when that functionality is added. Waiting for Unet Phase 3 is frustrating I know, but an MMO is a large task and there are many things that can be worked on before that is implemented.
     
    mischa2k likes this.
  19. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    What exactly do you mean with root motion?

    You could probably modify the Entity.CastSkill function to use a different formula if needed, yes.

    You tap the monster to target it, you tap again to attack it or you tap on the skillbar to cast a skill. Same with the menu shortcuts, you just tap on them.

    Input is not difficult and 100% client sided, so you can easily modify it to your needs. You can display a D-pad on screen or whatever you need.

    Find an artist :)
     
    jria likes this.
  20. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Do you have a tutorial on having a D-PAD? Or this is just a another asset?[/QUOTE]
    I am pretty sure you'd find an existing solution on the forum, on google or on the Asset Store. There are so many games that use these things.
    If not, it's not that difficult. You would add 4 arrow UI buttons to the screen and then add callbacks that make the player move forward/backward/left/right.
     
  21. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Thank you! Creating New Character Sprites are the really big problems.
     
  22. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    If you mean 3D models then yes, that's difficult. If you want good looking models then you either have to spend a lot of time getting really good with 3D modeling yourself or pay a 3D artist for it. I usually prefer to pay an artist.
     
    leomoyses likes this.
  23. MHolmstrom

    MHolmstrom

    Joined:
    Aug 16, 2012
    Posts:
    115
    @vis2k
    Well root motion is contained within an imported animation clip, that motion will drive the movement and rotation of the GameObject to get a more lifelike feeling. But it acts on speed, vector etc and it will use Y rotation so it looks just great. Then we could perhaps use a blendtree for movement as well to strafe, roll, dodge, walk backward animation and so on. In the animator on our warrior prefab etc its unchecked and with it activated things go crazy also I belive Y Rotation is not working that well in the motions. Like if you have a animation with a step forward in the animation the character will move forward as well. It just appears more attractive!
    I looked around but I'm kinda dumb when it comes to integrations and uMMORPG :)
    edit: With the curve system in animations I believe we can make a legit jump too :)
    https://docs.unity3d.com/Manual/RootMotion.html
     
    Last edited: Feb 17, 2017
  24. leomoyses

    leomoyses

    Joined:
    Feb 2, 2017
    Posts:
    14
  25. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Progress: still working on the new forum.

    I see. It sounds interesting, will have to do some research first. And I will definitely wait until the new character models are done.

    Answered. Perhaps this is of interest to more people so I'll explain it here too. I mentioned working on several MMORPG related articles. I finished two so far:
    • Common MMORPG hacks & protecting against them: this one is pretty long and based on everything I have learned from developing a MMORPG Bot and smaller hacks for 5 years and why the developers failed to protect against them.
    • Indie MMORPG Monetization strategy: this one is pretty long too and based on my last year of research on how I will monetize my own MMO without going crazy with the architecture, invoices, database, paypal and so on. It's about integrating what I think is the most simple payment provider solution with uMMORPG's Item Mall.
    I actually enjoy writing those and I will probably write a few more about things that I learned along that way that will be helpful to others. But as I said before, I don't want to make them available for free, since a lot of effort and research went into them. I am currently considering some kind of MMORPG insights ebook. But this of course will take a while to finish and a few people are highly interested in the monetization guide already, so I might publish the individual articles in a private forum while working on the whole ebook.

    And before some people get upset, this is not a paid uMMORPG feature that you need to unlock to launch your game, you can do fine without them.

    Edit: The bigger picture is this: I want to make my own MMORPG and uMMORPG is totally ready now. But if I do that, then uMMORPG will suffer. I really love working on this MMO Engine and seeing how valuable it is to so many people is a great motivation. So it might be smarter to focus on this MMO Engine business instead. Hence a new forum, guides, etc.
     
    Last edited: Feb 17, 2017
  26. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    Hello I try making A door and walkable, here is my problem if I bake this door static , I cant open the door, and if I bake with no static I can open the door, any tip? how I can fixs this?
     
  27. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Does your door has collider and triggers included (i assume it is done, so when player enters some area then door will be open). I haven't tried yet myself to make any door with open/close functionality so i can't confirm if that will work.
     
  28. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    my problem is not open and close the door it works perfect, My problem is in navigation + bake, if I mark this door as static the door open but I cant walk in, because the navigation
     
    Last edited: Feb 17, 2017
  29. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Static objects have to be static, as in: never move. You should not make it static and use a NavMeshObstacle instead.
     
    CrandellWS likes this.
  30. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    But is available NavMeshObstacle? for unity free? I dont see where is this NavMeshObstacle. I see thank you Im go try figure it how to integrate this to the door. THank you
     
  31. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Apprently it was included also on Unity free. Found video about it.

    or
     
    Last edited: Feb 17, 2017
    mischa2k and luis29vm like this.
  32. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Does someone here tried to host/upload the server in a free web server? Any suggestions?
     
  33. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    You can't host an server in a web server. Hosting only works with an Operating System.
     
    mischa2k and jria like this.
  34. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Usually free web servers won't allow you run anything except some certain files types and usually you can't either make any changes like firewall rules or run dll or any other not generic web server files/packages.

    So most likely you need find vps or dedicated server for that.
     
    jria likes this.
  35. CrandellWS

    CrandellWS

    Joined:
    Oct 31, 2015
    Posts:
    178
    https://github.com/CrandellWS/OpenAssets

    if this ps helps I started porting blend files with 2 buildings

    AWS Cloud has a free tier

    https://aws.amazon.com/free/?&_enco...8140e8af9af1848b4e01b&camp=1789&creative=9325
     
    Last edited: Feb 17, 2017
  36. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Can you give me suggestions or examples on where can I create my own server? Like amazon aws etc,.
     
  37. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
  38. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    What kind of error is this? Need help.
     

    Attached Files:

  39. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    That's normal with UNET, you can ignore it.
     
    jria likes this.
  40. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    I can't test the game. It says "DLLNotFoundException; sqlite3"
     
  41. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Are you using the latest version?
    When does it happen, in the Editor or in a build?
    Which operating system do you use?
    Is the sqlite3.dll file in the Plugins folder?
     
  42. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    I'm using the latest version of uMMORPG and I'm using unity 5.5.1f.
    I just bought uMMORPG and when I tried it to test, it pop up.
    I'm using windows 10.
    There's no sqlite3 in the plugins.
     
  43. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Uh that's weird, it should be there. Are you sure you didn't uncheck it when importing? Or perhaps your antivirus tool deleted from whatever reason?

    If you take a look at the package on the store: https://www.assetstore.unity3d.com/en/#!/content/51212 you can see the package contents if you scroll down. sqlite3.dll is clearly in there, so if you didn't get it then something went wrong on the import.
     
  44. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
  45. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59

    Attached Files:

  46. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I attached them to this post
     

    Attached Files:

    jria likes this.
  47. jria

    jria

    Joined:
    Feb 15, 2017
    Posts:
    59
    Hello Unity Masters! I need help on exporting uMMORPG to android. Can you create a video tutorial for this ? i can't figure it out.
     
  48. barbugamer

    barbugamer

    Joined:
    Nov 26, 2016
    Posts:
    38
    Did you even search on google? there is a lot of tutorials about exporting the game in apk
     
  49. barbugamer

    barbugamer

    Joined:
    Nov 26, 2016
    Posts:
    38
    Hello friend

    when will you add better controllers for mobile ?
     
  50. CrandellWS

    CrandellWS

    Joined:
    Oct 31, 2015
    Posts:
    178
    idk what you had in mind but for keeping simple to do

    here maybe use this Google forum...

    https://groups.google.com/forum/#!forum/ummorpg