- A* version: 5.2.3
- Unity version: 2021.3.44f1
Hi,
I am a complete beginner with AI. Starting a new game top down 2d.
I am looking for implementing a bridge where the the agents can cross the bridge under and above.
The problem is that i tried multiple time but i couldn’t find the answer. I tried graph Grid and LayeredGraphGrid with nodeLink2 but i think i don’t really understand how it works.
Does anyone can help i would be really helpful.
Thank you in advance.
Hey there, I can give this a look too- I don’t do much in 2D so this would be a good opportunity to get more in the nitty-gritty of using A* with 2D. Can you let me know what your setup looks like now, while I work to figure this out?
First of all thank you really much for your fast answer.
So it will be a top down game like sort of sims like where there will be free to wander in the scene. I am really starting a prototype and right now i am looking for making mulitiple layer with sprite and i want the agent to wander under bridges or above and taking stairs but i don t know how to link everything together. We are two in this project and we are more graphics designer than developers so i thought it would help me a lot to have this plugin to make it happen. What graph will it be? and is it possible to have more than one grid on top of each other and when the agent pass through they will choose the right one? or maybe i am completly wrong and it is an other way to make it happen?
Also sorry for my english this is not my first language :slight_smile
Thanks again
1 Like
I totally feel you on being more designer than developer- I’ve been an illustrator, graphic designer and web designer for like 15 years haha. Coding is relatively new for me I know how you two must feel jumping into this haha
So actually, I believe that the idea here would be to use the normal ``Grid Graph`, but use one per floor of your environment. When your agent encounters stairs, you could certainly use Off-Mesh Links (aka nodeLink2) to have them walk up the stairs, or you could simply change their traversable graph to the next floor’s graph when they get halfway through the stairs.
I actually did a search for this and that seems to be the general way this could be done it looks like. AFAIK the Layered Grid Graph is more tailored for 3D environments, so using multiple Grid Graphs might be your solution here. If you need help conceptualizing this in code, let me know and I can try and create an example project for you
Hi!
Thank you for your feedback; it’s nice to see that we understand each other on the more designer-than-developer side. For transitioning between floors, I think changing the traversable graph when they are halfway up the stairs is a smart idea to avoid any navigation confusion.
Do you think overlapping Grid Graphs could cause any problems?
Also, should I use the Seeker script " Tags " to ensure the agent isn’t affected by a grid that I want them to pass through? Or maybe " Traversable Graphs " also on the seeker?
I’m open to any help if you want to try to make me an example project would be really great to help me visualize things.
See you soon! And thank you!
1 Like
Overlapping Grid Graphs should be fine, you’ll just have to configure them to know which obstacles are on “their floor”, with Tags or Layers I’d assume.
I’d start with Traversable Graphs and if it’s missing any functionality I’d probably then look into how tags could help
And yeah absolutely! I can cook up an example project with a simple fella who goes up and down through the floors, however I might not be able to until maybe Monday, hopefully over the weekend?
Whoaaaooo
Thank you really much for your offer it is really nice too ask for help and see that the community is really nice and helpful.
Hey there, just a heads up; got started on this today, but won’t have time to finish it today. I’ll keep you posted
No problem take the time that you have to give!!!
1 Like
Thanks for the patience!
@aron_granberg I had a question I’m having a hard time finding the answer to with this specific combination: I thought I’d be able to set a Layer + Tag combo for Grid Graphs for more granular obstacle searching, but I’m not seeing it Maybe I just imagined this being a thing with grid graphs?
It’s possible to restrict collision and height testing by layer, but not by tag.
Checking for tags is pretty slow and complex in Unity, so it wouldn’t be feasible from a performance standpoint on the grid graph.
1 Like
Goootcha, thanks Let me play with some more options then
Ya know what, I’m actually really glad I tried to build this for myself. I realize it’s a bit more in-depth than I originally would’ve thought haha. I’m so used to working in 3D for all my projects that I didn’t even think about how this would work in actuality.
@aron_granberg I might have to defer this one to your expertise and try to learn from it as well. With overlapping Tilemaps, I couldn’t find a way to get a destination to “be on a certain graph”. My plan was to make destinations 1 & 2 on the first floor, and destinations 3 & 4 on the second floor. Then have off-mesh links between the floors, so when trying to go from destination 3 to 4, they’d take the off-mesh link, where I’d have a custom handler for it that switches the traversable graph, and enable the tilemap.
Sadly, if point 3’s position is reachable on that graph, there’s not a reason to go to the off-mesh link. So yeah, I’m stumped!
Any thoughts? Also, I have this project file I’m building for OP. Would love to contribute it as an additional sample if you’d like.
Whoaaoo I didn t that it will be so hard to make this happen when I started the project. I really don’t kown if someone could help us now. I f you fill it you can link your file it can be nice to see.
Thanks again for your time and effort.
If anyone have the answer please let. me know?
You’re fine I don’t mind it being difficult, that gives me a chance to learn something new myself. Will definitely let you know when we get something more concrete