@99Instances2Go, yeah, that looks a lot easier! When I enter 10 for the variable How_Many_NODes I never get 10, I get a random amount under 10, am I missing something?

A second question, how do I make this static once it's generated?For example, in a run of the game I would need to generate 10 of these on the start of the game and I would need access to these during the game.

evillair wrote:A second question, how do I make this static once it's generated?For example, in a run of the game I would need to generate 10 of these on the start of the game and I would need access to these during the game.

They already are static, so long as you do not run the generation events again or change layouts in game. Any loss of nodes on layout changes can be avoided by adding persistent behaviour to all randomly generated objects. You just need to remember that when you switch back to a layout all initial objects (stuff you place/see in the editor) will also be placed. So you need to check carefully if everything is where it should be and no new objects appear. Or worse, so you don't delete already existing nodes when deleting initial objects.

Alternatively, since you just need it for a map where you just pick it once every 5-15 minutes and do nothing else, you can have the sector branching map a separate layer above the fully random node map. Hide that layer when it is unneeded (FTL does this with the star map I think). However that approach has a different problem. You need to add some conditions to all clickable objects/nodes so that nothing happens when the branching map is visible or invisible. On clicked/touched events for invisible sprites to register.

Personally, as my current project is using lots and lots of window/screen for procedurally generated spaceships. I add a boolean to all button objects, if say ship weapons or ship cargo screens are visible (ship window button is set to true) I do not allow selecting a different ship to work as the ships are on a layer behind the window screens so you could click-through them.

If you go with the layer approach, I also recommend naming your layers and always using the string/text name in events (not the layer number), as adding deleting any layers of your project changes the layer number order and it becomes a chore changing all the numbers to the current ones and keeping track of them.

I solved the disconnected isles issues. Red lanes are lanes created by the gap-bridging logic I created:

Basically I added another boolean to nodes, which is only set to true after the connect function is fired for nodes connected via lanes to the initiating node. So if the number of nodes that are checked and the number of nodes that are connected is the same, but it is not equal to the number of total nodes, it means that unconnected nodes exist. Then I launch a "Pontifex" function that finds connected-unconnected node-pairs that have the least distance between their nodes. It retrieves two such pairs, creates lanes between them and lanes between the second least distant unconnected node, relative to the connected node of the pair. So 4 lanes per gap with two choke-points per gap. The overlap function may delete a lane or two, but it is guaranteed to create at least one lane per every gap (two for most).

It then goes back before the connection checking functions and runs them again. Once it finds that checked nodes=connected nodes=total nodes it stop running the generation logic.

The solution should work for any number of nodes. Although the execution time should be proportional to the square of the number of nodes.

I think what is happening is the pontifex function not firing. Either because node booleans were not reset to false after new lanes were generated or because the conditions for it firing did not work. I did a few dozen runs of this and did not encouter the issue eith the version i attached to my previous post. Unless that is an old file.

Send me the link to your capx via PM. I wil check what the issue is in 10 hours when I get home.

Sorry to bump this topic since all this time ^^' ... I prefer reopenit instead of open a new one ...

So this is why i'm here, i would like to make the Generation in a different way and i have start something that work well, but i'm stuck in this point, when i generate the link i would like a way for the algo do not create a link on a one that already exists or on a node near him, just can create link where no one exists and beetween random 0 to 3.

Just an interesting note...It might be worth looking at the "Delaunay Triangulation".It's probably overkill for what you're building, and it specifically produces a mesh of triangles which is a bit stricter than what you require, but it has some nice properties.

The Delaunay Triangulation does a good job of connecting nearby points without creating sliver triangles.

It's the dual graph of the voronoi graph. If you're familiar with voronoi patterns, for the Delaunay Triangulation, you get the center points of the voronoi cells, and create links between points in bordering cells.

Boris Delaunay, who came up with this Triangulation solution, worked on this back in the 30s. He also climbed mountains, and somewhere there's one named after him. I don't know much else about him, so I can only assume he lived as hard as he mathed.