Search Unity

Assets [v1.4] Node Map - Node-based maps made easy

Discussion in 'Works In Progress' started by Schneider21, Jul 27, 2017.

  1. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    @vyshan Hmmm. I'll have to dig into this. Stay tuned, and let me know if you discover anything else.

    And thanks for the feedback, too!
     
    vyshan likes this.
  2. Battin

    Battin

    Joined:
    Apr 8, 2015
    Posts:
    11
    Would this asset be useful for building a game like Lara Croft Go? Perhaps with a bit of scripting, but could this work?
     
  3. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    Hey, @Battin! I've not played Lara Croft Go. Is it similar to Hitman Go? I could see Node Map working for something like that, but as you mentioned, a good deal of that kind of functionality (lerped animations, moving obstacles, attacking/being attacked by enemies, modifying paths) would need to be handled through scripting.

    I would say maybe take a stab at making some of those mechanics first, using two adjacent squares or something, and if you find yourself needing something more robust to handle the pathfinding over a larger map, come check into Node Map. I'd also recommend checking out the documentation to ensure you're aware of exactly what Node Map does and does not do.

    Let me know if I can be of any help!
     
  4. Battin

    Battin

    Joined:
    Apr 8, 2015
    Posts:
    11
    Thank you for answering this quick.

    It is similar to Hitman Go, the only things that are changed are Animations and she is able to grab ledges in order to go to higher ground (instead of just a board).

    I have my animations and character ready. I just need a solution that can help me define a path, of which the character moves on. Whether its straight on the floor or moving upwards on a ledge.

    Your systeem seems suitable, but I just want to know for sure, before I'll buy it. Still, the asset looks amazing.
     
  5. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    Thank you! I feel confident Node Map could be a benefit to you, but I want to reiterate that any kind of functionality not covered in the demo would have to be scripted. I'm happy to offer advice on that kind of stuff once you get there, though, and if you find there's features you'd like to see added to the asset, I can see about adding them in, even.

    But please be aware that I have a day job as well, and things have been pretty busy and crazy lately, so my side projects aren't progressing as quickly as I'd like, so I can't promise a prompt timeline on asset enhancements. Just want you to be clear that you should be comfortable adding in functionality not provided by the asset on your own in case I'm not available for a bit.
     
  6. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    Hello there!! Just bought this asset and I have some minor issues / improvements i'd like to ask. But let me tell you you have done a AWESOME job!!!

    1- I'm using Unity 2019.1.9f1 and whenever I add a new Node Map in a scene, all transform tools gizmos (move, rotate, scale) for any Game Object that is NOT a Node are invisible, so I cannot use the arrows to move an object or the sphere to rotate. So if I have a Node Map in a scene, it is really difficult to move other Game Objects. I've tried loading another scene, creating a new one, disabling the Node Map, even deleting it... but the transform tools for the other game object types are gone :(

    2 - When adding a 2D map (as requested before), we have to rotate it 90 degrees to match unity's built-in 2D view. It is not a big issue, but worth mentioning

    3 -When adding a 2D node, it would be great to predefine in which Sorting Layer you want its SpriteRenderer to be in. I am using a 2D game with several sorting layers, and every time I add a new node I have to manually change its sorting order. Maybe in the "NodeTypeData" add a Sorting Layer option beneath the Sprite.

    4 - In a 2D game is not "usual" to turn the sprite towards the destination. It will be awesome if the "transform.LookAt" in line 209 of the agent to use a bool "Look at destination" in the agent's parameters so we can dedice whether we want the agent to rotate or not. I had to comment that line and it works perfectly :)

    I will continue to test the asset.
     
  7. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    Thanks for the purchase, @FibriZzo, and for the feedback!

    1. This issue was reported to me previously and seems to be new with 2019. I have a fix for it, and will roll it out in the next update.

    2. I don't think I ever came up with a good solution for this one. In your mind, how would this work? If you change between 2D and 3D, should it rotate the map for you automatically? Or should the default just be to align to the XY plane for 2D and have to manually reposition it if you want a 3D map? I guess since I designed the system with 3D in mind, I went with 3D as the default, but the requests for a more streamlined 2D experience are valid... I just don't know what the best move is to serve both appropriately. Ideas here for implementation are welcome!

    3. This is a great idea, and I will absolutely add this.

    4. I had this one on my ToDo list before and it slipped through the cracks. I think you're spot on again: an option to turn agents (defaults to true if map is in 3D mode when agent is created, false if 2D) that is specific to each agent. That way you can have some agents that turn and some that don't on the same map.

    I'll get to work on this soon. Keep an eye on this space for updates. And please continue to offer feedback and improvement suggestions!
     
  8. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    Thanks a lot for the quick response!!!

    Keep it up with the good work :D
     
  9. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    I will keep listing the things I've changed from the original code (in case you find them useful: they are all quick changes that I needed them for my project):

    1 -I think I've solved it by commenting the line 27 on NodeEditor.cs: Tools.hidden = true;
    I don't know if that solves "everything" about it, but it works for me

    2 - In 2D, the lines and the nodes are rendered in the sorting layer "NodeMap" automatically. That made them invisible in my game (there's no "NodeMap" sorting layer and I have placed the background of the game in another layer) because they were trying to render in a non-existent sorting layer.

    The solution I've created is that I've added a string parameter to the Map called "spriteSortingLayer", so I can change them from the Map itself. (Obviously, I've changed the MapEditor.cs to reflect this new field). Then, in path.cs and node.cs I've changed the code to use that variable when selecting the sorting layer.

    3 - When I pressed the button "Redraw Map", RedrawMarkers was called in every path (Path.cs). The problem was thay it only re-calculated the path points (CalculatePathPoints). I've added two more lines: the update of the line.sharedMaterial and the line.sortingLayerName, so if I change any of those, all paths visuals are updated accordingly, not only the new ones.

    4 - A similar solution I have applied when creating the BoxCollider2D inside the nodes: the scale was always 1,1,1. I wanted to change that value because my nodes were visually bigger than the size of the collider, so I could "click" in the image but the collider wasn't as big.

    Again, I've created a Vector3 variable inside the Map.cs called "nodeBoxSize" and every node that is created uses that size when creating the collider.




    Thanks AGAIN for your awesome asset!!!
     
    Last edited: Jul 17, 2019
    Schneider21 likes this.
  10. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    Hello there!

    Just a quick question, to see if anyone (or the developer himself) may help:

    How would you implement a gamepad/keyboard movement system using NodeMap?

    In my case, I only need a "node to node" movement: if I move the stick of the gamepad / press WASD on the keyboard, it will move to nearest node "in that direction" (the same as if I click on that node)

    I know it is difficult because right now there is no spatial knowledge of the other nodes, just a list of connected ones...

    Any ideas?
     
  11. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    @FibriZzo Do you mean using a gamepad or keyboard to move a cursor, and then pressing a button to set that Node as the target destination? I would do that by implementing a cursor object that moves the way you want using your own control scheme. Add a trigger collider that detects if a Node is inside it, and if so, enable the option for setting it as the destination. Optionally, when your cursor stops moving, you can check if it's intersecting a Node and snaps to its position. You'd also not want to use the keyboard/gamepad agent scripts, if that wasn't obvious.

    I also want to mention that I'm still looking into the previous issues you brought up. I thought at least a few of them would be easy to crank out, but I had trouble finding a way to make things function as an option, and to ideally not break existing projects using the asset. Couple that with busy personal life stuff right now, and you get disappointing progress. But keep the feedback coming! It'll work its way into the asset eventually!
     
  12. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    Yeah, that's basically what I am doing. I create a game object that will rotate as I press the stick with a big collider. Then, I will check which nodes this collider touches and see if I can move to that node (it is a direct path). If I press the button, i will move towards it.

    I have to check some more issues, for example: if there are more than one node in the same direction and "it is viable" to move towards more than one, I have to decide to which one to move to (for example, check the angle of the current axis and move towards the node with the smaller diference in angles).

    I will let you know my final solution and thoughs :)
     
  13. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    16
    This is my first implementation ;)

    It is working as intended. Obvioulsy, the visuals are placeholders, and it won't show the "area" of touching, but it works :)

    Lethal Honor Essence - 20190911 - Map moving with controller.gif

    Basically what it does is:
    - When I press the stick / WASD, enables the "NodeReacher", which is a game object with a collider
    - If that collider touches a Node, it adds it to a list of nodes. If it stops touching one, removes it from the list
    - Then, I send the list of touching nodes to a manager which will check which are "one step away" and "mark it" to show the player that he can move there (the red fireball).
    - If I have a Node selected and I press "X", I move there

    Easy peasy!

    :)
     
    Schneider21 likes this.