Search Unity

uMMORPG Official Thread

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

  1. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Today I worked on a new feature to uMMORPG: Additional Effects. The Skill system is functional but limited in what can be done. Being able to call a function on a skill use would be useful for particle effects and custom gameplay.

    My approach was to add a string to the SkillTemplate called additionalEffects. I then created a class called AdditionalEffects and added it as a component to the Player Prefab. Both the AdditionalEffects class and the Player class make references to each other. Then I simply do an invoke at the end of the CmdUseSkill for methods I want to associate. I may switch to a call in the UpdateCASTING() method if I want the skills to be validated uses.

    I'm not sure how efficient this method is but it is a quick hack to get custom effects working with skills.
     
  2. joncrzo

    joncrzo

    Joined:
    Sep 26, 2015
    Posts:
    30
    I added this to my test project, not only because it is easier than clicking (specially on laptops), but because users are actually used to using keys a lot more than clicking. That's going to help a lot of people ;)
     
  3. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Quite frustrating, i keep getting memory leak issue on headless server version after i have added additional skeletons on the scene. And that happens even when i run server without any players. Memory usage just increases way faster than expected, until server runs out free memory and server dies. Not sure if its something that Unity 5.3.5 doesn't play nice with ummorpg.
    I`ve tried couple times with rebuilding project from the scratch and added skeletons on the scene. The only way when i didn't get memory leak issue was when i builded headless version from the project where i did not added any additional skeleton.
    If someone has any advice how to fix it then would be great :)
     
  4. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    If i were to purchase this right now can i run the game without having a dedicated server lets say 10-20 people on it running through the server and play option in the login screen?Such as i host the server through my computer on 1 client or in unity and click server and play on another client will i be able to see other players?

    Is this asset compatible with 2d? such as the player controller and other scripts i see that the camera isnt compatible with 2d from what you said but was curious about the other aspects of this asset?

    Also is there any chance you could add hack and slash combat? :eek:

    Thankyou, and i look forward to hearing from you
     
    Last edited: Jun 4, 2016
  5. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Are you 100% sure that it doesn't happen in standalone or in the editor? Also can you try to disable a few components of the skeleton and see if it still happens? (Like the nameoverlay, etc.)

    You can host it on your own computer if you do port forwarding in your router, so that someone outside of your local network can connect to your computer.

    About 2D: uMMORPG is mostly networking code, which doesn't care if it's 2D or 3D. Movement is currently done with the NavMeshAgent though, so you have to change movement to fit your game.

    What is missing for hack and slash combat?
     
  6. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    When i tried it on throught editor then i didn't see that kind issue. The fast increased memory issue shows up only when im running standalone headless server version on Ubuntu 16.04 (x64).
    Anyway, ill try disable some components to see if that happens again or not.
     
  7. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @vis2k
    Hi i purchased your asset on the sale and was playing around with it a bit today. I've looked through the docs, and searched through the code a bit and i am trying to figure out if there are events / callbacks, how can i tell if the player has leveled up, defeated an enemy,or gained experience, also when a player/monster takes damage what activates the popup.
    thanks
     
  8. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    @vis2k i`ve tested with 30+ mobs and i`ve turned off their nameoverlay and seems now it works perfectly. Memory doesn't increase rapidly and it increases only when i logged in with multiple clients (that is quite normal). At the moment i leave my server running few hours to see if memory has been increased rapidly or not.
     
  9. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Okay, keep me updated.

    Take a look at the Entity.cs, Player.cs and Monster.cs scripts. Player and Monster both inherit from Entity. Everything that you mentioned can be found there. For example, the DealDamageAt function spawns the popup. And level ups happen in the Player's 'exp' property when it's increased.
    Let me know if you have any more questions.
     
  10. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    @vis2k
    Seems that after running server (standalone) for while the memory usage hasen't increased (im using build where i`ve turned monsters name overlay off).
    I also set up one cheap vps (1 core, 1gb ram) to see out how things work out there and there weren't memory usage increase issue either. I tried to run ~10 clients in the same time and memory usage increased only just little bit, which should be quite normal.
    Then after that i I tried again with standalone server, where i added +10 more skeletons than it was from the start and every skeleton had their name overlays turned on. After i logged in with one client and logged out after few minutes, then memory usage were still growing (like 0.1% every 7-10 second) until server runs out the memory and process will be killed by server. Of course it might take several hours until server memory limit is reached, depends on the memory size.
     
  11. xBeNjO

    xBeNjO

    Joined:
    Feb 6, 2014
    Posts:
    40
    I've had my dedicated server running my ummorpg server for almost 2 weeks straight with more npcs than default world and everything showing like a real game. It's only using 141MB and my ingame world is getting quiet big but only have around 20 npcs. That's building it for windows and running it.

    Edit:

    Checked this morning exactly the same 141.2MB usage. My server is 8 Core 2.4 ghz w/ 8GB RAM and it runs everything fine with uMMORPG.
     
    Last edited: Jun 5, 2016
  12. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    This is quite interesting. I left only those skeletons as they were on startup project and added more npc-s so there were like 25 of them. I turned skeletons NameOverlayUI off and left npc-s NameOverlayUI on. After i started to run server and holding it up for while, the memory usage didn't drop and it were increased on every 5 seconds. Then i runned new headless server where i turned NameOverlayUI off even from npc-s and now memory usage hasen't increase and it stayed the same. And im using still Ubuntu 16.04 as a server (1 core, 2gb memory). I think i didn't see that kind issue on the time when i tested game server on windows.
     
  13. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Sounds like you found a Unity bug then. Could you maybe try to fill the scene with lots of nameoverlays and nothing else, then see if it still happens etc.? The more you can break it down, the easier it is for the Unity developers to find that bug. Once you can't track it down any further, you should get the latest Unity version and use the bug reporter so that QA can take a look at it.
     
  14. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Alright, ill try that and also on Unity 5.4.
     
  15. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Here are test results with Unity 5.3.5f1
    1) skeletons/npc-s were turned off and i added only 25+ NameOverlayUI-s = no issue
    2) turned skeletons/npc-s back on and turned off their NameOverlayUI-s and also left those lately added NameOverLayUI-s = no issue
    3) turned npc/skeletons NameOverlayUI-s back on (same amount npc/monsters as from original package) = still no issue
    4) added additional 10 npc-s with their NameOverlayUI-s also turned on = memory usage started to glimbing up
     
  16. Sr-Liermann

    Sr-Liermann

    Joined:
    Jan 7, 2015
    Posts:
    68
    Hello!
    How are you everyone?

    I have a issue when I try to setup a Projectile Skill on the Warrior Character!

    The Projectile Skill only work when I Setup it on the Archer.
     

    Attached Files:

  17. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Probably because your warrior has no 'ProjectileMount' GameObject in his hierarchy. I can say more if you post Line 422 of your Player.cs script here.

    Interesting. Perhaps also try to remove components from the nameoverlay and see if it still happens (like FaceCamera.cs etc.)
     
  18. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @vis2k

    Thanks that helped a bunch, ive got alot of small customizations finished. Is there any other docs(ones that get into the code a bit more) with info other that the readme it came with ? The code is fairly easy to read and figure out, but there is just alot to look through ;) .

    So my next phase is to add rangedDefence. So it seems that similar to what you mentioned before i need to mod player.cs , entity.cs ,monster.cs , and npc.cs . but i think im also missing something on the networking side of things? Do you know what else i need to change/ add to.

    Also if we have a vote on the next update. I would love to see Aoe, further skill developement, and wasd controls( maybe with toggle to select enemies). Then i feel the combat system would be pretty complete.
    Thanks
     
  19. Sr-Liermann

    Sr-Liermann

    Joined:
    Jan 7, 2015
    Posts:
    68
     
  20. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    What exactly do you want to know about the code? I always try to explain everything right there in the comments of the code. If something is unclear then let me know and I'll add more comments. Other than that, there is the 'high level' Documentation.pdf file where I try to explain the basic overview, and how to change certain things. If questions pop up regularly then they are always added to the 'How to..' part of the documentation. Or in other words: just ask!

    What do you mean with ranged defence?

    About the next update: V1.22 is currently being reviewed and will be a maintenance release. AoE is possibly now that we upgraded to Unity 5.3.5, so that should come soon!
     
  21. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @vis2k
    My end goal is to make the combat system a bit more complex. I had a damage system that i was working on before i purchased this asset that i wanted to keep the basics concept from.. So i want to have defence stats for melee, ranged and magic attacks. So i duplicated the defence stat to (rangedDefence). In player.cs, entity.cs monster.cs and npc.cs. but said there were some networking issues. So basically i was just wondering if you knew of what code i needed to modify on top of those that deal with the defence stat. Ive been very happy how easy its been to modify the system so far, just easy to miss stuff with so much to look through.
    Thanks for the quick responses so far.
     
    Last edited: Jun 5, 2016
  22. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    I tried to turn off every scripts that NameOverlayUI text were connected and issue were still there. I even changed font style to normal and turned rich text off. Issue were still the same and nothing has changed. Same happend with Unity 5.4.

    I found one old post from forum (http://forum.unity3d.com/threads/ho...ui-text-without-causing-a-memory-leak.366926/ ) but im not sure if NameOverlayUI text has same issue or not. But as i can understand [NAME] will be replaced with prefab name based on UI Text Copy Name script, but memory leak issue is still there even when that script is turned off.
     
  23. joncrzo

    joncrzo

    Joined:
    Sep 26, 2015
    Posts:
    30
    Here are some ideas:

    Quests are already working, even though they can be repeated and you said you were working on that.

    I think quests should have 3 stages:
    • Intro (This stage gives a quest description and what it will reward the player)
    • Progress (This stage is a message shown to the user, if the user talks to the NPC before completing the quest)
    • Complete (This stage gives the player the reward AND offers the next quest IF any.. Useful for chain quests)
    Also quests should be able to give buffs, for example a user is a little weak for the quest.. the npc would buff the person to give some extra HP to be able to complete the quest.

    How about icons above NPCs head to show that there are new quests?

    ================================================
    How about items rare level? Just from experiencing other games.

    • Trash
    • Normal
    • Rare
    • Epic
    • etc....
    =================================================

    Item limit?

    This would prevent a player from having more than xx items in the bag.

    =================================================

    This has been requested before, but haven't been taken seriously?

    A Friend System and Party(Group) system.

    Party system would split exp between all players in the group, only if the players are within range of each other.

    ==================================================

    A User Level for Admins, GMs, Players.

    ==================================================

    Sometimes commonly found in MMOs. Just thoughts and ideas.
     
    JBR-games and xBeNjO like this.
  24. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    The npc buffs could be handled pretty easy by making some custom skills for npc that give buffs , triggered through a custom script.

    But all are pretty good ideas :)
     
    joncrzo likes this.
  25. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @vis2k
    figured out my issue when I added the new rangedDefence it caused some errors , I'm assuming because of the order I changed them in, or because of visual studio, as I have been having some weird compile errors with VS randomly. I restarted unity and the errors all went away when the scripts recompiled.

    edit...
    thought there was no issue but got this message now

    UNetWeaver error: Script class [Player] has too many SyncVars (32). (This could include base classes)
    UnityEngine.Debug:LogError(Object)

    Code (CSharp):
    1.    [Header("Ranged Defense")]
    2.     [SyncVar, SerializeField]
    3.     int baseRangedDefense = 1;
    4.     public override int rangedDefense
    5.     {
    6.         get
    7.         {
    8.             // calculate equipment bonus
    9.             var equipBonus = (from item in equipment
    10.                               where item.valid
    11.                               select item.equipDefenseBonus).Sum();
    12.  
    13.             // calculate buff bonus
    14.             var buffBonus = (from skill in skills
    15.                              where skill.BuffTimeRemaining() > 0
    16.                              select skill.buffsDefense).Sum();
    17.  
    18.             //  return base + equip + buffs
    19.             return baseRangedDefense + equipBonus + buffBonus;
    20.         }
    21.     }
     
    Last edited: Jun 6, 2016
  26. Udin89

    Udin89

    Joined:
    Jul 19, 2015
    Posts:
    15
    Oh nooo..... I miss the discount week :(
     
  27. krill156

    krill156

    Joined:
    Jun 28, 2014
    Posts:
    6
    How much Objects/NPCs can the headless server handle? I could of swore i saw a post on here about to much NPCs being active and the CPU getting way to high.

    And if i really wanted to.. would it be possible to get the client to connect to a socket server instead?
     
  28. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    I think that can be done easily by everyone. For example:
    open Item.cs
    Code (CSharp):
    1. // add this for example before public GameObject model
    2. // it will add new input value on Item inspector window
    3. public string itemRarity {
    4.         get { return ItemTemplate.dict[name].itemRarity; }
    5. }
    then open ItemTemplate.cs
    Code (CSharp):
    1. // add before public GameObject model
    2. public string itemRarity;
    3.  
    4. // and of course if u need to show that info on item tooltip, then add for example after equipMpBonus condition
    5.  
    6. // item rarity
    7. if(itemRarity) tip += "Rarity level: " + itemRarity + "\n";
    8.  
    Oh and i haven't tested it on live code, but i guess that way should work. And of course now you should have additional text value on your item inspector window where you can type item rarity level text (Trash or Normal or ...whatever you would like to add). Or replace text with numbers and show item rarity text on tooltip based on number value.
     
    Last edited: Jun 6, 2016
    mischa2k likes this.
  29. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Progress Info: added answers to recent questions to the documentation:
    • How to add another attribute like Dexterity
    • How to make a 2D MMORPG with uMMORPG

    That's a UNET limitation. I think they mentioned to increase that number at some point. Until then you can probably just use another component and put them in there. Or post on the UNET forums and let them know that this limit is too small.

    Ok. Please try to file a bug report and let us know about the case number. I can add it to the list of bugs in the first post then.

    Sorry to hear that.

    I tried it on a really cheap VPS from namecheap.com and had about 100 monsters running. At that point things to delayed a bit, but everything still worked. If you have a more expensive server, then you can also handle more entities. Note that at some point it will get to 100% cpu usage, but things still keep working fine because our scripts all run in one thread. Hence no concurrency issues when reaching 100%, things just get slower.

    UNET uses UDP. Although you could use the All Cost Delivery channel in the NetworkManager and get very similar results to how TCP/IP works. UDP is fine though, it has a lot of benefits over TCP/IP when it comes to multiplayer game development.

    Thanks for your feedback. Those are many interesting features. A lot of them would overcomplicate the code, hence make uMMORPG harder to learn, so we have to be careful. The goal is for it to be easily understandable and extendable by everyone.

    There already is an item limit.

    NPCs with a "?" on top of their head if they have a quest would be a good idea. Will put that on my list.
     
    Last edited: Jun 6, 2016
  30. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    @vis2k Report is submitted and case number is 803428 (case status was set as public). I guess it takes some time until they can reproduce it or not. And apparently it doesn't show up at the moment on issue tracker either.
     
  31. joncrzo

    joncrzo

    Joined:
    Sep 26, 2015
    Posts:
    30
    Awesome! I just saw the item limit, I thought I went through all the features. I guess I missed some. :p

    I'm sure that works, what I was talking about is the color of the items. Or lets say the borders of the icons would change color depending on the rarity level. But that's a start :p
     
  32. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    Well, on that case, let me change my previously submitted example and add some pre-defined colors for items. For example when you want to show colored name based on item rarity level.

    Open ItemTemplate.css and find
    Code (CSharp):
    1. // name
    2. tip += "<b>" + name + "</b>\n";
    3.  
    and replace it with
    Code (CSharp):
    1. // item name
    2.         if (itemRarity != "")
    3.         {
    4.             switch (itemRarity) {
    5.                 case "Epic":
    6.                     tip += "<b><color=#ff00ffff>" + name + "</color></b>\n";
    7.                     break;
    8.  
    9.                 case "Rare":
    10.                     tip += "<b><color=#ffa500ff>" + name + "</color></b>\n";
    11.                     break;
    12.  
    13.                 case "Normal":
    14.                 default:
    15.                     tip += "<b>" + name + "</b>\n";
    16.                     break;
    17.             }
    18.         } else {
    19.             tip += "<b>" + name + "</b>\n";
    20.         }
    And don't forget add item rarity level name on your item. Item parameters can be changed throught scriptable objects (uMMORPG -> ScriptableObjects -> Items -> your item). Oh, and text color codes can be found from http://docs.unity3d.com/Manual/StyledText.html
     
    Last edited: Jun 6, 2016
    mischa2k and dhogan like this.
  33. joncrzo

    joncrzo

    Joined:
    Sep 26, 2015
    Posts:
    30
    Oh my, you are amazing!

    By the way, Version: 1.22 (Jun 06, 2016) is out!

    @vis2k, you didn't update the part where it says:
    1. Install and open Unity 5.3.4 or newer.
    It uses Unity 5.3.5 now for it to work properly.
     
    Last edited: Jun 7, 2016
  34. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Update: V1.22 is now on the Asset Store! Please remember to upgrade to Unity 5.3.5 first.
    Thanks, I wasn't noticed about version 1.22 for some reason.
    And good find, I changed it.
     
  35. bullardo

    bullardo

    Joined:
    Jan 5, 2013
    Posts:
    46
    When I do a build on pc and try to be the server, I get an erro cannot find directory Databaseadmin. Works if I play it in the editor however.
     
  36. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Can you post the exact error here? And which operating system do you use? And which Unity version? And when exactly does the error happen?
     
  37. bullardo

    bullardo

    Joined:
    Jan 5, 2013
    Posts:
    46
    Im using Unity 5.3.5 and on Windows 7. If I choose server logging into an account. Here is the screenshot. The erro is hard to read but it says "Databaseadmin directory not found "

    Im going to try a fresh project, maybe something got munged on upgrade.

    - That didn't help. Same error.

    Correction: it says Database/admin but I can confirm the directory is there.


    Ok I apologize. It was mapped to my osx install and the perms were screwed. Sorry about that.
     

    Attached Files:

    Last edited: Jun 7, 2016
  38. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Ok, good to hear!
     
  39. bullardo

    bullardo

    Joined:
    Jan 5, 2013
    Posts:
    46
    Also, about this bug NetworkReader:ReadByte out of range:NetBuf sz:4 pos:4 when running the linux server.

    Have you actually talked to anyone at Unity about this?
     
  40. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Yes, to just about everyone. It's also the highest rated UNET bug on the issue tracker: http://forum.unity3d.com/threads/bu...ease-show-the-variable-that-caused-it.395692/ . I initially reported it on the forums about a year ago.

    You can avoid it though. It happens when there was an error in OnSerialize or OnDeserialize. So try to remove one component after another to see which one caused it.
     
  41. bullardo

    bullardo

    Joined:
    Jan 5, 2013
    Posts:
    46
    I will also see if I can push it up the ladder myself. I know a few people that work at Unity.
     
  42. xBeNjO

    xBeNjO

    Joined:
    Feb 6, 2014
    Posts:
    40
    I updated and now with a fresh import I get this weird error:

     
  43. krill156

    krill156

    Joined:
    Jun 28, 2014
    Posts:
    6
    That can be safely ignored. It is called when a script is changed.

    @vis2k I did some research into the UnityEngine.Networking library and now I'm in the process of moving server related functions into a custom game server console that will use the library. Long ways to go but if I ever finish it, I will toss it your way if you like.
     
  44. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Code (CSharp):
    1.  //added to bottom of  void SelectionHandling()  in Player.cs  **********************************************************************************
    2.   //check only Players
    3.         if (Input.GetKeyDown("p"))
    4.         {
    5.             playerSelectType = "Player";
    6.             typeSelect = 1;
    7.         }
    8. //check only Monsters
    9.         if (Input.GetKeyDown("e"))
    10.         {
    11.             playerSelectType = "Monster";
    12.             typeSelect = 0;
    13.         }
    14. //check on npcs
    15.         if (Input.GetKeyDown("n"))
    16.         {
    17.             playerSelectType = "NPC";
    18.             typeSelect = 2;
    19.         }
    20.         if (Input.GetKeyDown("tab"))
    21.             {
    22.              hitCol = Physics.OverlapSphere(this.tr.position, tabSelectRange, selectableTargets[typeSelect]);
    23.  
    24.                     enemyRef += 1;
    25.                 if (enemyRef > hitCol.Length - 1)
    26.                 {
    27.                     enemyRef = 0;
    28.                 }
    29.                     var entity = hitCol[enemyRef].GetComponent<Entity>();
    30.  
    31.                     if (entity)
    32.                     {
    33.                         // set indicator
    34.                         SetIndicatorViaParent(hitCol[enemyRef].transform);
    35.                         // target it
    36.                         CmdSetTargetId(entity.netIdentity);
    37.                 Debug.Log(hitCol[enemyRef] + " Tab Selected");
    38.             }
    39.             }
    add this somewhere in player.cs

    Code (CSharp):
    1.     public Collider[] hitCol;//list of colliders detected
    2.     public int enemyRef; //reference to which target is currently selected
    3.     public int typeSelect = 0; //reference to which type of target is currently selected
    4.     public String playerSelectType = "Monster"; // just a string name of selected type (not needed, but maybe useful for hud )
    5.     public LayerMask[] selectableTargets; //need to add each layer type manually to each of your player prefabs
    6.     public float tabSelectRange = 35.0f; // range of the tab selection
    Note: you will need to manually add each layer type in the inspector player.cs on the prefab
    Note: you will also need to change the layer of the capsule collider in the bones on all enemys , players, and npcs to default otherwise you get 2 colliders that need to be tabbed through.

    if anyone finds it useful its a simple system to tab between enemy or players.
    works fine for a small scene but needs a distance check for larger scenes edited with some advice from @vis2k.
     
    Last edited: Jun 11, 2016
    Adrad likes this.
  45. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    News: during the last few months, several people have asked me how to create a MOBA game with UNET. I decided to make one!

    Asset Store link: https://www.assetstore.unity3d.com/en/#!/content/62542
    Forum discussion: http://forum.unity3d.com/threads/umoba-create-your-own-dota-league-of-legends-game.404593/

    Here is a Screenshot:
    2016-05-27f copy.jpg

    If anyone is worried how this project might affect uMMORPG: it uses about 80% of the same code, which means that bugfixes/features for uMOBA will give us free bugfixes/features for uMMORPG too. In fact, some of the latest uMMORPG improvements were only possible thanks to uMOBA. For example, uMOBA has a few really big entities like the bases. Players weren't able to attack them because the distance between base.transform.position and player.transform.position was always bigger than the attack range, because of the huge collider. What we really needed was a function that calculates the distance between the closest points on each entity's collider. This is what lead to uMMORPG's Utils.ClosestDistance function that is now used for all distance checks between two entities. This improvement alone was completely worth it, because we all would have ran into problems when creating huge boss monsters.

    Sounds good.

    Happens when you modify scripts while the game is running.

    Good luck!

    You can use Physics.OverlapSphere to cast a sphere in a certain radius and find all objects (or entities) in that radius. It's very fast.
     
  46. xBeNjO

    xBeNjO

    Joined:
    Feb 6, 2014
    Posts:
    40
    I didn't have VS open, I made a whole new Unity project, imported the asset and clicked play.
     
  47. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Progress Info: V1.23 was submitted to the store. Changes can be seen in the first post (AoE Skills!).
    Could also be a NetworkManager bug. I wouldn't worry about it as long as everything works fine.
     
  48. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @vis2k
    thanks I'll try that. & great news about AoE. any chance of getting access to it before its on the store?
    I wanted to add extra skill bars, is it possible ?
     
  49. cioa00

    cioa00

    Joined:
    May 31, 2016
    Posts:
    203
    I`ve updated this post with code/solution what i came out after i tested it myself. Probably there could be better way to handle this feature, but well, here is my quick method/idea.

    Duplicate skillbar canvas layer. Rename that layer to Skillbartop and also SkillsBarSlot to SkillBarSlot2. Also don`t forget move whole layer to somewhere so you won't overlap default skillbar layer.
    On the Player.cs file, add (i was setting default keys as function keys, but you can change them or remove them at all, just leave empty slots):
    Code (CSharp):
    1.  
    2. [Header("Skillbartop")]
    3. public KeyCode[] skillbartopHotkeys = new KeyCode[] { KeyCode.F1, KeyCode.F2, KeyCode.F3, KeyCode.F4, KeyCode.F5, KeyCode.F6, KeyCode.F7, KeyCode.F8, KeyCode.F9, KeyCode.F9 };
    4. public string[] skillbartop = new string[] { "", "", "", "", "", "", "", "", "", "" };
    5.  
    6. // find void SaveSkillbar() and add another loop
    7. for (int i = 0; i < skillbartop.Length; ++i)
    8. {
    9.     PlayerPrefs.SetString(name + "_skillbartop_" + i, skillbartop[i]);
    10. }
    11.  
    12. // find void LoadSkillbar() and add another loop
    13. for (int i = 0; i < skillbartop.Length; ++i)
    14. {
    15.     skillbartop[i] = PlayerPrefs.GetString(name + "_skillbartop_" + i, "");
    16. }
    17.  
    Now open PlayerDndHandling.css and add:
    Code (CSharp):
    1.  
    2. // find void OnDragAndClear and add
    3. if (entry.tag == "SkillbarSlot2") player.skillbartop[from] = "";
    4.  
    5. // before class ending add
    6. // inventory -> skillbar2
    7. [Client]
    8. void OnDnd_InventorySlot_SkillbarSlot2(int[] slotIndices)
    9. {
    10.     player.skillbartop[slotIndices[1]] = player.inventory[slotIndices[0]].name; // just save it clientsided
    11. }
    12.  
    13. // equipmentslot -> skillbar2
    14. [Client]
    15. void OnDnd_EquipmentSlot_SkillbarSlot2(int[] slotIndices)
    16. {
    17.     player.skillbartop[slotIndices[1]] = player.equipment[slotIndices[0]].name; // just save it clientsided
    18. }
    19.  
    20. // skillslot -> skillbarslot2
    21. [Client]
    22. void OnDnd_SkillsSlot_SkillbarSlot2(int[] slotIndices)
    23. {
    24.     player.skillbartop[slotIndices[1]] = player.skills[slotIndices[0]].name; // just save it clientsided
    25. }
    26.  
    27. // skillbar -> skillbar2
    28. [Client]
    29. void OnDnd_SkillbarSlot_SkillbarSlot2(int[] slotIndices)
    30. {
    31.     // slotIndices[0] = slotFrom; slotIndices[1] = slotTo
    32.     // just swap them clientsided
    33.     var temp = player.skillbar[slotIndices[0]];
    34.     player.skillbar[slotIndices[0]] = player.skillbartop[slotIndices[1]];
    35.     player.skillbartop[slotIndices[1]] = temp;
    36. }
    37.  
    38. // skillbar2 -> skillbar2
    39. [Client]
    40. void OnDnd_SkillbarSlot2_SkillbarSlot2(int[] slotIndices)
    41. {
    42.     // slotIndices[0] = slotFrom; slotIndices[1] = slotTo
    43.     // just swap them clientsided
    44.     var temp = player.skillbartop[slotIndices[0]];
    45.     player.skillbartop[slotIndices[0]] = player.skillbartop[slotIndices[1]];
    46.     player.skillbartop[slotIndices[1]] = temp;
    47. }
    48.  
    49. // skillbar2 -> skillbar
    50. [Client]
    51. void OnDnd_SkillbarSlot2_SkillbarSlot(int[] slotIndices)
    52. {
    53.     // slotIndices[0] = slotFrom; slotIndices[1] = slotTo
    54.     // just swap them clientsided
    55.     var temp = player.skillbartop[slotIndices[0]];
    56.     player.skillbartop[slotIndices[0]] = player.skillbar[slotIndices[1]];
    57.     player.skillbar[slotIndices[1]] = temp;
    58. }
    59.  
    Open UIRefresh.css
    Code (CSharp):
    1. // after public Transform skillbarContent; add
    2. [Header("Skillbartop")]
    3. public Transform skillbartopContent;
    4.  
    5.  
    6. // after function UpdateSkillbar add (function content is copy of UpdateSkillbar with small changes)
    7.     void UpdateSkillbarTop(Player player)
    8.     {
    9.         for (int i = 0; i < skillbartopContent.childCount; ++i)
    10.         {
    11.             var entry = skillbartopContent.GetChild(i).GetChild(0);
    12.  
    13.             // get the reference
    14.             if (i < player.skillbartop.Length)
    15.             {
    16.                 // any reference in this entry?
    17.                 var found = false;
    18.                 if (player.skillbartop[i] != "")
    19.                 {
    20.                     // skill, inventory item or equipment item?
    21.                     var skillIndex = player.GetLearnedSkillIndexByName(player.skillbartop[i]);
    22.                     var invIndex = player.GetInventoryIndexByName(player.skillbartop[i]);
    23.                     var equipIndex = player.GetEquipmentIndexByName(player.skillbartop[i]);
    24.                     if (skillIndex != -1)
    25.                     {
    26.                         found = true;
    27.  
    28.                         // click event (done more than once but w/e)
    29.                         entry.GetComponent<Button>().onClick.SetListener(() => {
    30.                             player.CmdUseSkill(skillIndex);
    31.                         });
    32.  
    33.                         // set state
    34.                         entry.GetComponent<UIShowToolTip>().enabled = true;
    35.                         entry.GetComponent<UIDragAndDropable>().dragable = true;
    36.                         // note: entries should be dropable at all times
    37.  
    38.                         // image
    39.                         entry.GetComponent<Image>().color = Color.white;
    40.                         entry.GetComponent<Image>().sprite = player.skills[skillIndex].image;
    41.                         entry.GetComponent<UIShowToolTip>().text = player.skills[skillIndex].Tooltip();
    42.  
    43.                         // overlay cooldown
    44.                         var cd = player.skills[skillIndex].CooldownRemaining();
    45.                         entry.transform.GetChild(0).gameObject.SetActive(cd > 0);
    46.                         if (cd > 1) entry.transform.GetChild(0).GetComponentInChildren<Text>().text = cd.ToString("F0");
    47.  
    48.                         // hotkey pressed?
    49.                         if (Input.GetKeyDown(player.skillbartopHotkeys[i]))
    50.                             player.CmdUseSkill(skillIndex);
    51.                     }
    52.                     else if (invIndex != -1)
    53.                     {
    54.                         found = true;
    55.  
    56.                         // click event (done more than once but w/e)
    57.                         entry.GetComponent<Button>().onClick.SetListener(() => {
    58.                             player.CmdUseInventoryItem(invIndex);
    59.                         });
    60.  
    61.                         // set state
    62.                         entry.GetComponent<UIShowToolTip>().enabled = true;
    63.                         entry.GetComponent<UIDragAndDropable>().dragable = true;
    64.                         // note: entries should be dropable at all times
    65.  
    66.                         // image
    67.                         entry.GetComponent<Image>().color = Color.white;
    68.                         entry.GetComponent<Image>().sprite = player.inventory[invIndex].image;
    69.                         entry.GetComponent<UIShowToolTip>().text = player.inventory[invIndex].Tooltip();
    70.  
    71.                         // overlay amount
    72.                         var amount = player.inventory[invIndex].amount;
    73.                         entry.transform.GetChild(0).gameObject.SetActive(amount > 1);
    74.                         if (amount > 1) entry.transform.GetChild(0).GetComponentInChildren<Text>().text = amount.ToString();
    75.  
    76.                         // hotkey pressed?
    77.                         if (Input.GetKeyDown(player.skillbartopHotkeys[i]))
    78.                             player.CmdUseInventoryItem(invIndex);
    79.                     }
    80.                     else if (equipIndex != -1)
    81.                     {
    82.                         found = true;
    83.  
    84.                         // click event (done more than once but w/e)
    85.                         entry.GetComponent<Button>().onClick.RemoveAllListeners();
    86.  
    87.                         // set state
    88.                         entry.GetComponent<UIShowToolTip>().enabled = true;
    89.                         entry.GetComponent<UIDragAndDropable>().dragable = true;
    90.                         // note: entries should be dropable at all times
    91.  
    92.                         // image
    93.                         entry.GetComponent<Image>().color = Color.white;
    94.                         entry.GetComponent<Image>().sprite = player.equipment[equipIndex].image;
    95.                         entry.GetComponent<UIShowToolTip>().text = player.equipment[equipIndex].Tooltip();
    96.  
    97.                         // overlay
    98.                         entry.transform.GetChild(0).gameObject.SetActive(false);
    99.                     }
    100.                     else {
    101.                         // outdated reference. clear it.
    102.                         player.skillbartop[i] = "";
    103.                     }
    104.                 }
    105.  
    106.                 // not found? then clear
    107.                 if (!found)
    108.                 {
    109.                     // remove listeners            
    110.                     entry.GetComponent<Button>().onClick.RemoveAllListeners();
    111.  
    112.                     // set state
    113.                     entry.GetComponent<UIShowToolTip>().enabled = false;
    114.                     entry.GetComponent<UIDragAndDropable>().dragable = false;
    115.  
    116.                     // image
    117.                     entry.GetComponent<Image>().color = new Color(0, 0, 0, 0); // transparent
    118.                     entry.GetComponent<Image>().sprite = null;
    119.  
    120.                     // overlay
    121.                     entry.transform.GetChild(0).gameObject.SetActive(false);
    122.                 }
    123.             }
    124.         }
    125.         if (player.skillbartop.Length > skillbartopContent.childCount)
    126.             Debug.LogWarning("not enough UI slots for skillbar");
    127.     }
    128.  
    129. // and find void Update() and add after UpdateSkillbar(player);
    130. UpdateSkillbarTop(player);
    131.  
    Most important, dont forget open canvas layer on inspectior window and drag that new skillbar content rect. layer to Skillbartop field.



    Update: also don't forget add new tag name for skills slots number layer. Check image from http://forum.unity3d.com/threads/ummorpg-official-thread.376636/page-11#post-2670641

    Update 2: fixed LoadSkillbar loop
     
    Last edited: Jun 9, 2016
    JBR-games likes this.
  50. joncrzo

    joncrzo

    Joined:
    Sep 26, 2015
    Posts:
    30
    V1.23 [pending review]
    • Area of Effect Skills
    • Added more how-to's to the documentation
    • Added Monster.HasLoot() function that checks loot gold and loot items properly.
      • Loot window is now properly shown and hidden if the monster has or has no loot.
    Amazing update! This project keeps getting better and better. Thank you!
     
    xBeNjO and JBR-games like this.