Undoubtedly this is going to be complicated, but complicated is fun!
Here’s what I am hoping to do.
I have an AI that can move on its own and navigate an array of points. I want to up it up. I want to generate a list of points for the AI to follow, based on what rooms are availiable to go through, and make its way to the player.
Let’s say the AI is in room one, and the player is in room 4. I would want the script to return the list (1,2,3,4) so that it can make its way through the rooms that are connected, and get to the player, without going through walls.
I can’t think of any way to do this, and was wondering if anyone had any ideas. I originally had an idea to test each possible pathway to see if the player was in one of them, but that would require arrays of arrays and infinite variables, and I don’t believe that is possible… So I’m stumped! Any thoughts?
Any “waypoint system” or “pathfinding system” you google can help with this. You’ll want to study up on and use the built-in navigation system at a minimum, and if necessarily get something from the Asset Store with more versatility and customization options available. I’ve heard positive things about the Simple Waypoint System if you want to keep things nice and easy.
I highly recommend A* Pathfinding Project if you want to take it really seriously (like different navigational limits for differently sized characters). It has a learning curve, but even the free version has just about everything you could hope for, minus multi-layer graphs and local avoidance.