2D Tile Road Pathfinding

I’m currently trying to implement a simple path finding script which will just follow different roads on a 2d tile grid.
It might not even fall into the category of path finding since there are no obstacles - only different pieces of road which should be followed.
I would like to then be able to return the path which will bring you the closest to the target tile in as little moves as possible.

So here is my grid:
[26111-screen+shot+2014-05-04+at+12.21.01.png|26111]

I started by creating a new class for each tile and named it the Tile class - this class just holds information on each tiles rotation, position in the grid and type of tile.

I also created a new class called QuadInt which will just hold 4 integers. I use this class to store which directions of a tile have road on them. For example:

Tile newTile = new Tile();

newTile.type = 1;
newTile.directions = new QuadInt(1, 1, 0, 0);

This would look like this for a tile:

26112-example_tile.png

So QuadInt(1, 1, 0, 0) describes if the top, right, bottom and left part of a tile have road on them.

Now I can know the road directions of each tile and compare them to find a continuous path.
This is where I am getting stuck unfortunately.
The main problem is that the roads have multiple conjunctions at which the path can take two or more different turns - I would have to follow one path and then go back to the first conjunction and follow the second route and do the same for any other crossroads along the way.

I would like to find my own solution if possible since I would like to learn how this kinda thing works… I’m not sure if A* could be used in this scenario?

Are there any flaws in my approach and any ideas on how to deal with this issue?

Thanks for the help!

You could start with a basic Bfs algorithm.

Each tile knows about the next tile and you just use the algorithm to find all paths. unitygems.com - unitygems Resources and Information.

Instead of returning when you get a path, you store it and compare them and pick the shortest.

Other way, use A* which not only will find the shortest but also will go faster since it uses heuristic to predict which should be shorter.

I know this is a quite old question, but is therea new unitygems.com - unitygems Resources and Information. or can I get a bit of the old code if this avaiblable?
I still have problems with lining up the tiles correctly.