Quote
Originally posted by Raemon:
**click a buttom to get a random, fairly even distrubtion of star systems? Afterwards, you'd go in, giving them all governments and spobs and all that.
**
Mmmm, random and evenly distributed are two different beasts. I could cook up a spread sheet that would give you 2000 random systs, but they wouldn't be even close to evenly distributed; there'd be clumping and dead zone, etc.
Having said that, you could write a progam that would make random points. If a point was too close to another point, it wouldn't get placed. In this way, you would get a somewhat random distribution of points.
<psuedo code>
###make 1000 systems
for do until length(theSysts)==1000
###define max x and y
Max=1000
Min=1000
###+ or - x?
sign=rand(1)
if sign=1
x=0-rand(1000)
else
x=rand(1000)
endif
###+ or - y?
sign=rand(1)
if sign=1
y=0-rand(1000)
else
y=rand(1000)
endif
###find the closest point to the newly made point
for i in Systs
otherSyst=Syst(i)
otherX=otherSyst(1)
otherY=otherSyst(2)
otherDist=((x-otherX)^2+(y-otherY)^2)^0.5
if otherDist<presentDist
presentDist==otherDist
closest=otherSyst
endif
next
###now see if the new point is too close (closer than 20 pixels)
if presentDist>20 then
theSysts=theSysts+{X,Y}
endif
next
Automagically linking all the systems you make is annother problem. It, too, would be a n^n-1 problem, so it'd be sloooooowwwwwww (assuming you don't want random links and only want the first 3+/-2 closest)
You could even throw in some code to automatically make spobs and place them in systems.
Is it worth it? Debatable.
-STH