Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Problem with randomness in planet distrtibution
Problem with randomness in planet distrtibution Fri, 17 August 2007 08:30 Go to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
I have picked up Stars! again recently, and so far have played 1-1 with a frend. A good deal of my playing has however been race testing (myself and one AI civ). I have noticed that there's A LOT of randomness in the distribution of planet quality (hab) as well as mineral content. So much that it makes my race testing difficult. For example, I recently played two identical setups (medium, normal, distant) with the same race and one AI civ, and got 18k at 2450 the first time (with a good draw of planets and minerals) and 12k the next time (with mediocre planets and minerals). My playing style was pretty much the same (I have it written down so that I can remember it when I go live with this race).

Can other people confirm this observation, and how do you deal with it?

It is also a problem in 1-1 games, as planet and mineral distribution sometimes can decide the outcome to a larger degree than player skill. Our response to this so far has been to increase the universe size from small to medium. Any other ideas?

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 11:12 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

When universes are created, they are created randomly. Planet draw is basically luck. However, for testing, you can create Stars from a command line start and use a seed number that will give you the exact same universe every time you gen the universe.

This is good for testing. I have played this game for many years and I've seen all sorts of distributions.

One thing to note is that mineral distributions and habitability distributions are separate items - there is no correlation between the two.

Habitability of planets is based on a curve for each range and there is a planet generator that uses the algorithm to generate tens of thousands of planets and shows you how many of those tens of thousands you can live on - and, how many will be very good down to barely habitable (not counting terraforming). Overall however, the race wizard telling you 1 in 5 habitability is a very good indicator of what you will see over the entire universe.

When creating anything other than a tri-immune HE race, always use one field substantially narrower than the other two. This will give you excellent return for terraforming investment when terraforming is done in that field. Many players go for a 1 immune race with two narrow fields. Terraforming happens in the narrow fields and you colonize -1 to -5% worlds. Using a standard population to resource value of one resource to 1000 population, you can drop down 50,000 colonists, and do 1% of terraforming over the next 2 turns. Since that terraforming happens in the -1% red field, the planet turns immediately at least 30+% green. If one of the other 2 narrow fields is in nicely in the habitability range, that 1% of terraforing can turn the planet from -1% to 50+% easily.

Mineral distributions is more random. However, if your Home planet has concentration 47 in all three minerals, so does EVERY home planet in the universe with the exception of a race that left points over in the race wizard and asigned them to mineral concentrations (generally not a good idea to do anyway). This means that all players are in the same boat at the start when it comes to mineral distributions of homeworlds.

Welcome back to Stars! You will find that this game has innumerable possibilities. When you think you now have a race that is guaranteed to kill everyone, all of a sudden, it dies a quick death. Wink

Ptolemy


[Updated on: Fri, 17 August 2007 11:14]





Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 12:04 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
You can make stars generate with the same universe each time, start stars passing it a game definition file you want to use with the same value for the random seed ie stars.exe -a Testbed1.def
If your going to do that though it would be best to a a number a few .def files with differing seeds so that you can also try your race in universes with worse or better conditions to see how it fairs.

The following is taken from the help file for how the .def is formatted, an example is given at the end.

