Hello need some guidance on how to start / best way to create the above programmatically so its random each time. Any advice?
There’s not really one solid answer here. Probably isn’t a ‘best’ way either. It’s going to entirely depend on what this actually is. What’s your use case?
To me, this is a series of dots connected together with straight line priority, and occasional junctions. You could make this algorithmically with a bit of trial and error.
This answer suggests that you create these dots (referred to as cities in the answer) and connect them based on that. Some dots can be terminators, others can be interchanges.
This comment says wave function collapse. It’d need a bit of adjustment, but it’d probably work.
I don’t think you’ll find an out of the box solution to this. My suggestion is just dive into some ideas and see what pops out.
To do this you need to codify the tree topology somehow. You want to somehow represent nodes (or vertices) of a graph and the links between them. This could be as simple as
public struct Node {
public int id;
public Coord position;
public int[] links;
}
With this you can do public Node[ ] tree;
and build the entire topology. But you need to experiment with different ways of feeding the actual data, whether you’d like it serialized, or fed from a file, or generated from code. Whether it all starts from a single root, or it has multiple roots (aka the forest) and so on.
Now the Coord should be discrete polar coordinates of the visual location
public struct Coord {
public int rung; // 0 = center; 1 = A, 2 = B ...
public int rail; // 1..43 or whatever
}
Then you need a way to visualize all of this, which is probably easier said then done, and beyond what we can do in a single short post.