Search Unity

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

[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 you answer, it seems my build issue was a case for "Have you tried turning it off an on again" :).

    I think my follow-up question regarding my other issue got lost (I shouldn't have asked in two different posts), but I would really appreciate any hints about existing controller API that lets me "teleport" a character (I quoted the original follow-up question below).

    Thanks in advance and best regards,
    Patrick

     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @patrickk2 > I guess that depends what exactly you're doing but you can use MovePosition, sure.
     
  3. JCPhlux

    JCPhlux

    Joined:
    May 27, 2018
    Posts:
    17
    I just created a pull request to add 8 way grid movement. Let me know what you think.
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @JCPhlux > I've accepted it (FYI I don't verify, test, or support anything on the extensions repos, it's just a way for people to share things).
     
  5. JCPhlux

    JCPhlux

    Joined:
    May 27, 2018
    Posts:
    17
    I tried to stick to you code style in case you wanted to add the feature to the main project. There are a few things I would have done different if it was going into the main project but I had to make it work as an extension.
     
    reuno likes this.
  6. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    I am using a random dungeon generation system that procedurally generates all the rooms at Start(). So I have no control over placing a spawn point in scene and binding it to level manager.

    The player prefab is present in the spawn room used in the dungeon generation system, but like I said above, I have a fixed position in scene and ensure that the spawn point I chose will be within the dungeon.

    How do I bind my character to level manager? Once dungeon is generated the player is present in scene, so I chose "characters already in scene" but how do I drag my player to here as the dungeon does not exist in edit mode but is generated in play mode.

    Thanks
     
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @farazk86 > There's nothing in the engine right now preventing you from modifying the spawn point.
    And if you prefer using a character already in the scene, you need to drag it, as explained in the documentation, in the aptly named SceneCharacters array.
     
  8. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    Thanks @reuno but the character does not exist in scene until I press play. ALso if I drag the prefab of player from the assets folder the camera fails to follow it so thats not working either.

    I guess my best best would be to extend the level manager class and and write code to search for the player character. Will report back if it fails for some reason :)
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @farazk86 > If the character doesn't exist in the scene then I'd recommend letting the LevelManager instantiate it.
     
  10. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    Then that brings me back to my original question. Instantiation will happen at the spawn point I drag into the scene. And I cant ensure that the spawn point location I set would have a dungeon generated under it.
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @farazk86 > If you generate the dungeon you can likely reposition the spawn point.
    If you don't have control over your procedural generation system, I don't have a solution for you.
     
    farazk86 likes this.
  12. Naughtykyuubi69

    Naughtykyuubi69

    Joined:
    Dec 4, 2015
    Posts:
    18
    Hey y'all a quick question and maybe I have missed it in the documentation, but perhaps could anyone point me to how to make level geometry transparent when it's between the player and the camera?
     
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Naughtykyuubi69 > That's not a feature of the engine, fortunately it's quite easy to do natively in Unity.
    The most common approach for this would be using a dissolve shader.
     
  14. Naughtykyuubi69

    Naughtykyuubi69

    Joined:
    Dec 4, 2015
    Posts:
    18
    Thank you for your prompt reply. I'm sure I can figure it out, but if I may make a suggestion? I think that would be a very nice feature to have built in to Top Down engine that is used where applicable.
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Naughtykyuubi69 > Sure, it's on the todo list, I'll add your vote to it.
    The main issue is that such a shader is tightly linked to your game's specific art style, so it's quite impossible to provide a universal solution.
     
  16. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Last edited: Mar 25, 2020
  17. MudPuppet

    MudPuppet

    Joined:
    Aug 10, 2012
    Posts:
    162
    Re: See Through Solutions...
    I tried my own Xray shader solution but it was a failure due to the fact that if a character had multiple geometry parts there was no decent way to control the distance/falloff between parts and it was suggested to me to run along the lines of Stencils instead. I then attempted to create a camera distance-based dissolve shader but got a bit stuck whereby in the Scene view it worked but for some reason with the Game Camera it did not. Currently I am using the See-Through System until I can work out something else.

    However, I did find a couple of web pages that have may shed some light on the situation - the link below was the best that I found on the subject.

    http://glowfishinteractive.com/dissolving-the-world-part-1/

    EDIT: Attached are my two basic shaders (created with Amplify Shader Editor) for Xray and Dissolve if anyone is interested.
     

    Attached Files:

    Last edited: Mar 26, 2020
    farazk86, christougher and reuno like this.
  18. Naughtykyuubi69

    Naughtykyuubi69

    Joined:
    Dec 4, 2015
    Posts:
    18
    y'all are awesome! thank you!
     
  19. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    Hi,

    So I wanted to add my own AI action to the AI Brian. I wanted the enemy character to dash towards the player. I could not find a pre-written script for this so I decided to write my own and extend the AIAction class.

    I used the other abilities as an example and thought it would be simple enough but its not dashing..

    Code (CSharp):
    1. using MoreMountains.TopDownEngine;
    2. using MoreMountains.Tools;
    3. using System;
    4.  
    5. public class AIActionDashTowardsTarget : AIAction
    6. {
    7.     public bool FaceTarget = true;
    8.  
    9.     protected Character _character;
    10.     protected CharacterDash2D _dash2D;
    11.     protected CharacterOrientation2D _orientation2D;
    12.  
    13.     protected override void Initialization()
    14.     {
    15.         _character = GetComponent<Character>();
    16.         _orientation2D = GetComponent<CharacterOrientation2D>();
    17.         _dash2D = GetComponent<CharacterDash2D>();
    18.        
    19.     }
    20.  
    21.     public override void PerformAction()
    22.     {
    23.         TestFaceTarget();
    24.         DoDash();
    25.     }
    26.  
    27.     /// <summary>
    28.     /// Faces the target if required
    29.     /// </summary>
    30.     protected virtual void TestFaceTarget()
    31.     {
    32.         if (!FaceTarget)
    33.         {
    34.             return;
    35.         }
    36.  
    37.         if (this.transform.position.x > _brain.Target.position.x)
    38.         {
    39.             _orientation2D.FaceDirection(-1);
    40.         }
    41.         else
    42.         {
    43.             _orientation2D.FaceDirection(1);
    44.         }
    45.     }
    46.  
    47.     protected void DoDash()
    48.     {
    49.         _dash2D.DashStart();
    50.         _dash2D.ProcessAbility();
    51.     }
    52.  
    53.     // Update is called once per frame
    54.     void Update()
    55.     {
    56.        
    57.     }
    58. }
    And my brain looks like the attached.

    This works, and the enemy looks at the player when in radius and the "Dashing" animator is activated and the animation plays. But the enemy does not move forward towards the player....

    Ive been on this trying to make it work for hours now and cant figure it out - I'm sure its a very stupid oversight but I cant see it.

    Am I writing the ability correctly? Is this how one extends the class?

    Thanks
     

    Attached Files:

  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @farazk86 > There seem to be a few mistakes in your code.
    You shouldn't call ProcessAbility (it's basically the ability's Update, as explained in the documentation) and you've got an empty Update (not bad per se, just useless). You're maybe getting errors that may point you at the main offenders here, I'd recommend checking your errors to understand what you're doing wrong.

    I'd also recommend looking at the documentation, which explains how to create actions, or at the many examples included in the engine. It may also be a good idea to test things in isolation first, and in a brain later on.
     
    farazk86 likes this.
  21. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    194
    Thanks for the reply. Initially I tried without ProcessAbility() but since it was not working I added that in just to see if that would work. Also I chad to change DashStart() from protected to public, since I had to make that change I was wondering if I did it right and DashStart() was not supposed to be called from outside.

    Unfortunately there are no reported errors in the console, it just works and the animation "Dashing" appears to run, just no movement.

    Since there are no errors in console, I dont know what to fix. But youre correct in making it work in Isolation first and then in brain. I'll try that.

    Thanks
     
    reuno likes this.
  22. EndVoid

    EndVoid

    Joined:
    Nov 19, 2015
    Posts:
    2
    Hello, 1st post here so first I want to say big thanks for this awesome asset! Really a complete package.

    Secondly, wanted to ask if anyone else has this specific issue: when using a XBOX 360 controller it doesn't work for me to look around with the second stick like it's supposed to. Any other input works fine.

    Thanks!
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @EndVoid > Did you follow the documentation and setup your weapons so that they work with secondary movement?
    If no, I'd recommend doing that. If yes, that's absolutely not normal, it should work, please use the support form and provide more details regarding what you're doing.
     
  24. EndVoid

    EndVoid

    Joined:
    Nov 19, 2015
    Posts:
    2
    Thanks! It worked after going through the documentation and setting the weapon.
     
    AhmedVawda likes this.
  25. AKAGT17

    AKAGT17

    Joined:
    Sep 8, 2014
    Posts:
    40
    Hi Reuno, I wonder if you can give me some pointers, i know this could be a nube question. On the title screen, with the play and the cog button icon, how do I map the xbox controller to function with the cog button icon and the options to configure the music on and off and save etc instead of using a mouse to click into it? Thankss
     
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
  27. jphales

    jphales

    Joined:
    Nov 15, 2012
    Posts:
    7
    Hello all,

    Can someone help me get started with this please. Been struggling with this for a week and I simply can't wrap my head around it yet. Trying to simply register a player spawned by MoreMountains' LevelManager into Mirror's(UNET's) NetworkManager. I'm not a complete idiot - and I've been scripting for years, created quite a few apps, but I'm not a seasoned engineer. I've never spent this long trying to understand/pull functionality from tools. I'm not adept enough at inheritance?

    On LevelManager's InstantiatePlayableCharacters(), I send the gameObject of the instantiated character to my NetworkManager,
    Code (CSharp):
    1. GameObject.Find("NetworkManager").GetComponent<MyNetworkManager>().localPlayer = newPlayer.gameObject;
    then when a server is created, I try to network register that gameobject
    Code (CSharp):
    1. NetworkServer.AddPlayerForConnection(conn, localPlayer);
    Seems to work ok on server creation, but on client connect: Error
    Object Player2D (Mirror.NetworkIdentity) netId=1 already has an owner. Use RemoveClientAuthority() first

    If I have the NetworkManager handle the instantiations then all is well, but I don't want to lose functionality of MoreMountains. Been through tons of videos and basic documentation, but I'm stuck between two separate classes that insist on instatiating themselves and I can't seem to get an understanding of all the behind-the-scenes associations that make it all work.

    Like the InputManager singleton, I want to maintain MM's Input functionality but I can't include 'using Mirror;'. So I can't use Network functions to check if I'm a localPlayer or not.

    Would appreciate help if anyone has a simple/elegant solution I can review and understand. (Would even pay a little to understand.) Thanks.
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @jphales > I'm not sure if that'll help, but you don't necessarily have to have your character instantiated, it can already be present in the scene.
     
  29. neapolitanstudios

    neapolitanstudios

    Joined:
    Feb 17, 2011
    Posts:
    75
    @reuno I'm working with the CharacterSwap ability. I want to prevent a character from being activated under certain circumstances. I figured I could do this by turning off "Ability Permitted" at runtime; however, this doesn't seem accomplish anything. Disabling the CharacterSwap script on a character also doesn't work. I assume that everything is initialised at level start? Deleting/killing a character isn't a problem - so something must be happening at runtime.

    Anyway, is there an easy way of accomplishing this?

    Cheers.
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @neapolitanstudios > The CharacterSwapManager is responsible for knowing what characters you can swap to. That list is computed at Start, and cached afterwards, to avoid unnecessary polling. That's what you'd need to target.
     
  31. indie_dev85

    indie_dev85

    Joined:
    Mar 7, 2014
    Posts:
    52
    @reuno for my enemies i want to add the punch/kick type attacks whenever player is within their range.Can you please suggest what will be best way to achieve it at it does not exactly fit in weapons class.

    Thanks.
     
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @indie_dev85 > That'd be what the advanced AI system is for.
     
  33. Blastboy

    Blastboy

    Joined:
    Oct 26, 2019
    Posts:
    4
    Hi @reuno!

    Its my first time posting here. Thank you for your awesome asset.

    I'm creating a mobile game and I want to make my playable character to auto aim the closest target and auto-shoot it. Is there something already built in the engine to do that? If not, what script would you suggest I expend to make it do it?

    Thank you very much!
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Blastboy > Hi and welcome!
    No, that's not something that is built-in at the moment, but it's very high in my todo list.
    If you don't want to wait for it to be added in a future update, you can look at the WeaponAim API. The best way to do it would be a new ability that targets your Weapon's WeaponAim, in the same way that the AI actions do.
     
  35. Blastboy

    Blastboy

    Joined:
    Oct 26, 2019
    Posts:
    4
    Ok merci beaucoup!
     
    reuno likes this.
  36. Sofiel

    Sofiel

    Joined:
    Aug 6, 2017
    Posts:
    60
    Hello @reuno & everyone else

    I’m sorry for posting this non engine related question but I couldn’t find the answer in google.
    I’m trying to make a bridge like the one in the top down section is contra 3 in snes where both npc and player could walk above or below simultaneously and both the character and projectiles would be in that “level”. Anyone have any ideas?
    Thanks for your time. (Sorry again @reuno )
     

    Attached Files:

  37. Einarm

    Einarm

    Joined:
    Jan 9, 2015
    Posts:
    3
    Let me know if you have an "official" way you want to handle bug reports. From my initial mucking around in the engine I've found the following, which I guess is not a feature:

    A 3D player will be blocked by a Box Collider on the Default layer when moving normally, but not when for instance rolling. My guess is that it should not be blocked at all on that layer, which seems to be true for AI-characters.
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Einarm > Please send all bug reports via this form : https://topdown-engine.moremountains.com/topdown-engine-contact
    As for your "bug", that's not a bug. Just set your layermasks properly and it'll work just fine. Default is not part of any layermask by default on the demo characters, and I wouldn't recommend it, but it's easy to fix if you really need to use that layer.
    Just select your character prefab, and in its TopDownController3D, add the Default layer to its ObstaclesLayerMask.
     
  39. Einarm

    Einarm

    Joined:
    Jan 9, 2015
    Posts:
    3
    Thanks, but you misunderstand. My player is at the Player layer and ObstaclesLayerMask is set to Obstacles. But it is still blocked by objects at the Default layer when walking, but not when dashing.It's not a big issue, and easy to avoid when known, but it stills seems like a logical error in the way collisions are handled.
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Einarm > No, it's (very probably) not a logical error.
    What's happening is you (likely) have Default and Player set to collide in your collision matrix, and that's why it's behaving like so. Fixing that will solve your issue.
     
  41. Einarm

    Einarm

    Joined:
    Jan 9, 2015
    Posts:
    3
    Fair enough, I stand corrected, did not realize that the different move methods actually get their collision data from different sources. Default/Player is indeed marked for collision in the Layer Collision Matrix in the unity package.
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Einarm > There's the engine level (the layermasks you'll find in abilities and other components) and then there's Unity's physics level, at the base of everything.
     
  43. Naughtykyuubi69

    Naughtykyuubi69

    Joined:
    Dec 4, 2015
    Posts:
    18
    I have yet to figure it out, but I'm hoping y'all might be able to clue me in. I'm trying to create a teleporter that has to be unlocked with a key before you can use it. I've tried setting it up like the locked doors in the demo but the locked teleporter doesn't seem to be acting like it's locked. it instead just goes ahead and teleports the player.
     
  44. Monkeygrenades

    Monkeygrenades

    Joined:
    Sep 20, 2019
    Posts:
    1
    Hey Reuno!

    I am thinking about picking this up, as well as your 2d platformer engine. Do both engines support enemies firing toward my player? I am new to all this, but my current sidescolling space shooter has enemies that ONLY shot along the X axis, I would love to have some of them turn and fire at the players current position. Same for my platformer I plan on working n next :)
    thank you!
     
  45. MudPuppet

    MudPuppet

    Joined:
    Aug 10, 2012
    Posts:
    162
    Hello, I don't know whether this idea is any good or not but I have a very minor suggestion for Character Movement/Run Ability in Progress Sfx and that is to perhaps have some kind of an editable delay amount (in time) whereby the user could add some small delay to walk/run footsteps sound effects and avoid having to jump back and forth between audio software and Unity to get footsteps sounds just right. I just had a heck of a time sorting this out and it would have been heaps easier and faster if I could have just added in a small delay amount via the Inspector. This would also make life much easier if I were to change the speed of the character's walk/run as I wouldn't need to jump back to audio editing software to tweak audio speed or add in (or remove) empty sound space that would normally be used to match footsteps timing. Hope this makes sense.
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Monkeygrenades > Yes, enemies can shoot at you (in both engines).
    @MudPuppet > You can use the feedback system for that.
     
  47. PlueBlue

    PlueBlue

    Joined:
    May 23, 2017
    Posts:
    1
    Hello
    Just started using this TopDown Engine and its amazing as a beginner, everything is very easy to understand.
    I just have a quick question, i want to have the projectiles reflect off the colliders when they hit an enemy or obstacle, what would be an easy way to add this?

    Thank you
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @PlueBlue > That's not something that is built-in at the moment.
    I suppose the easiest way to do so would be to extend the Projectile class to add this specific behaviour.
     
  49. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Hi was looking at the demos for this and the webgl was really slow (< 20 fps) on a basic gaming laptop (i7/960m). Maybe optimise the webgl version (no post-effects?), because the downloadable PC version was always over 60fps?
    There is slight stutter on movement though, maybe a camera/physics sync issue?
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @andyz > I have no plans to optimize the webgl demo any further.
    From the stats I collect, it seems ot run fine on most PCs, most people get more than 60fps, which is enough for a demo. Not sure why you'd get so bad values, could be a driver thing, could just be a random unity/gl issue (there are a lot of them).
    In any case, fixing Unity's many issues with webgl is a bit outside of the scope of the engine :)