- Home /
Auto Generated pathing on a grid
Hello I've been thinking about how to go about making a random generated path but have come up with nothing so far. I Want a grid that can have a random generated path between the start and finish that never goes over it's self and have a player object instantiated to follow that path. The grid would preferably be made of empty gameobjects so they can have variables that can be checked and not used if the variables don't match what i want them to be. I also want the points put into an array of gameobjects attached to the player so the path can be altered.
Alright, so there are multiple things you mentioned, and will be multiple ways for you to achieve it. Let's break it down all, so rough skeleton may look like this. P.S. Since you didn't mention if it's 2D or 3D project you are ai$$anonymous$$g for, I am assu$$anonymous$$g it would be 2D, though the skeleton will pretty much remain same.
What you ai$$anonymous$$g for, can be achieved by creating an algorithm that will create maze. There are many maze algorithms available, and depending upon your choice it can generate exclusive 1 path solution or multiple paths.
A path and wall prefab, so this can be used to create the path and walls at the first, and later your maze algorithm may end up creating a maze on it.
A path-finding algorithm, A* aka A-star would be a preferred choice here. Since it checks the shortest path node by node, so you will need to implement that.
Pointers to be added to an array, well a list would be my preferred choice here, and this can be implemented either in your maze_generator or in path-finding logic.
You may have to make it all by yourself, cause as you can guess, it's already a lot of work, unless, if someone is willing to help you make one.
P.s. There are some great tutorials on YouTube for these concepts, try giving it a shot.
You will have to make it by yourself, cause as you can guess, it's already a lot of work.