How are systems generated in Known Stars games? The wiki says "The game works through all the stars in order of increasing distance. There is a 20% chance of selecting the nearest star, then if that isn't selected, 20% chance of second nearest star, etc." I think this is from the old VB version, but I haven't seen any posts about changes to this. I ran some tests in a fresh game generating systems from Sol and they seemed to confirm the 20% number. However, in my games I've also seen systems with really distant neighbors, like HIP 31293 in the screenshot. Its neighbors have distances in real space of 54.1, 63.1, and 70 light-years, and as far as I can tell there are hundreds of closer systems that haven't been picked yet. So it seems very unlikely to me that this was generated purely by iterating through the closest systems.
Sometimes you link to an existing system, but not one you know about. In that case, its a lot easier to end up with a system a long way away, because the number of systems in the sequence is much smaller. Or you are already in someone else's known system and they made the connection from their end. Or you just got the long-shot that sometimes happens.
I'm willing to bet that the code somehow negates one set of coordinates when computing distances to pick new systems, so that the formula looks like
(x2 + x1)^2 + (y2 + y1)^2 + (z2 + z1)^2
rather than
(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2.
Either the code is missing a minus sign, or it has an extra one somewhere.
I made a new game with no NPRs (attached if you want to play around with it) and generated a bunch of systems, then plotted their positions in 3d space and jump connections. The full plot is here (
https://www.desmos.com/3d/6q3qs5wogh); in the screenshot I just plotted a single chain so it's easier to see. Look at how they zigzag back and forth -- this isn't at all what you'd expect if the distances were calculated correctly, but it's what you'd see if the coordinates get reflected! This leads to a pattern I see all the time in my games, where systems are much closer to systems
two jumps away than to neighboring systems. (Sol usually connects to nearby systems because it's at the origin, so reflecting everything doesn't change distances to it!)
For some reason the distance measurements everywhere else seem normal, but this seems like the best explanation for these patterns. It's not even necessarily
bad, maybe you generate more interesting galaxies this way than with correct distance measurements, but it would still be good to understand how it works. And if I'm wrong and there's some other explanation for the zigzagging, let me know!