drek wrote:whoa, you've been busy.
Not especially... the difference between this and the previous version with culling instead of tree growing isn't that much...
Levitt situation is odd. I don't remember why, but at some point in time I had disregarded this sort of thing as a likely consequence of growing trees. When my brain's less frazzled I'll try to figure out what's up.
What's to figure out? I grow the tree by picking a star, adding lanes to all nearby systems that aren't yet connected to the tree, then adding all the stars that just got lanes made to them to the end of the list of connected systems. I then get the next system off the list, and repeat until the list is empty. This means that the first system has all of it's neighbours free, so makes as many starlanes as it has neighbours. Latter systems have progressively fewer unconnected neighbours, so have fewer branches created during the tree-growth stage. This is mostly hidden by the second stage that adds other connections, but the first few systems still have the "starburst" appearance with lots of lanes radiating from them, as I never actually remove any lanes.
It would probably help if I didn't add as many starlanes per star as possible when going through the list... Instead I'd add just one, then go to the next star, and loop back to the start when the end of the list is reached. I'd only remove a star from the list when it has no unconnected potential starlanes left. I might also need to have a separate list of stars that were connected during this pass through the list, and only add them to the "main" list after I'm doing going through the main list that time. Thus I wouldn't end up with a star adding the next star adding the next, meaning I'd just have a single snaking line of starlanes around the galaxy...
Occurs to me that if the Levitt "bug" could be considered a feature. It seems like it might be strategically interesting to have a couple few star systems that are more connected than average...they'd naturally be valuable systems to hold, but more difficult to defend.
Agreed. Though we'd probly want to grow the tree simultaneously from several roots in that case...
Also, the above linked algorithm is still horrendously slow on large galaxies (like... more than a minute). I'm fiddling a bit in the hopes of fixing this, but I think the main problem is all the calls to ShortestPath, which is probably N^2 at least. The calls are themselves in a loop that's probably about N^2 itself, so things tend to slow down quite a bit for large N. If simplifying a few redundancies in the algorithm as above doesn't fix things, I may have to write my own graph traversal / path finder algorithm that gives up after the maximum distance between systems, rather than using ShortestPath, which processes the whole graph, mostly needlessly.
noelte wrote:Do you plan to take care of topologic constrains? I mean the different galaxy shapes.
You mean the lanes crossing the gaps between sections of the map? (like between arms of a spiral) ?
I'm not sure that that's really something that can be tackled at this point... I could limit starlane length, which would work for spirals, but with clusters, there needs to be a few long connections. The way to cut out the longer lanes will probly depend on what is decided for map stencil generation... If the current galaxy generation algorithms are used, then I'll need some sort of input from them that says where the arms are and where lanes shouldn't cross.... This could easily be done in the form of a series of lines I shouldn't have any starlanes cross. I'd just cull lanes that intersect with the barriers.