Search Unity

[RELEASED] TopDown Engine by More Mountains [new v3.0 : damage types, damage resistance, and more!]

Discussion in 'Assets and Asset Store' started by reuno, Oct 9, 2018.

  1. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Toa5t > You'll want to look at the CharacterRotation2D ability.
     
  2. correojon

    correojon

    Joined:
    Jan 15, 2015
    Posts:
    11
    @reuno > Thanks for the quick reply! I think I'm going to try both and see which one fits my workflow better like you say. Option 1 seems better for the animation workflow, but option 2 seems cleaner and it may allow to do stuff that is not possible with option 1, like having the turret and body react independently to hits from a direction when they're looking different ways.
     
    reuno likes this.
  3. rozochkin13

    rozochkin13

    Joined:
    Nov 27, 2019
    Posts:
    6
    Hi
    I'm experiencing one issue with AI, probably it's not an issue, but I just wanted to resolve that somehow.
    When I use Demo scenes and put Melee weapon to AI guys, the Attacking state looks very strange - guys slides while Attacking.
    I tried to debug it, and it seems it's turns off "MovementForbidden" in movement ability a bit earlier than expected, I mean immediately! For Player character it works without this issue.
    I uploaded the video if that can help
    https://www.dropbox.com/s/7r44pt3ou9ias45/Screen Recording 2021-07-07 at 23.16.29.mov?dl=0
    Thanks.
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @rozochkin13 > Unfortunately that video isn't enough to tell what your problem may be, detailed steps of what you do would be more helpful.

    Here are some that I just tried :

    - create a new project in 2019.4.28f1
    - import TDE v2.1
    - open the MinimalAI3D demo scene
    - select the PatrolConeSeekAndDestroyAI, in its CharacterHandleWeapon, drag the LoftAISword prefab into its InitialWeapon slot
    - press play, get close to that AI so that it tries and attack you, notice it works fine, no slide

    Hopefully these steps will help!
     
  5. pgpais

    pgpais

    Joined:
    Nov 23, 2015
    Posts:
    12
    Hello! I'm back with a question.

    When I pause the game while still moving the character it keeps moving at the same speed indefinitely. Is this something I did wrong on my setup? I've been digging through the code and can't seem to find anything that stops the movement when the game is paused (I would guess the MovementForbidden variable in the CharacterMovement script should be set to true on pause?).

    This also happens for enemies with AIBrain. They seem to be stuck in the same state forever if the game pauses.

    EDIT: Probably should mention that I'm using the pause screen from the Koala demo. The CharacterCondition changes to "Paused" but the movement doesn't stop

    Another edit: I basically extended the Character Movement Ability and added this on Process Ability:

    Code (CSharp):
    1. void HandlePaused()
    2.     {
    3.         if (_condition.CurrentState == CharacterStates.CharacterConditions.Paused)
    4.         {
    5.             _horizontalMovement = 0f;
    6.             _verticalMovement = 0f;
    7.             SetMovement();
    8.         }
    9.     }
    It's basically HandleFrozen, just for a different state. Is there any reason not to do this?
     
    Last edited: Jul 8, 2021
  6. rozochkin13

    rozochkin13

    Joined:
    Nov 27, 2019
    Posts:
    6
    Thanks a lot for trying to help me.

    Unfortunately, I have reproduced all of your steps, before I did it on latest Unity 2020
    - Downloaded latest 2019.4.28f1
    - Imported TDE 2.1
    - Opened Minimal AI3D
    - Selected PatrolConeSeekAndDestroyAI
    - Dragged LoftAISword prefab into InitialWeapon
    - Pressed play
    - The same situation as before, If I move the hero while the AI is attacking, he slides.
    Attaching the fresh video:
    https://www.dropbox.com/s/yo6nbbwv6lxgekt/Screen Recording 2021-07-08 at 11.52.54.mov?dl=0

    If I can provide any additional info that may help to fix this issue, let me know please.
     
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @pgpais > Does the issue happen in any of the demo scenes in a fresh install? If yes, which one? On what version of the engine? What version of Unity?
    @rozochkin13 > I see what your issue is. The AIActionShoot3D forces the weapon to stop when exiting its parent state. Two ways to fix that : comment (I'll make it optional for the next release) the ForceStop line in AIActionShoot3D.OnExitState, or modify your AI's brain so that it waits in that state for the duration of the attack
     
    rozochkin13 likes this.
  8. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    Any plans on doing a pass to update all text components to use TextMeshPro?

    The standard Unity text components will be flagged as legacy soon and it's a bit painful to have to clone stuff like ButtonPrompt to use TMP.
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Cameron860 > If and when it happens, yes, definitely. For now there are still too many users who don't want to use TMP, I can't add a strong dependency to it. Do you have more info about it being flagged as legacy soon? I've been hearing that since 2018 and couldn't find more info.
     
  10. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    Not sure when they plan to flag it as legacy but I've seen Unity devs state they aren't developing the existing component anymore so I just thought everyone would be using TMP by now.

    @reuno I do have some other questions though. I need to move my player character via script (walk them to an exact position in front of box before starting a pickup animation) and it would be nice if I could use CharacterMovement.SetMovement(Vector3) similar to how AIs use it so I get all the state/feedback/particle-fx etc associated with that but when the controller is flagged as a Player, the input overrides this. For now I've added a flag to the base CharacterAbility that disables the input loop. Is there a better way to do this that I'm missing?

    Code (CSharp):
    1.         /// <summary>
    2.         /// Internal method to check if an input manager is present or not
    3.         /// </summary>
    4.         protected virtual void InternalHandleInput()
    5.         {
    6.             if (_inputManager == null) { return; }
    7.             if (!_inputEnabled) { return; } // disable input for ability
    8.             _horizontalInput = _inputManager.PrimaryMovement.x;
    9.             _verticalInput = _inputManager.PrimaryMovement.y;
    10.             HandleInput();
    11.         }

    Also, would be great if all the movement states and conditions were definable in a scriptable object or written as a partial class (so we can can write our own partial that is compiled into it) rather then enums as it means we're kinda stuck with the states and conditions that are baked in. I know enums makes it easier for editor dropdowns but it's a lot less flexible.
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Cameron860 > Right now there isn't, but I can add such a feature to the todo list if you'd like.
    As for scriptable objects over enums, that's how it used to be, but it proved too complex to handle for most people, and I went with a more straightforward approach based on that.
     
    Cameron_SM likes this.
  12. correojon

    correojon

    Joined:
    Jan 15, 2015
    Posts:
    11
    A general question: What's the most recommendable way of addressing a component of an instantiated object from another script? In my case I'm trying to get the Health component of the player from a BNProjectileWeapon script (which extends ProjectileWeapon), so that the player gets damaged when he uses a certain weapon. I can use GameObject.FindObjectWithtag("Player").MMGetComponentNoAlloc<BNHealth>(), but I'd like to know if this is a good practice or there are better ways to do it.

    BTW, when would you use GetComponent<>() instead of MMGetComponentNoAlloc<>()?
     
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @correojon > Weapons hold a reference to their Owner (a Character), and from there you can get a reference to Health (_health).
     
    correojon likes this.
  14. correojon

    correojon

    Joined:
    Jan 15, 2015
    Posts:
    11
    That makes a lot of sense, thanks! I'm loving how well organized everything is :)
     
    reuno likes this.
  15. Martin_Blackbird

    Martin_Blackbird

    Joined:
    Dec 23, 2013
    Posts:
    8
    Hi @reuno ,
    I have some issues with DamageDash2D; it seems to works properly when used in perfect sceneario (without hitting anything but the objetive layer) but I found two situations that broke the intended mechanic:
    - If you push de dash button before the coldown for the next dash is ready, the damageOnTouch area activates and it keep activated for good.
    - Same if you hit a wall/obstacle layer and the dash does not finish correctly.
    Seems like if the deactivation process does not work correctly because is linked to the finish part of the dash behaviour.
    I have not yet revised the code because I want to know if it is a known bug or if I did something wrong (by omiting any step or so) before messing around the code.
    I have an object with the DamageOnTouch inside the character as the documentation states and, like I said before, it works nice if dash action is completed.
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Martin_Blackbird > Please use the support form and provide repro steps if you think you've found a bug, thanks!
     
  17. UncleZhang

    UncleZhang

    Joined:
    Jan 14, 2020
    Posts:
    4
    Regarding the automatic shooting scene, how can I replace my model as quickly as possible? Now replace it with my model, only the hand will follow the upward direction, but the body will not turn.
     
  18. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @UncleZhang > Not sure what automatic shooting scene you're referring to, there's no such thing in the engine at the moment. Also not sure what you mean by "replace your model" in that context, you'll have to be more specific.
     
  19. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    @reuno Perhaps I'm missing something but I can't find a clean or obvious way to read the volume of a track from MMSoundManager - lots of ways to set it, but to read it (so I can initialise the UI sliders in setting) it seems I need to access:

    MMSoundManager.Instance.settingsSo.Settings.MutedMasterVolume


    ... Feels like I'm not doing that correctly
     
  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Cameron860 > As explained in the docs, MMSoundManager.Instance.settingsSo.Settings.MutedMasterVolume will give you the volume of the master track before it was muted.

    Its current volume will be :
    MMSoundManager.Instance.settingsSo.Settings.MasterVolume

    Music volume :
    MMSoundManager.Instance.settingsSo.Settings.MusicVolume

    etc.

    Edit : re-reading your message, maybe you meant you'd like a direct method to get it? I can add that to the next release.
    Edit 2 : public virtual float GetTrackVolume(MMSoundManagerTracks track, bool mutedVolume), coming soon!
     
    Last edited: Jul 25, 2021
    Cameron_SM likes this.
  21. a363881055

    a363881055

    Joined:
    Jul 11, 2021
    Posts:
    2
    Hello ! How can i achieve billboard effect like "Dont starve" game?
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @a363881055 > There are plenty of ways you can do that (none of them are related to the engine). You could have a script on your model force it to look at the camera, you could manually rotate your character's model so that it faces the camera, etc.
     
  23. goshki

    goshki

    Joined:
    Aug 11, 2015
    Posts:
    7
    Hi there! I'm digging into the inventory feature and was wondering if it's suitable to be used as a base for in-level containers (i.e. chests or more generally storage). InventoryItems declare their target inventory so if I have two chests in the level and I attach an inventory component to each of them then I can pick up an item to player's inventory and put it in another chest by using an MMEvent.Pick() but then I have to destroy the original item. This feels more like a hack than a valid usage of inventory feature... am I right?

    Other question relates to having items that are containers themselves. I'm not sure how to achieve a state when I have a box containing items and store this box in player's inventory. Any ideas?
     
  24. djdanlib

    djdanlib

    Joined:
    Jan 14, 2017
    Posts:
    15
    Hey, I have been doing some testing, and importing TopDownEngine (as of 2.1) appears to break Super Text Mesh (as of 1.11.5) in the Unity versions I tested, which are 2021.1.15f1 and 2021.1.16f1. This is kind of a bummer because I wanted to use STM for dialogue.

    I'm not really sure where the incompatibility lies, but it breaks the text rendering such that you still get shadows (which I think are shaders?) but the text doesn't draw under some unknown circumstances.

    You can repro the issue by creating a blank 2D project, importing both packages, and loading various STM sample scenes such as StageScene, Typing Input, and some general wonkiness in other samples like "Underline and Strikethrough" which for some reason puts the strikethrough bar behind the text if TDE is installed.
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @djdanlib > I don't know what SuperTextMesh is, so I'm not sure how to help. The engine doesn't do any rendering though, so it's unlikely to break anything. Maybe it's something in your project settings though (or quality/graphics settings). Try comparing them where that asset works for you.
    @goshki > There are already examples of chests in the engine (see KoalaDungeon for example), but they're not containers (as in you can't put stuff back in them). There's no "container" feature, but you could implement one on top of the inventory API, of course.
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @djdanlib TDE customizes the project's Sorting Layers. To fix strikethrough, edit STM's Line Prefab and change its Sprite Renderer > Additional Settings > Sorting Layer to a higher layer such as Above.
     
    StevenPicard and reuno like this.
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  28. djdanlib

    djdanlib

    Joined:
    Jan 14, 2017
    Posts:
    15
    Hey, that'll fix strikethrough for sure. Thanks @TonyLi.

    Ok, this is weird. I found a workaround that gets the text material to render as well. I have to change the Render Queue setting on each SuperTextMesh object so that it's higher than 3000, apparently. Why would that be special if TDE is loaded?

    You can repro this: Create an empty 2D project, load STM, load its StageScene sample scene, see that the text works fine, import TDE, and see that it's now broken. Change the "Render Queue" setting from 3000 to 3001, and see that the text is now drawn.
     
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @djdanlib > TDE is what Unity/the asset store considers a "complete project", it comes with predefined project settings (all it'd really need are mostly input and tag/layer settings, but unfortunately the asset store doesn't discriminate). So as I said earlier (and as TonyLi seemed to confirm), it's likely that something in these project settings is conflicting with that STM asset. I think if you compare the graphics/project settings (these would be the two first parts I'd look at), before and after import, you'll likely spot the issue.
     
    TonyLi likes this.
  30. goshki

    goshki

    Joined:
    Aug 11, 2015
    Posts:
    7
    Thanks, @reuno. I'll take a look at those chests in the example you mentioned.
     
    reuno likes this.
  31. septN

    septN

    Joined:
    Oct 29, 2015
    Posts:
    53
    I want to report an issue on "CharacterSwapManager.cs", on SwapCharacter method. If you place "CharacterSwap" abilities in a sub node, it will throw null error because of the lines that I bold below.

    Code (CSharp):
    1. /// <summary>
    2.         /// Changes the current character to the next one in line
    3.         /// </summary>
    4.         public virtual void SwapCharacter()
    5.         {
    6.             if (_characterSwapList.Count == 0)
    7.             {
    8.                 return;
    9.             }
    10.  
    11.             int newIndex = -1;
    12.  
    13.             for (int i = 0; i < _characterSwapList.Count; i++)
    14.             {
    15.                 if (_characterSwapList[i].Current())
    16.                 {
    17.                     newIndex = i + 1;
    18.                 }
    19.                 _characterSwapList[i].ResetCharacterSwap();
    20.             }
    21.  
    22.             if (newIndex >= _characterSwapList.Count)
    23.             {
    24.                 newIndex = 0;
    25.             }
    26.             _characterSwapList[newIndex].SwapToThisCharacter();
    27.  
    28. [B]            LevelManager.Instance.Players[0] = _characterSwapList[newIndex].gameObject.MMGetComponentNoAlloc<Character>();
    29.   [/B]          MMEventManager.TriggerEvent(_swapEvent);
    30.         }

    Is it a bug or, it's just CharacterSwap abilities can only be placed on Root despite of it being CharacterAbility inherited class?

    Is there any other magic abilities that can't be placed on sub node?

    Thnx
     
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    septN likes this.
  33. julianh65

    julianh65

    Joined:
    Mar 17, 2020
    Posts:
    9
    Hi reuno, had a quick question. I'm trying to use topdown engine with photon PUN to create a multiplayer game topdown game. Do you have any general guidance on how this would be possible?

    We're trying to start by networking the character as the first step and have the ability to create and join a room. After this we're transitioning to the 2d minimal scene and we're trying to see if we can get it set up such that we can have multiple characters in that room.

    Love the engine, and I look forward to your reply!
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @julianh65 > Hard to sum up months of work in a reply :)
    It'd be done like any network project, there really isn't much that'd be specific to TDE, if anything, so it's hard to give any specific advice or guidance here.
     
  35. julianh65

    julianh65

    Joined:
    Mar 17, 2020
    Posts:
    9
    Thanks for the quick reply! I'll try to do some more work on it and maybe post an update if I get it working/ if I have any other more specific questions.
     
    reuno likes this.
  36. julianh65

    julianh65

    Joined:
    Mar 17, 2020
    Posts:
    9
    Hi Reuno, just to follow up on my previous question. I'm trying to instantiate the characters using PhotonNetwork.Instantiate and then cast it as a Character object but I don't think it's possible to convert a GameObject to a Character Object. I'm getting this error:
    upload_2021-8-10_16-46-11.png

    This is the code I'm trying to edit

    upload_2021-8-10_16-46-25.png

    Do you have any idea how I can make the Character objects cast using the photonnetwork instantiate or how I can cast GameObjects into the Character type?

    Thanks again for your help -- currently in a hackathon and trying to use your engine to make a small multiplayer project.
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @julianh65 > No, indeed in Unity you can't convert a GameObject into a Character like that.
    I suppose you'll have to get the component, like you would for other classes. That said that'd be more of a question for the Photon people.
     
  38. julianh65

    julianh65

    Joined:
    Mar 17, 2020
    Posts:
    9
    Hi Reuno, sorry just another question, I've managed a small workaround by just changing the instantiation to the following
    upload_2021-8-10_17-46-30.png
    This kind of works except for the fact that it's now just a game object prefab -- the controls work, but the camera is not following the player.

    I wonder if you know any good way to fix this.

    One specific question I have to try to figure it out myself is I was wondering where the (Character) Instantiate method is defined. It returns a Character type object. Was trying to find it but couldn't find where it was defined.
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  40. djdanlib

    djdanlib

    Joined:
    Jan 14, 2017
    Posts:
    15
    I'm getting used to the 2D workflow, finally! It's a lot to process. Made a crude AIAction/AIDecision integration for Aron Granberg's A* Pathfinding and everything. Not sure I like that integration yet though, the NPCs get stuck on obstacles.

    Here's something I'd like to figure out. I want to manually force a character to face a certain way, without making it actually move, from within a custom ability's HandleInput. The animator's Idle state has directionality via HorizontalDirection/VerticalDirection, and that functionality seems to work fine after moving.

    I'm trying the CharacterOrientation2D.Face method, which seems like the right thing to do (Character.RespawnAt does it).

    However, looking in the Debug mode Inspector, it doesn't seem to change the HorizontalDirection/VerticalDirection parameters when I call it, which would explain why the animator isn't updating to face that direction.

    Am I missing something?
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @djdanlib > The CharacterOrientation2D.Face method only impacts the facing direction, it's purely visual, it won't have an impact on the actual controller direction, it doesn't impact movement, it just determines what way the character is facing.
     
  42. spvn

    spvn

    Joined:
    Dec 10, 2013
    Posts:
    80
    Hey there great asset. How easy would you say it is to use almost everything about this topdown engine, EXCEPT the AI component? I'm thinking of using something like Behavior Designer (https://assetstore.unity.com/packag...or-designer-behavior-trees-for-everyone-15277) to do my AI, but would like to use the rest of this asset for the remainder of the game.

    Would you say it's fairly easy to plug in a different AI asset like Behavior Designer? Or would you just recommend I write additional behaviours within your current AI system?
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @spvn > The AI system is entirely optional, if you don't want to use it, simply don't. As for how easy it'd be to replace it with an entirely new one, I can't answer such a question, that depends on your skills entirely. I'd say if you can't estimate the task, maybe avoid it for now, that's usually a good way to tell.
     
  44. spvn

    spvn

    Joined:
    Dec 10, 2013
    Posts:
    80
    Ah I'm a unity dev as my day job, I know how to integrate a separate AI asset. I think what I was trying to ask was if the AI "module" of your asset is completely modular, or if there were weird quirks that would tie the rest of the engine into assuming the AI component is definitely being used. Good to know it's modular, thanks!
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @spvn > It's entirely modular and optional, you can create a completely different system, the engine won't get in your way :)
     
  46. sauceboy

    sauceboy

    Joined:
    Dec 1, 2015
    Posts:
    4
    Is there a different means of spawning enemies on trigger? I tried to do the MM feedbacks for instantiate object but I can't find any way to have enemies spawn when the character goes through a collider or trigger.
     
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  48. spvn

    spvn

    Joined:
    Dec 10, 2013
    Posts:
    80
    @reuno Hey just out of curiosity, do you have any plans to update the shaders in the MMShaders folder to support URP? A lot of them seem really useful, but were written with the "surface shader" syntax making them quite hard for me to try to convert by myself... Not really a crucial thing but was curious as they seem really handy.
     
  49. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @spvn > No such plans at the moment. URP has been out for years, and it's still packed with issues and nowhere near production ready. Most people and studios still stick to SRP. If and when that changes, I'll consider it.
     
  50. superjakey

    superjakey

    Joined:
    Aug 21, 2020
    Posts:
    3
    Hi reuno, I was just wondering if there was any way to make a two-sided conversation with the "dialogue zone" script? By a two-sided conversation, I mean where the NPC you are talking to says something, and then the dialogue box appears above the player, allowing them to "talk" back to the NPC, and vice versa. (Sorry if I explained it poorly)