Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » population calculations
population calculations Sun, 19 April 2009 23:01 Go to next message
venom087 is currently offline venom087

 
Crewman 3rd Class

Messages: 4
Registered: March 2009
I'm working on a Stars! tool right now and my numbers are coming out slightly off for the population calculations. I know there's several tools like this already but I'm planning on having some cool features that the others don't have. Once it's ready for an alpha release I'll do a proper announcement Very Happy I'm wondering if anyone here can help me with some of the details of how Stars! math works.

I'm using the equation from the faq:
pop * growth rate * planet value
over 25% apply crowding factor: (16/9) * (1-cap%)^2

It's mostly working. About half my calculations are correct and the rest are only off by 100 or 200 people. So I'm wondering if anyone knows more intimate details about how Stars! rounds numbers. I know the app is 16 bit, so what does that mean in terms of how precise floating point variables are? For instance, that (16/9) fraction is 1.7777777777. Should I use 1.77? 1.78? Something more precise?

Also, how does the game round the actual populations? Does 690 people round to 700 or 600? Or even more tricky, does Stars! actually use 690 for the math but display the rounded number in the game interface and in reports.

And yet another question, what planet capacity numbers does the game use? I turned on newreports in my stars.ini and that only reports cap% to two significant digits (e.g. 25%). Should I use 4, or more?

Thanks in advance for the help!

Report message to a moderator

Re: population calculations Sun, 19 April 2009 23:29 Go to previous messageGo to next message
gible

 
Commander

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

I know that Stars! does most of its work with integer/fraction arithmetic rather than floating point and the values you see are rounded to the nearest 100. I don't remember the details, but there were some interesting effects when it cam to transferring pop to and from ships to do with only being able to select multiples of 100 for transfer, unless you chose to transfer all of them..

Report message to a moderator

Re: population calculations Sun, 19 April 2009 23:57 Go to previous messageGo to next message
magic9mushroom is currently offline magic9mushroom

 
Commander

Messages: 1361
Registered: May 2008
venom087 wrote on Mon, 20 April 2009 13:01

I'm working on a Stars! tool right now and my numbers are coming out slightly off for the population calculations. I know there's several tools like this already but I'm planning on having some cool features that the others don't have. Once it's ready for an alpha release I'll do a proper announcement Very Happy I'm wondering if anyone here can help me with some of the details of how Stars! math works.

I'm using the equation from the faq:
pop * growth rate * planet value
over 25% apply crowding factor: (16/9) * (1-cap%)^2

It's mostly working. About half my calculations are correct and the rest are only off by 100 or 200 people. So I'm wondering if anyone knows more intimate details about how Stars! rounds numbers. I know the app is 16 bit, so what does that mean in terms of how precise floating point variables are? For instance, that (16/9) fraction is 1.7777777777. Should I use 1.77? 1.78? Something more precise?

Also, how does the game round the actual populations? Does 690 people round to 700 or 600? Or even more tricky, does Stars! actually use 690 for the math but display the rounded number in the game interface and in reports.

And yet another question, what planet capacity numbers does the game use? I turned on newreports in my stars.ini and that only reports cap% to two significant digits (e.g. 25%). Should I use 4, or more?

Thanks in advance for the help!


Stars does keep actual numbers of people. That's how come offloads can vary by 100 turn to turn.

Report message to a moderator

Re: population calculations Mon, 20 April 2009 06:32 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...
Stars keeps 0-99 people hidden on the surface, I'm pretty sure they are included in the pop calculation and therefore you can be out by 200, ie say you have 19% growth and 599 people on the planet, you only see the 500 so you get growth of 95, so you are expecting 595 on the planet which would show has 500. If you run the pop calculation against the full 599 however you get 113 growth, added to the 599 that is 712 so stars would show 700 when a calculation with only the 500 you can see would expect it to still show only 500 at the end of it.

You can only get the missing people directly from the m file, they don't appear at all from the stars program although you can see the proper number of people expected on the planet next year.

With regards to rounding I haven't seen anything to suggest any rounding although I haven't checked a large number of calculations, I would expect the first calculation is rounded down before the second is run because it is almost certainly done as a single step with the 2nd being done afterwards if needed.

I'm actually thinking of writing something for pop management, mainly for use with IS Races to take into account any overflow to the planet, ie if you are trying to max pop with an OBRM IS race then you need the planet population at 275000 after the overflow, if you have enough pop in orbit to overflow say 50000, then you want to upload an extra 50000 into orbit, but those will grow as well so the orbit pop might might grow by 55000 so you now have to add an extra 5000 but those 5000 grow as well so you have to add yet another 500 and even when you do get a final figure, it is usually better to set the pop in orbit to grow a complete 100 by rounding down or up.

Report message to a moderator

Re: population calculations Wed, 22 April 2009 19:35 Go to previous messageGo to next message
venom087 is currently offline venom087

 
Crewman 3rd Class

Messages: 4
Registered: March 2009
Well, that sure is tricky. I think I'm just going to have to accept that my utility won't always be 100% accurate. I wasn't planning on digging into the .m files. Thanks for the info.

[Updated on: Wed, 22 April 2009 19:35]

Report message to a moderator

Re: population calculations Sun, 03 May 2009 13:29 Go to previous message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
PaulCr wrote on Mon, 20 April 2009 06:32

Stars keeps 0-99 people hidden on the surface, I'm pretty sure they are included in the pop calculation and therefore you can be out by 200, ie say you have 19% growth and 599 people on the planet, you only see the 500 so you get growth of 95, so you are expecting 595 on the planet which would show has 500. If you run the pop calculation against the full 599 however you get 113 growth, added to the 599 that is 712 so stars would show 700 when a calculation with only the 500 you can see would expect it to still show only 500 at the end of it.


Have you tested this or seen it in a game? I was under the impression that it kept the 0-99 but didn't include them in calculations, and instead added them to the total after the calculation. So I would expect 599 to show as 500, and then grow by 95 to 695 (showing as 600). Next year it would grow by 114 to 809.



- LEit

Report message to a moderator

Previous Topic: Yet another MT question.
Next Topic: initiative
Goto Forum:
  


Current Time: Sat May 04 08:36:25 EDT 2024