Game Name
Universe Size (0-4) Density (0-3) Starting Distance (0-3) [Random Seed, any #]
Maximum Minerals (0/1) Slow Tech (0/1) BBS Play (0/1) .... (other check boxes)
Number of Players (1-16)
Pathnames to race files, or AI descriptions
VC # of planets (0/1) Percent of planets (20-100)
VC Tech (0/1) Level (8-26) Fields (2-6)
VC Score (0/1) Score (1000-20000)
VC Exceeds nearest (0/1) (Percent (20-300)
VC Production (0/1) Capacity (10-500)
VC Capital Ships (0/1) Number (10-300)
VC Turns (0/1) Years (30-900)
VC Must Meet (0-7) Minimum Years (30-500)
New universe file name

AI Descriptions
The AI description takes the form, "# N M", where N is the ID number of the AI and M is the skill level of the AI.
Race Ids: 0=Random, 1=Robotoids, 2=Turndrones, 3=Automitrons, 4=Rototills, 5=Cybertrons, 6=Mcinti
Skill levels: 0=Random, 1=Easy, 2=Standard, 3=Tough, 4=Expert

The following is an example .def file that will set up a single player against a standard robotoid ai in a small, packed, distant, acc BBS universe with no victory conditions.

Testbed 1
1 3 3 10000
0 0 1 0 0 0 0
2
c:\stars\MyRace.r1
# 1 2
0
0
0
0
0
0
0
0
c:\stars\Testbed1\TestBed1.xy

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 13:34 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
Thx a lot. I found the help file info, but it didn't have the AI player info. That's good to know.

I can't find a random seed anywhere, though. Neither in the example above nor in the help file. Please explain Confused

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 13:58 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
The random seed is any number you want to use, in the example I gave at the end it is the 40000 on the end of the second line. If you use the same game setup it will generate the same universe each time. That would allow you to test modifications to you race or strategy under the same conditions.
There is nothing special about the seed, ie any particular value doesn't mean anything so you can't predict beforehand what the universe will be like, just try a few different numbers and keep .def files for the ones you want to use.
It would be a good idea to have a number of .def files to allow you to test your race under different conditions, use one to get a race you are happy with and then try it under the rest to see how it performs. If your not happy with it then make changes to the race design and test it again under one of the universes until your happy with it again and then try it under the rest.
You don't have to keep using the same universe to try changes, ie if you get a good race under Testbed 1 but it fails badly under Testbed 3 then test the changes under Testbed 3 until you are happy with it and then see how it performs in the rest.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 14:11 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

And,do your main tests in a small, normal universe with 2 standard AI's. This forces you to have to build a few more ships than you would have to if you are testing alone in a universe. Use teh simplest AI's - the CA (Rototills) and/ or the Turindromes (SS) or the Macinti (AR). Go for 25k by 2450 - if you get to 24k with some warships, tech 10-12 in weapons, tech 9 in construction and at least tech 6 in energy (tech 7 for an SS race) - you're doing OK. You will also need to have bio 4 for minleayers and will have built minelayer to lay mines in the most strategic areas. At tech 6 in construction, you build minelaying frigates - ships with the best engine you have and 3 minelaying pods - leave the rest of the slots empty.

Ptolemy




Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 14:33 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
Thanks again. I am quite familiar with the game, though I have to admit that I've not been anywhere near 25k at 2450 for quite a while. Perhaps I just can't be bothered to manage all the minute details. I played it quite a lot ca. 10 years ago.

My next game will be set in a Medium, Normal, Distant universe and it will be with just one (human) opponent. I elected to test my race under those conditions to get a feel for that setting. I will add one more AI in the next test, however. I do not want to use AR, as I find they give me an advantage (it's too easy to kill their colonies). Same for HE.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 17 August 2007 15:34 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

It's not so important what AI's you choose other than choosing the PP AI that throws packets randomly and hits yoru colonies killing population. The testing you are doing is to check the speed of your growth. The only real management you are doing is moving population and excess minerals to where they are needed. This is the basic economic growth you need to do in any game.

What you do by throwing in a couple of AI's is force yourself into a little bit more 'real game' situation where you need to spend some resources for basic defense or offense. It is easy to control an entire small galaxy when ou are the only species.

It is not a case of winning the testbed, it is seeing how well your race design performs under the worst posible planet draw. If you can hit 24-25k resources given a poor planet draw in a small / normal universe with at least one AI making you build defenses and defensive ships, you have a very real game contender for a game.

The only thing I caution you on is how far you have to go from your HW to build your empire. Most games will have over 6 players - better games will have at least 8. Your basic race design can't use the entire galaxy to get to the 24-25k mark. You can hit that mark using a 1 in 3 to 1 in 4 habitability strategy. In my experience, using a 1 in 5 hab strategy will not win a game with the exception of a huge, packed universe.

If you would like, I will run a learning game with you and your one freind. I will host it manually via e-mail and we can see what happens. After around turn 25, we can open all game files to each other and see what has happened and why.

Ptolemy




[Updated on: Fri, 17 August 2007 15:39]





Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Sat, 18 August 2007 01:54 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
This thread is drifting, but then - the original topic is pretty much closed.

That's a very generous offer, Ptolemy. I don't consider myself a novice in this game, and my friend isn't a novice either. I'm not adverse to learning, however, so I'll ask him to check up on this thread.

To show you roughly where I'm at. I'll send you a description of the race I'm preparing for the next game with my friend and how I want to use it. I don't want to post it here as my friend has access to these forums.

And on the AI: I tried a HE AI opponent and found that I gained too much tech from dropping pop on their colonies. I'm pretty sure I get the same effect from shooting up AR colonies. So, I've mainly been using the SS AI - though I'll expand that choice a bit in the future.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Sat, 18 August 2007 14:04 Go to previous messageGo to next message
iztok is currently offline iztok

 
Commander

Messages: 1206
Registered: April 2003
Location: Slovenia, Europe
Hi!
RobO wrote on Fri, 17 August 2007 20:33

My next game will be set in a Medium, Normal, Distant universe and it will be with just one (human) opponent.

If your race has not an extremely low hab (1-in-20 or worse) I strongly suggest you use significantly smaller universe, or else your game will deteriorate in just a huge micromanagement exercise. For a learning experience choose 30-50 planets per player: closer to 30 if you want early fights, closer to 50 for more room and more development.

Quote:

I don't consider myself a novice in this game

I'm affraid you are. Managing to get only 18k resources at 2450 in a medium-normal uni with a good planet draw puts you there. 25k at 2450 is nowadays no more considered a monsterhood, but a norm to survive in an intermediate game. You better take the generous Ptolemy's help if you plan to join any game here on AH.

BR, Iztok

Report message to a moderator

Re: Problem with randomness in planet distrtibution Sat, 18 August 2007 14:14 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
iztok wrote on Sat, 18 August 2007 20:04

Hi!
RobO wrote on Fri, 17 August 2007 20:33

My next game will be set in a Medium, Normal, Distant universe and it will be with just one (human) opponent.

If your race has not an extremely low hab (1-in-20 or worse) I strongly suggest you use significantly smaller universe, or else your game will deteriorate in just a huge micromanagement exercise. For a learning experience choose 30-50 planets per player: closer to 30 if you want early fights, closer to 50 for more room and more development.

Hmm. We increased the planet size to reduce the effect of random planet quality on the outcome of the game. After all, the best economy wins in a 2-player game if the difference is large enough. And also to have the game last a bit longer.

The tempting conclusion is that the game isn't viable with just two human players (who are reasonably well balanced) because the randomness of the universe will effectively decide the game - the most lucky player wins. Is that so?
Quote:

Quote:

I don't consider myself a novice in this game

I'm affraid you are. Managing to get only 18k resources at 2450 in a medium-normal uni with a good planet draw puts you there. 25k at 2450 is nowadays no more considered a monsterhood, but a norm to survive in an intermediate game. You better take the generous Ptolemy's help if you plan to join any game here on AH.

BR, Iztok

That's straight talk - I like that. I guess you're right. My point is that I know a good deal about the way the game works and how to use those mechanisms to my advantage. I'm not fumbling in the dark.

But then, I don't plan to play in open games here on AH for quite a while. I'm content to play with my friend for now - if we can get it to work properly. That doesn't mean I don't want to learn, however.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Sat, 18 August 2007 15:18 Go to previous messageGo to next message
iztok is currently offline iztok

 
Commander

Messages: 1206
Registered: April 2003
Location: Slovenia, Europe
Hi!
RobO wrote on Sat, 18 August 2007 20:14

the randomness of the universe will effectively decide the game - the most lucky player wins. Is that so?

Even when both players are matched it is IMO not. I'd say the non-extreme good or bad luck accounts for 10%-20% of difference in econ. But there's another, significantly bigger factor: the race of each player, and the general strategy that race is based on.
Besides, most of us here don't play only to win. Most of us play to have fun. Going down in flames can also be very exciting. Wink

Quote:

I don't plan to play in open games here on AH for quite a while. I'm content to play with my friend for now - if we can get it to work properly. That doesn't mean I don't want to learn, however.

IMO the best learning experience would be to join a game here on AH, simply because in such a game you'd be exposed to many tricks and moves you and your friend would have a hard time to invent by yourself. So wen you finish your game with the friend, join an intermediate or a mixed skill level game here, and you'll verly likely be surprised on what can be done with this old marvel of the game. Thumbs Up

BR, Iztok

Report message to a moderator

Re: Problem with randomness in planet distrtibution Sun, 19 August 2007 20:37 Go to previous messageGo to next message
Dogthinkers is currently offline Dogthinkers

 
Commander

Messages: 1316
Registered: August 2003
Location: Hiding from Meklar
You can alleviate the 'problem' of the randomness a little by playing races that having quite 'strong' hab settings.

Lets say that in some particular game, you might expect to be able to grab a territory of 40 planets (quite a lot, I think...)

If I had a 1/20 race, there would be a 12.9% chance I'd have found NO greens. None at all. I'd have a 27.1% chance of finding just one. So, you can see here already, that there is a 40% chance I'll have found half or worse than my expected total. I'd have a 27.8% chance of finding two (the amount I had planned for.) On the bright side, there is a 13.8% chance I'll find 4 or more (double my expected find.)

If I had a 1/3 race, my chance of finding 10 or more greens (equivalent to 1/4) is better than 90%. My chance of finding 8 or more (equivalent to 1/5) is 97.9%. There is a miniscule 0.35% chance that I'll find less than half of the ~13 worlds I expected (and a vanishingly small chance I'd have found double.)

See my point? Statistically, the wider my hab, the more likely I am to get a planet distribution in practice that roughly reflects the one I expected... Narrow hab races are fickle, sometimes crippled by the universe, sometimes performing wonders. Wide hab races are a lot more consistent to play.

Also, to correct an earlier comment, there is one tiny correlation between hab and minerals. Rad over 90 correlates to slightly higher mineral concentrations (about 6% better on average, if I remember correctly.) Below rad 90 there is no correlation at all between hab and concentrations. Other fields have no correlation to mineral concentrations at all, at any value. It's just rad, and only when it's over 90.


[Updated on: Sun, 19 August 2007 20:43]

Report message to a moderator

Re: Problem with randomness in planet distrtibution Mon, 20 August 2007 01:00 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
Yes, Inderstand the effect of hab on randomness. Unfortunately, the race design I'm pursuing right now has a hard time getting better than 1/5 hab due to some of my design choices. My current test is with 1/6.

Just to get it straight: The benchmark of 25k at 2450 is in a small, normal universe with as many AI as you care to be bothered with (or none). But is it with or without AccBBS?

I noticed that this tutorial uses AccBBS

Report message to a moderator

Re: Problem with randomness in planet distrtibution Mon, 20 August 2007 02:57 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

25k by 2450 is with accbbs normally.

tho if the game you're testing for is going to be non-accbbs, then you should test without it of course. Wink

Report message to a moderator

Re: Problem with randomness in planet distrtibution Mon, 20 August 2007 06:08 Go to previous messageGo to next message
RobO is currently offline RobO

 
Crewman 2nd Class

Messages: 17
Registered: February 2007
Location: Denmark
gible wrote on Mon, 20 August 2007 08:57

25k by 2450 is with accbbs normally.

tho if the game you're testing for is going to be non-accbbs, then you should test without it of course. Wink

I was going for the benchmark. I'm pretty confident I can do 25k with AccBBS - I haven't tried it yet. Will do so.

I just want to check if that Novice stamp is appropriate Cool

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 05:56 Go to previous messageGo to next message
Soobie

 
Officer Cadet 3rd Year

Messages: 270
Registered: May 2007
Location: Australia
OK, because I am a mathematical moron, I can not work out this simple problem.

As I understand it, Small Universe dimensions are 800 ly by 800 ly.

Forgetting density of the universe for a moment, in a 'perfect' distant-player distribution:
If there are 7 players, what would be the expected (average) distance between each player? (I'd take a stab at about 300 ly, but couldn't tell you why I'd say that).

How would you scale this? Say, the typical distance between 15 players in a Large Universe (1,600 x 1,600??)

Cheers
S Smile

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 06:36 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
An 800x800 area would give an area of 640,000. For 7 players, ideally you would want to give them each and area of about 90,000 which would work out with each of them having a square with sides of about 300ly on each side. Since you would put everyone in the centre that would make the average distance between them 300ly.

However it's unlikely you could fit everyone into 300ly squares of there own so the territory of each person would have to be shaped to fit. you could put 4 people on the top giving them a width of 200ly meaning the depth would be around 450ly leaving the other 3 with a width of 266ly and depth of the remaining 350ly.

If you did follow that pattern though it would be a bit predicable where everybody starts, so instead I would probably work out what the ideal distance between each player would be as in the first paragraph, ie 300ly, and then place each HW randomly but then check if each person nearest neighbour is within a certain %, ie 25%, which would mean the nearest neighbour would have to be within 225-375 lys. If somebody wasn't I'd then try regenerating the starting positions.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 08:05 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Which is almost exactly how my "HW placement" algorithm works. I said it was brute-forcish... Rolling Eyes

I find that if I set up things to give each player the max possible space the placement gets neatly regular, and hence predictable. Whip

Interestingly enough, if I relax the "max space" condition, by reducing the distance between HWs by, say, 10 or 20%, placement starts looking more and more "natural" or at least more Stars!-like. Twisted Evil

I'd pretty much like to be able to speed the beast up, tho. Placing, say, 30 HWs among 2000 possible planets can take minutes on a 2GHz machine. Shocked



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 11:58 Go to previous messageGo to next message
yartrebo is currently offline yartrebo

 
Petty Officer 3rd Class

Messages: 43
Registered: July 2006
Location: North America
I have an idea for a fast HW placement algorithm:

A - Place the homeworlds before placing any planets.
B - Place the homeworlds in a random order (don't just start with player 1 and work down the list).

1 - Place a homeworld at a random place on the map.
2 - Check to see if it is less than min_distance from any other homeworld.
3 - If the homeworld passes the test, keep it. Otherwise try another spot.
4 - Go to step 1 until all HWs have been placed.

Once all homeworlds are placed, place the remaining planets according to your universe generation algorithm.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 14:52 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
yartrebo wrote on Fri, 12 October 2007 17:58

I have an idea for a fast HW placement algorithm:

A - Place the homeworlds before placing any planets.
B - Place the homeworlds in a random order (don't just start with player 1 and work down the list).


Hm, the trouble with that is that some races need a secondary world, too, and that secondary has a relationship with the primary. Sherlock Whip

At any rate, since each HW, including the 1st, is randomly placed, I don't see what's wrong with following player order. Confused


Quote:

1 - Place a homeworld at a random place on the map.
2 - Check to see if it is less than min_distance from any other homeworld.
3 - If the homeworld passes the test, keep it. Otherwise try another spot.
4 - Go to step 1 until all HWs have been placed.

Once all homeworlds are placed, place the remaining planets according to your universe generation algorithm.


Well, step1 would require calling the random generator, whereas just picking from the planet list should be faster. Rolling Eyes

Worse, from what I can see, step1 would require its own separate check for compliance with the galaxy shape (classical, spiral, sphere, ring) so that would complicate things.

From the tests I've done, the trouble with the brute-force approach is the sheer number of distance comparisons that need to be done to discard the 99.9% of candidates that get randomly picked. Not even tagging seems to significantly improve speed. Wall Bash

And the trouble with any other way that I can think of is that, if you want to use it on other than the classical rectangular shape, they get too complex to be possibly worth it. Sad



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 16:22 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
m.a@stars wrote on Fri, 12 October 2007 13:05


I'd pretty much like to be able to speed the beast up, tho. Placing, say, 30 HWs among 2000 possible planets can take minutes on a 2GHz machine. Shocked


Place the HWs first and then add the remaining 1970 planets afterwards, for HW placement you could try placing one HW, then generating the next randomly and checking it is at least x away from the previous ones and so on until you have them all. You would need a counter to stop it going on forever should it be impossible though for an HW to be placed.

I've done some VBScript code that runs in an IE web page that can calculate locations quickly, I've not looked at the locations visually to see how the look but it does seem to generate valid HW locations quickly. Basically it outputs a table showing each player on a line with their x,y coordinate followed by the distance between it's hw and all the preceding players HWs.

<span id=msg name=msg>&nbsp;</span>
<script language="VBScript">
randomize
MaxFailures=500
  x=2000
  y=2000
  Players=30
  DistanceMultiplier=0.8
  AvgDistance=sqr(x*y/Players)
  dim HWs()
  redim hws(Players-1,1)
  MinDistance=AvgDistance*DistanceMultiplier
  xPos=int(rnd * x)
  Ypos=int(rnd * y)
  Hws(0,0)=xpos
  Hws(0,1)=ypos
  Failures=0
  a=1
  while a<Players and Failures<MaxFailures
    flag=true
    xPos=int(rnd * x)
    Ypos=int(rnd * y)
    for b=0 to a-1
      Distance=sqr(abs(xpos-hws(b,0))*abs(xpos-hws(b,0))+abs(ypos- hws(b,1))*abs(ypos-hws(b,1)))
      if distance<MinDistance then 
        flag=false
      end if
    next
    if flag then
      hws(a,0)=xpos
      hws(a,1)=ypos
      a=a+1
    else
      Failures=Failures+1
    end if
  wend
  if Failures=MaxFailure then
    msg.innerHTML="Too many none matches"
  else
    txt="Minimum Distance=" & MinDistance & ", number of failures were " & Failures & "<br>"
    txt=txt & "<table><tr><td></td><td> <b>Location</b></td>"
for a=1 to players
  txt=txt & "<td>P" & a & "</td>"
next
    txt=txt & "</tr>"
    for a=0 to Players-1
      txt=txt & "<tr>"
      txt=txt & "<td>P" & (a+1) & "</td>"
      txt=txt & "<td>" & hws(a,0) & "," & hws (a,1) & "</td>"
      for b=0 to a-1
        txt=txt & "<td>" & int(sqr(abs(hws(a,0)-hws(b,0))*abs(hws(a,0)-hws(b,0))+abs(hw s(a,1)-hws(b,1))*abs(hws(a,1)-hws(b,1)))) & "</td>"
      next
      txt=txt & "<tr>"
    next
    txt=txt & "</table>"
    msg.innerHTML=txt
  end if
</script>

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 16:25 Go to previous messageGo to next message
yartrebo is currently offline yartrebo

 
Petty Officer 3rd Class

Messages: 43
Registered: July 2006
Location: North America
Quote:

At any rate, since each HW, including the 1st, is randomly placed, I don't see what's wrong with following player order.


It is important because players placed earlier are more likely to be in the center then player picked later, if my intuition about the statistics involved is correct.

Corner and side spots are less likely then center spots to be near another player. The first player has the same chance per square ly to be placed somewhere, but after that, the center is more likely to be off limits then the edges.

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 18:13 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Fri, 12 October 2007 22:22

Place the HWs first and then add the remaining 1970 planets afterwards, for HW placement you could try placing one HW, then generating the next randomly and checking it is at least x away from the previous ones and so on until you have them all.


Hmm, I still fail to see where's the speedup in that. Confused


Quote:

You would need a counter to stop it going on forever should it be impossible though for an HW to be placed.


What I do is reduce the "DistanceMultiplier" when "MaxFailures" is reached before starting over. Also, your code seems to have no way to backtrack once it's reached a dead end. Whip

Building the HW list until there's enough HWs or there's no more candidates takes very little time (certainly less than a second) but backtracking and/or starting over eats up significant time if you need to do it a thousand times. Sad



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Problem with randomness in planet distrtibution Fri, 12 October 2007 18:33 Go to previous messageGo to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
yartrebo wrote on Fri, 12 October 2007 22:25

It is important because players placed earlier are more likely to be in the center then player picked later, if my intuition about the statistics involved is correct.


I've never spotted anything like that in my tests. Sherlock Perhaps that bias is small enough to escape easy notice.


Quote:

Corner and side spots are less likely then center spots to be near another player. The first player has the same chance per square ly to be placed somewhere, but after that, the center is more likely to be off limits then the edges.


Indeed. I've observed that. The center is often scarce in HWs due to distance restrictions, even if neighbouring HWs are significantly farther than the minimum. Deal But it still doesn't seem to make "1st served is more centered" placements more abundant than truly random ones. Confused

I guess I'll need more tests into the matter. Should it be significant, I guess placement of secondaries could be left to a 2nd pass once the main placement is done (and the HW list shuffled). Rolling Eyes



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: Sapping Cruisers
Next Topic: Installations destroyed by bombing
Goto Forum:
  


Current Time: Sun Apr 28 01:24:38 EDT 2024