The final goal is to create a road system similar to the one in Diablo2. A random enterance and exit are plotted on the map, then a winding path connects the two nodes. I have implemented a system that selects two random places on the edge of a map, then connects them. My issue is that the path is rather boring. Are there any good ways to improve the path my road takes? This is what I currently use to create the path:
private List<Vector2> generatePath(Vector2 p1, Vector2 p2)
{
List<Vector2> nodes = new List<Vector2>();
nodes.Add(p1);
while (!p1.Equals(p2))
{
float xDiff = p2.X - p1.X;
float yDiff = p2.Y - p1.Y;
double atan = Math.Atan2(yDiff, xDiff);
double quadrant = Math.Round(4 * atan / (2 * Math.PI) + 4) % 4;
if (quadrant == 0) p1.X++;
if (quadrant == 1) p1.Y++;
if (quadrant == 2) p1.X--;
if (quadrant == 3) p1.Y--;
nodes.Add(p1);
}
nodes.Add(p2);
return nodes;
}