I want to make a tech tree at least like in Civilization, but I don't know how to do it. I want to fill in some data structure and then display it on the screen in the form of a technology tree, but I don't know how to implement it in code.
The only way I came up with was:
public class Technology1
{
String name;
TextButton button;
LinkedList<Technology1> NextTech;
}
TextButton is the libGDX class with which I was going to display each individual technology on the screen.
LinkedList NextTech- all technologies that are accessed after studying the current one are stored here. In other words, "children" are stored here . The problem is how to set the coordinates for all technologies when rendering the tree, so that the technologies do not overlap when displayed and so that the whole looks more or less normal.
If I started to do it wrong, then please tell me a more correct option.