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. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello @reuno!

    Thanks for your answer! The pathfinding itself is as fast as fast as before I added the additional scene loading, but as soon as the character starts moving the framerate drops. I was wondering if the CharacterMovement ability or the TopDownController2D might rely on a certain setup that was broken by having the level itself in an additionally loaded scene. I will check if I can produce a minimal example and ask in a more general thread thread, but if anything comes to mind, that I could check, I would be really grateful.

    Best regards,
    Patrick
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @patrickk2 > No, there isn't anything I can think of that should have this effect. Maybe profiling would point you at the culprit.
     
    patrickk2 likes this.
  3. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello @reuno!

    Okay, I will try that. Again thanks for your swift replies!

    Best regards,
    Patrick
     
    reuno likes this.
  4. TengShao

    TengShao

    Joined:
    Dec 13, 2022
    Posts:
    3
    ChangeCharacterConditionTemporarilyCo
    When my character is frozen state, trigger this function again, character state always changeing between Normal and Frozen.o_O
     
  5. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @TengShao > What version of the engine are you on? Why exactly are you triggering this internal method directly?
     
  6. TengShao

    TengShao

    Joined:
    Dec 13, 2022
    Posts:
    3
    My version is 3.0, I don't use this method directly. I trigger the state change through the DamageOnTouch component.
    Another problem is that when a character dies, it is in a frozen state, and when it is thawed, it will return to the previous state (Normal). At this time, the animation will play Idle for a while, and then disappear directly.
     
  7. TengShao

    TengShao

    Joined:
    Dec 13, 2022
    Posts:
    3
    Oh, it's my fault. The status has not changed all the time. It's because there are two characters in the scene, and two logs are output. This character has been frozen all the time
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @TengShao > It seems like it's resolved? If your issue persists, try to see if the issue is still present in the latest version of the engine. If it is, don't hesitate to report it and provide repro steps via the support form.
     
  9. o3428320d

    o3428320d

    Joined:
    Apr 5, 2019
    Posts:
    21
    hello, I am using the latest version, 3.1
    I am building a 3D scene based on the loft 3d scene.
    I set the level has a character switch manager and it has 2 char prefabs.
    All works fine, player can be switched by pressing P.
    But there is one thing, after I switched, I go around and find that the whole background is blur.
    The problems I found that is the focus target in MMAutoFoucus is not updated if switched player. So the DOF effect goes wrong.
    Is it a bug? Or I miss anything? How can I fix it, thanks.
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @o3428320d > At the moment that's not a feature of the engine, but I can add that to the next release if you'd like.
     
  11. o3428320d

    o3428320d

    Joined:
    Apr 5, 2019
    Posts:
    21
    hello, I have an enemy has 3 melee animation. I see that the engine can make combo melee attack. So, is the engine support random melee attack from enemy? If possible, how is it should be set. Thanks.
     
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @o3428320d > Animations are separate from logic in the engine (and up to you). The engine doesn't have random combo weapons, they are a sequential switch of weapons/attacks, without randomness. You could of course change the logic so that the weapons are random, but if all you need are random animations, then that's much easier, and can be done on your Animator's side.
     
  13. kawaiianthony

    kawaiianthony

    Joined:
    Feb 15, 2021
    Posts:
    7
    Hello, I want to point out some problems I faced when using MMCooldown. The MMCooldown class uses different states for different cooldown stages, but it doesn't have something like OnStateChange, which the normal MMStateMachine will have by default. If there is a OnStateChange event, we can play feedbacks when cooldown is done refilling and more. The MMCooldown class is used for many character abilities and I think adding a statechange event should be good.


    Also, the way of refilling cooldowns is very strange. This is the 139th line from MMCooldown.cs
    Code (CSharp):
    1. CurrentDurationLeft += (RefillDuration * Time.deltaTime) / RefillDuration;
    This is basically just
    Code (CSharp):
    1. CurrentDurationLeft += Time.deltaTime
    When consuming cooldown, CurrentDurationLeft goes from ConsumptionDuration to 0, and thus I think for refilling, we should also increase CurrentDurationLeft in proportion to ConsumptionDuration, and not to RefillDuration. Therefore I think there might be some typo at the line 139th, maybe it should be
    Code (CSharp):
    1. CurrentDurationLeft += (ConsumptionDuration* Time.deltaTime) / RefillDuration;

    In summery, here is the original code for cooldown refilling:
    Code (CSharp):
    1.                 case CooldownStates.Refilling:
    2.                     CurrentDurationLeft += (RefillDuration * Time.deltaTime) / RefillDuration;
    3.                     if (CurrentDurationLeft >= RefillDuration)
    4.                     {
    5.                         CurrentDurationLeft = ConsumptionDuration;
    6.                         CooldownState = CooldownStates.Idle;
    7.                     }
    8.                     break;
    Here is my own implementation, I changed two RefillDuration variables to ConsumptionDuration
    Code (CSharp):
    1.                 case CooldownStates.Refilling:
    2.                     CurrentDurationLeft += (ConsumptionDuration * Time.deltaTime) / RefillDuration;
    3.                     if (CurrentDurationLeft >= ConsumptionDuration)
    4.                     {
    5.                         CurrentDurationLeft = ConsumptionDuration;
    6.                         CooldownState = CooldownStates.Idle;
    7.                     }
    8.                     break;
    I hope this can be included in some updates in the future.
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @kawaiianthony > Yes, you could simplify that first line, it's just presented like this for readability / consistency, the cost of the operation (one way or another) is negligible. The original code looks good to me, I have to admit I don't understand why you'd change it, or what issue it would fix. Maybe I'm just missing the point here. If you think you've found a bug, don't hesitate to use the support form to report it (https://topdown-engine.moremountains.com/topdown-engine-contact), I'll be happy to have another look for you.
     
  15. kawaiianthony

    kawaiianthony

    Joined:
    Feb 15, 2021
    Posts:
    7
    hmm... Maybe I am thinking very weirdly because I am thinking how to update cooldowns with progressBars. I found that the CurrentDurationLeft is different when consuming and refilling cooldown. For example, when ConsumptionDuration = 0.2, RefillDuration = 10. When starting the cooldown, the CurrentDurationLeft goes from 0.2 to 0. When it refills, the CurrentDurationLeft goes from 0 to 10. Now I think of it, I am thinking CurrentDurationLeft as some sort of percentage and not an actual time value, and that is wrong, sorry to bring this stupid question up. Also i just realised if I use MMProgressBar to update, it might not be a problem at all since different max values can be used for the progress bars when updating.
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @kawaiianthony > There are no stupid questions, don't worry about it :)
    I've noted your point about OnStateChange though, I'll add that to the next release, thanks a lot for the suggestion!
     
  17. kawaiianthony

    kawaiianthony

    Joined:
    Feb 15, 2021
    Posts:
    7
    Thanks!
     
    reuno likes this.
  18. A-A346

    A-A346

    Joined:
    Jan 15, 2022
    Posts:
    1
    Hello @reuno

    I am using the 3.1.1 version of the topdown engine, and I found that when I use KoalaRifle to shoot enemy continuously, he will be pushed into the wall. Is this a bug?
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @A-A346 > Please use the support form if you think you've found a bug. Make sure you provide steps to reproduce it (engine version, unity version, what enemy you're shooting, in what scene, etc).
     
  20. winter288

    winter288

    Joined:
    Sep 28, 2022
    Posts:
    2
    thanks for the great assets

    I want to make it auto-aim and shoot only when the player character is not moving. like 'archero'
    I am making it using 'WeaponAutoAim' and 'WeaponAutoShoot' components.

    I found the option to control movement when attacking in the 'weapon' part,
    But, I couldn't find an option to block the attack. while moving

    I wonder if there are any options for this.
    Or should I develop this part by coding?

    I'd be grateful if you could suggest a simple and effective way.
     
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @winter288 > The easiest way would be to extend WeaponAutoAim to add a check on whether the owner is idle or not. If it's not, don't acquire any target.
     
    winter288 likes this.
  22. winter288

    winter288

    Joined:
    Sep 28, 2022
    Posts:
    2
  23. o3428320d

    o3428320d

    Joined:
    Apr 5, 2019
    Posts:
    21
    thanks for the great assets

    I have some enemies set in a 3d scene and I would like to have each enemy has its own footstep sound effect.
    I see that the engine support attaching walking sfx in character movement component.
    But I would like to have each enemy has 3d sound effect, so player can know how far the enemy is by hearing the walking sfx.
    Is the engine support 3d sound effect for character at the moment? As I can't find any place to attach an audio source to the character, thanks.
     
  24. ZZPsychosis

    ZZPsychosis

    Joined:
    Jul 22, 2021
    Posts:
    1
    Hi reuno, I want the object to follow the position x of my character (generated by LevelManager). How can I achieve this function? Better without programming.
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @o3428320d > You can nest an audiosource under your character and have that play when walking.
    @ZZPsychosis > Hard to answer without knowing what object you're referring to. I guess you could look at the MMFollowTarget helper.
     
  26. o3428320d

    o3428320d

    Joined:
    Apr 5, 2019
    Posts:
    21
    hello reuno,

    I have set some 3d enemies with ai, it will move to player and have melee attack.
    In the attack state, I set transition as aidecisiontimeinstate to 4 seconds (the enemy attack animation time), if true, attack state will go back to moving state.
    All works fine. But if I set the time shorter, the enemy may move away and still playing the attack animation. If I set the time longer, the enemy will play the attack animation once again even the player already moves away. It seems that I have to input the time very precise.
    So, I can only has enemy has only one kind of attack animation and the enemy can't have combo attack to avoid the above situation.
    Is there any ai decision can check if the current animation is finished already? Or do you have any suggestion for me to handle this case, thanks a lot.
     
  27. reuno

    reuno

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

    Blitz54

    Joined:
    Dec 20, 2020
    Posts:
    20
    Hello! I've been playing around with TDE a bit and so far it's fairly complicated. Couldn't really copy paste things to steal from sample scenes easily haha, everything is very integrated together. But after struggling for a while I got some stuff figured out pretty good now, mostly switching from unity input to rewired (and Bolt because I'm still using it as a crutch) But quick question, is there an example of an AOE explosion? The explosion particles on the Koala Gun are just for show, but curious if you have anything implementing the particles for damage, or at least a raycast. I've done similar before but I love the setup TDE has for weapons in general, so I'm trying not to rip things apart too much yet.

    Thanks!
     
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Blitz54 > I'm not sure what you mean by "implementing the particles for damage, or at least a raycast". You wouldn't use a raycast for an AOE, a raycast is a single ray, it's the opposite of an AOE. That's typically how the hitscan weapons in the engine work. Likewise, while you could theoretically use particle collisions, that's very expensive, so it's much better to just rely on a single collider for your AOEs. Don't hesitate to clarify what you meant if I missed the point.

    What you can do is instantiate a DamageOnTouch of any size, make it big and you've got yourself an AOE. You can look at the LoftGrenadeLauncher and its associated ammo and explosion for an example of that. The stun mine would be another, in which the AOE applies a stun.

    As for "everything is very integrated together", the engine focuses on being highly extensible and decoupled, so I'm a bit surprised. Feel free to drop me a line via the support form and clarify what you meant if you found things to be too integrated, it shouldn't be the case.
     
  30. Blitz54

    Blitz54

    Joined:
    Dec 20, 2020
    Posts:
    20
    @reuno Sorry, I meant circlecast. I had used it once for an auto targetting gun, so it would shoot the nearest enemy in the circle, which involves raycast stuff so you can adjust damage based on range. Regardless, thanks for the fast reply. I'll take a look at the DamageOnTouch, easiest way I guess is to time the collider to grow with the particle collision at the same speed, I'll figure it out eventually lol, just had to make sure I'm not missing something already done.

    As for the second part, it's no problem. Mostly me doing my part of poking at things without knowing how it works yet. Biggest issue was Unity Input wasn't working for me properly with my controllers, so I tried to switch to Rewired as that always works great for me. Too long to explain, but basically I couldn't steal the managers, camera, and other must haves from the sample scene without breaking things. Players needed an inventory, pickups only went to player 1, duplicated weapons with slight changes broke all together, some guns needed the sample scene camera to work, etc. Any time I tried to remove/disable a small setting I wasn't going to use it would yell at me haha. Got it all working by reading the FAQ on creating weapons and started from scratch. So good job on that, thanks. I'm know it was mostly me, just sharing how it went down as it's usually a bit easier to steal from the samples.
     
    reuno likes this.
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Blitz54 > You're right, a circlecast would also work for an AOE :)

    There are no examples of "growing" AOEs in the engine at the moment (the grenade's collider just appears and is covered by a quick - and similarly sized - particle explosion. You could make the collider grow, although I don't think I've ever tried it myself. Let me know how it goes if you try it!

    You may want to "steal" from the minimal scenes, that's what they're designed for (see https://topdown-engine-docs.moremountains.com/minimal-scene-requirements.html). Don't hesitate to ping me via the support form if you need help with anything, I'll be happy to assist, although it looks like you're already doing quite well!
     
    Blitz54 likes this.
  32. dontcomplain

    dontcomplain

    Joined:
    Jul 22, 2019
    Posts:
    5
    Hello, I have 3d AI gameobjects that I setactive to false when they are not being used and setactive to true when they are. but it seems to be messing with my animations. the weapons no longer rotates properly and the other animations randomly triggers.

    is there other gameobjects or scripts i'm suppose to active/enabled along with the AI gameobject?
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @dontcomplain > It's hard to tell without much information to work with. Enabling/disabling an AI shouldn't be an issue. You can verify that in the MinimalPerformance demo scene where the ProximityManager will enable/disable AIs (and more) based on proximity to the Player character. If your issue persists, don't hesitate to provide more information about how exactly to reproduce your issue via the support form.
     
  34. dontcomplain

    dontcomplain

    Joined:
    Jul 22, 2019
    Posts:
    5
    Nevermind, I think I found the cause. It was _characterMovement.SetMovement(_direction);
    I was setting _direction.x and _direction.y with decimal numbers. It wanted a whole number like 1 or -1, in order to change directions.

    Sorry for the lack of information, I'm still trying to get used to the framework.

    AIActionMoveRandomly3D works for me. But I was trying to create my own version.

    Edit: Nevermind the nevermind. The issue is still there.

    I will take a look at the proximity demo.

    And by enabling/disabling it. I mean reviving the AI when they die.
     
    Last edited: Jan 8, 2023
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @dontcomplain > Reviving an AI isn't done by enabling/disabling it. You can look at the AutoRespawn component to see an example of how it's done.
     
  36. dontcomplain

    dontcomplain

    Joined:
    Jul 22, 2019
    Posts:
    5
    Okay. I will look at that too. I think I finally narrowed down the cause. It's when I run the line: Instantiate(this.gameObject); When I was trying to mass clone an army.

    The weapon rotation goes wonky and it won't let me reset the y rotation back to 0.
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @dontcomplain > You've lost me :)
    Initially you were disabling AIs, then reviving them by enabling/disabling them, now you're mentioning Instantiate? If your issue persists, please use the support form and provide precise repro steps of what you're doing, I'll be happy to have a look for you.
     
  38. dontcomplain

    dontcomplain

    Joined:
    Jul 22, 2019
    Posts:
    5
    Sorry for the confusion, first I mass clone an army and I disabled them until they were ready to be used. Along the way my weapon rotation went wonky and I've been trying to narrow down and find the cause of it.
     
    reuno likes this.
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @dontcomplain > You may want to look at the timed spawner example in the Minimal Sandbox 2D demo scene, it seems pretty close to what you're trying to do.
     
  40. dontcomplain

    dontcomplain

    Joined:
    Jul 22, 2019
    Posts:
    5
    Okay, I will take a look at that. Thank you.
    And how do I open a support form?

    I've narrowed down the cause and it's definitely when I use Instantiate function.

    I went and open a new project and place this code in the AIActionMoveRandomly3D script:

    Code (CSharp):
    1. /// <summary>
    2.         /// On PerformAction we move
    3.         /// </summary>
    4.         public override void PerformAction()
    5.         {
    6.             CheckForObstacles();
    7.             CheckForDuration();
    8.             Move();
    9.             if (Input.GetKeyDown("space"))
    10.             {
    11.                 Instantiate(this.gameObject);
    12.             }
    13.         }
    So I can clone everytime I press the spacebar and the weapon rotation becomes like this:
     
    Last edited: Jan 8, 2023
  41. Poppa80

    Poppa80

    Joined:
    Nov 25, 2017
    Posts:
    8
    Hi @reuno, hope all is well!

    I have 2 magazine based weapons in my inventory that I swop between using 'T' but I can't seem to be able to keep the current amount of bullets left in the magazine when I swop. For example if I have 5 bullets left out of 10, swop to another gun then swop back, I want to still have 5 bullets left in the magazine.

    If I check the 'Should Load on Start' then it will have a full magazine every time I swop (which is to be expected) but if I uncheck it, it has an empty magazine every time.

    upload_2023-1-10_13-15-59.png

    I've gone through the documentation but can't seem to see any pointers - apologies if I've overlooked something!

    I can implement this but I just wanted to check it wasn't already in the engine.
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Poppa80 > There's no such feature, you'd need to implement it.
     
    Poppa80 likes this.
  43. o3428320d

    o3428320d

    Joined:
    Apr 5, 2019
    Posts:
    21
    Hi reuno,


    Is there any plan to let the engine support root animation for 3d characters in near future?
    Now, if I want to use root animation, I will have to remove all the z axis root keys to make it zero, but the result is still not satisfactory. Hope there's an update for this one day
     
  44. Trost_

    Trost_

    Joined:
    Dec 12, 2015
    Posts:
    17
    @reuno Hi!
    It looks like I've found a bug in the "ButtonDownRecently and ButtonUpRecently" properties of MMInput.

    I think, to properly work, you need to remove
    Time.unscaledTime -
    from lines 81 and 83 in the screenshot.
    upload_2023-1-15_18-17-28.png
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @o3428320d > No, there are no such plans at the moment, as the engine focuses on tight controls, root motion animation isn't something I want to encourage in this context.
    @Trost_ > You're right, this looks wrong. Please use the support form if you think you've found a bug, thanks!
     
  46. Trost_

    Trost_

    Joined:
    Dec 12, 2015
    Posts:
    17
    Okay, I've reported this through the support form.
     
    reuno likes this.
  47. JasonT4

    JasonT4

    Joined:
    Nov 19, 2018
    Posts:
    16
    I've tried to run it on android and I get this error:

    Screenshot 2023-02-08 141442.png
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @JasonT4 > A bit hard to tell without any context or info about what you did, but my guess would be you forgot to install the 2D extras. If you didn't forget, then I'll need more info about how you installed and built to get this error.
     
  49. JasonT4

    JasonT4

    Joined:
    Nov 19, 2018
    Posts:
    16
    Thank you for your quick reply.
    I'm using Unity 2021.3.18f1. On a fresh project, I've imported this package, switched the platform to android
    and tried to build it on a real android device.
    I assume you referring to the Unity's 2D extras in the Package Manager. If yes, I've install them, and I get the same error.
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @JasonT4 > With the correct version (for your unity version) installed from the repository (https://github.com/Unity-Technologies/2d-extras), I can't think of anything that could cause this error (Unity's tilemap is outputting it, not the TopDown Engine).
    If you don't care about tilemaps, you can simply delete the demos that use them (Koala, Deadline, Grasslands), and the error should go away, the engine doesn't have dependencies on tilemaps, only some demos use them.