Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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,959
    @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,959
    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,959
    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:
    17
    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,959
    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:
    17
    Thanks a lot for the quick response!!!

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

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    17
    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:
    17
    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,959
    @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:
    17
    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:
    17
    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!

    :)
     
    rrahim and Schneider21 like this.
  14. lapoleon1821

    lapoleon1821

    Joined:
    Oct 1, 2019
    Posts:
    2
    Hello there, thanks for making a very nice system to build a game on. My purpose is to make a strategy game with different locations on the map connected by roads etc. Your node map seems to be ideal to do this, so I bought it to give it a try.

    I have two questions:
    1: Do you have any experience with Playmaker? I was wondering how difficult it isto convert parts of the script to Playmaker, since I'm making the majority of the game with that system. It would be really useful if Playmaker could find neighbours etc.
    2: If I would like to add extra standard variables to a node (population, food production etc.) I should add them in the Node generation script right?
     
  15. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,959
    @lapoleon1821:

    1. I own Playmaker but haven't really used it, much less created integrations for it. My understanding is it should give you access to public members of scripts, though, and everything you should want access to within NodeMap is public and accessible.

    I'll try to find some time to mess around with Playmaker and see if I can get a working example or something. Or maybe it'd be a relatively easy bit of work to create an integration that allows you to use Playmaker without having to touch the code, which would probably be great for the non-programmer users of NodeMap. I've been swamped with work and life stuff recently, so I'm woefully behind on addressing items with this asset. Stay tuned!

    2. I would think you'd want this to be a separate script you attach to your Nodes. I'm hesitant to recommend modifying any of the scripts that come with the package, as any updates I'd push will overwrite your changes when you update. There might be a way to have it so NodeMap emits an event for, like... everything, so you can watch your Map and have certain scripts added automatically as needed.

    Are you generating Nodes at runtime, or just in the Editor?
     
  16. lapoleon1821

    lapoleon1821

    Joined:
    Oct 1, 2019
    Posts:
    2
    Currently I'm generating them in the editor. So it's easy enough to copy FSM's manually, but it's always better to make as much automatic as possible.
    Thanks for the tips, I agree that it's probably best to create my own script and then refer to that whenever needed.
    It would be great if you could look at Playmaker integration, but don't sweat it, I know how much time small children can take up :)
     
  17. D-DutchDave

    D-DutchDave

    Joined:
    May 4, 2018
    Posts:
    13
    Hey!

    I'm currently searching for a system just like this to use in my project. From what I've read here, on the store page itself and in the documentation this seems very suited for what I had in mind. I do have a few questions though.

    1. Are there any videos available of it in action on a "cube" node map, just like the screenshot on the asset store?
    2. How well optimized is this system? And are there options to improve performance by disabling certain options?
    3. Is there some sort of system that allows me to create a 3d grid, for example 5x5x5, in editor?

    Thank you!
     
  18. Brunosly

    Brunosly

    Joined:
    Nov 8, 2012
    Posts:
    2
    Does someone know if the curved paths were implemented?

    Also, is there a way to cancel a movement? I found the pause method on the Agent but I would actually like to stop it not just pause.
     
    Last edited: Dec 1, 2019
  19. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    node placer for NodeMap
    mouse + space key
     

    Attached Files:

    rrahim likes this.
  20. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    hi, Justin, are you around?
    looking for advice.

    using offset from a node for a lane.
    this is how it looks
    Clipboard02.jpg
    and works well, but have an issue with direction:

    see gif. the first node in on up-right, the last node is down-left
    nodeMap finds the (shortest) route in opposite direction, so the car turns
    I'd want it to continue in that direction
    (ie. to have a route which goes around to the finalNode, but doesn't make a 180)
    pathdirect.gif

    should I try to divide the route into sections (adding an array of endNodes)?
    makin up a route like that would slow the workflow, is there an alternative?
    _______________
    minor issues:
    - if nodeMap is copy-pasted, sometimes PathFinding() fails [missing reference error if I remember correctly]
    - switchin off draw markers and draw nodes, and node colliders a bit clunky (path markers have to be switched off one by one as multi editing not supported, but I can live with that, if it's hard to change)
     
    Last edited: Jan 29, 2020
  21. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,959
    Hey, @dibdab. I'm still around. I just haven't been very active lately because of life just sort of taking over. I'm on a tough project for my day job that's been requiring me to put a lot of brain power in, and when that happens, I don't have a lot left in the tanks to work on my personal projects at the end of the day. So the updates I've been wanting to do to NodeMap have been critically delayed.

    I wanted to start by saying I'm very impressed with your clever adaptation of NodeMap to work as a traffic system. While I designed the package to accommodate several different use cases, moving cars wasn't really something I thought would be suited well for what I had come up with. Once I saw there was a desire to use it for that, I started work on a new asset that would be designed around simple traffic systems, but using the same node-based approach as NodeMap. (After typing out much of this post, I went back and looked, and saw it was you doing the traffic thing. So I guess you're very much responsible for me creating this new asset!)

    upload_2020-1-29_8-40-6.png

    This project, too, has been sorely neglected, but I really do want to finish it and get it out there for people to use, assuming there's a desire for it. Anyway, on to your questions.

    - - -

    If I'm understanding the problem correctly, it sounds like once the car reaches its destination Node, it then sets a new target destination and finds the shortest path to it, which leads it right back the direction it came. You'd like it to have to find a more realistic and traffic-abiding path, so it would continue around a loop to get there, for example. This type of path finding is beyond the built in A* style that NodeMap uses. But don't worry! We're good developers, so we can figure this out!

    Your previous method of having a path per lane solves this problem easily, because you can set the direction for each lane, and the pathfinding has to respect that direction to get a new route. But that obviously slows your workflow down a lot, and creates way more nodes than the system was really built to handle (performance will likely become a problem).

    What if we kept track of the most recent Node that an Agent passed (not counting its destination Node) and modified or wrote a new pathfinding function that would seek a path that does not allow going through that node? Do you think that would suit your needs? Maybe give a glance at your whole map and plot out some navigation cases in your head. If that sounds like it'll work, I'll whip something up that I think should do the trick, and you can try it out and see if it works the way you expect.

    - - -
    Copying and pasting is likely to be problematic, since I have no idea what Unity does with reference variables when you do an operation like that. My guess is that something is not being populated when you do this. I can take a look, but the first thing I would recommend would be to check the Node Data field on the copied map and make sure it has something assigned to it.

    - - -
    I agree. It was something I thought to include, but didn't test much during or after development (as I generally always wanted to keep them on. I think what I ended up publishing was a half-baked implementation that became tricky to change after the fact.

    The updates I have planned and in the works for NodeMap are enough to constitute bumping the major version up. So that release would take care of a lot of these kind of issues. I learned a lot about what I did wrong with NodeMap while working on this traffic system asset, and I think I can use a lot of that knowledge to make NodeMap easier to work with. I'm reluctant to offer a timeline on that, as work is still pretty crazy and I've not had much time in the last few months to work on things, so I've gotta find a way to get back into the groove again before I can hope to have an idea of what will all be included and when.

    But please know that I appreciate all of this feedback, and have not given up support for this asset. When I do get around to releasing an update, I intend to make it one that was well worth the wait.
     
    rrahim and dibdab like this.
  22. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    all I'm using is getting the nodes
    Code (CSharp):
    1. public List<Node> nodes;
    2.  
    3. nodes = Pathfinding.FindRoute(startNode, targetNode);
    (I'm not using Agent, but Brunosly might still want to know about it)

    crossin.jpg
    Clipboard03.jpg Clipboard04.jpg

    by setting lane as offset, the traffic goes both ways
    all cars use the same nodes, and because of that I think will need to add the crossings into the play somehow on top of this
    (and still don't want them to do 180:) )

    kinda think now that this won't be possible to pull through (since there's no guarantee even if a crossing point is added to the path, that the shortest is the right direction)
    and will have to add path for each lane
     
    Last edited: Feb 10, 2020
  23. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    I was just working with NodeMap, couple of notes

    it would be cool if more nodeMaps could be in one scene
    (first I thought one for vehicles, one for pedestrians etc)
    it is possible to have unconnected set of nodes, and pathfinding works fine
    separateset.jpg
    but if having a bigger map still would be useful when switching off a tile to save resources
    (having one nodemap for each terrain tile)

    the other thing is, after I created the nodes and the paths realized that have to set all of them from two-way to one-way
    so it would go like: extend node > select path > set to one-way
    as the default is two-way. I guess there's no way around that to speed up workflow...

    I see your traffic system version has nice indication of path directions,
    is it coming along?

    can you write a function that would rule out paths containing a node?
    I think for my previous one-lane approach it would not work 100% because the past node might be part of the new route in some case
    but this might be well useful for game design purposes (like if don't want the Ai to go somewhere)
     
    Last edited: Feb 10, 2020
  24. DADA_universe

    DADA_universe

    Joined:
    Mar 14, 2015
    Posts:
    39
    http://justinschneider.com/ is not loading, seems down. Please check. Wanted to read through the docs and review the demo to decide on if the asset meets my needs, but not been able to.
     
  25. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,959
    @DADA_universe Sorry about that! I allowed my VPS to lapse while I was working on a new version of my site, and there were things that I lost in the process.

    You can view the current version of the manual here. I'll try to get the demo up and running again ASAP.
     
  26. DADA_universe

    DADA_universe

    Joined:
    Mar 14, 2015
    Posts:
    39
    Thanks.
     
  27. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,959
    Not a problem. Thanks for bringing it to my attention, actually.

    If you have any questions, feel free to ask. I try to be straight-forward about what Node Map can and can't do. And bear in mind that while I do have some improvements, enhancements, and new features planned, I don't have a concrete date for when that update might happen yet.
     
  28. DADA_universe

    DADA_universe

    Joined:
    Mar 14, 2015
    Posts:
    39
    Some questions please.

    1) Can prefabs be spawned to the nodes or will it only work with meshes?
    2) For what I would like to use the asset for, the nodes would have images (nested in prefabs) and text while the paths will have contextual text attached to them so agents can review the text on different routes before choosing which one to follow. Any issues with this?
    3) Can I have nodes (and / or maps) created programmatically (based on data stored in a scriptable object for example), such that other game play aspects may populate or change the content of the scriptable objects and the map / nodes get modified in response to this automatically?
    4) Can Players get to spawn and / or modify nodes during gameplay based on data they've generated during gameplay as described above?
    5) What's the road map you have for node map? More in terms of features you are thinking of, knowing timelines might be at best optimistic.

    Many thanks.
     
  29. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,959
    @DADA_universe:

    1) I started the project out using prefabs, and somewhere along the line got the idea that it would be better to use meshes and materials directly. I've since flip-flopped back to believing prefabs would be much more preferable, and that's absolutely in the roadmap.
    2) This is definitely doable if you're comfortable writing your own scripts, but it's admittedly more complex behavior than what I designed this system for. There might be a way to do that with this current version of Node Map (and I'd be happy to sit down and try to think through it with you), but if it were me writing this solution, I can't say that I'd use Node Map as it exists now to achieve that.
    3) Yes, absolutely. I made the entire API public and tried to document it as well as I could for this purpose. However, several people who've used it to do programmatic maps have brought up issues or requested additional features which I've tried to provide, so I can't promise it's smooth sailing.
    4) Yes, but this would be entirely scripted on your end. Node Map's API provides a way to get nodes by id (which you can get from Agent's position or through your own player system), and most properties are public and modifiable. Again, though, since I haven't actually done this myself, I don't know yet what kind of things might be encountered during that process.
    5) It's... loose. I write code for my day job, and when work is busy (as it has been for the last couple months) I don't have a lot left in the tank when I get home. My kids are in that special age range (4 and 2) that take every last drop of energy I have, too, so I've not been working on the asset as I intended.

    With that said, the changes I was working on include changing how camera/map rotation works so that it's more intuitive for both 2D and 3D workflows. I started making everything Scriptable Object-based, as well (like Agents not just being a string field).

    My plans include adding curved paths, changing Nodes/Markers to prefabs, improving the usability of Agents to better fit with custom player objects, and add PlayMaker integration. These changes would be significant enough that it would introduce incompatibilities with previous versions of Node Map, so it would be a major version release. I think Summer of 2020 is a realistic goal for this update.

    If you decide to purchase Node Map, please do so with only its current features in mind (current documentation available here), since I'd hate for someone to buy a promise that ends up getting "adjusted." If you decide Node Map isn't for you, please feel free to hit me up in a PM and we can discuss things like pathfinding or other topics that may be of interest to you if you set out on building this on your own.
     
    ricardoianelli and rrahim like this.
  30. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    552
    Any news on curved paths? And moving to a ScriptableObject based approach sounds like an excellent idea!
     
unityunity