Average Resource Consumption

Ideas for improving Starport:GE

Moderators: Moleman, Kwijibo, Luna

User avatar
Turkey
Posts: 507
Joined: Tue Nov 22, 2005 2:28 pm
Location: Rib'zki

Average Resource Consumption

Post by Turkey » Wed May 07, 2008 6:18 am

I personally thought this was the obvious way to go about things. Got a nasty surprise when things started adding and subtracting all over the place.


The Problem
When a the quantity of a consumable resource (anaeroebes, medicine, organics or oil) in the refinery becomes too small to deliver a bonus, the consumption on that consumable is halted, and the bonus is cancelled. It remains this way until there are enough resources to deliver the bonus, and then resumes full consumtion on that resource.
This causes a couple of minor issues.

Firstly, the quantity of any consumable doesn't often hit zero, nor will it show any kind of consistency. It will climb a little then fall again, in accordance with the fluctuating demands of the colony.

Secondly, the morale and population rates as listed in both the biodome and the radio receiver screens will fluctuate just as randomly. Both values will indicate either a massive increase or a massive decrease, and cannot be relied on to indicate what the colony is actually doing.


The Solution
The obvious answer is to give a consistent average of bonuses instead of all of the bonus sometimes and none of it others. However there are several intricacies which need to be examined first.


The first relates to the quantity of resource in the refinery. If the harvest rates for a resource exceed the consumtion rate for it, there will always be a full bonus. Or if there is any non-zero quantity in the refiney, there will always be a full bonus. If there is exactly zero in the refinery and consumption rate exceeds harvest rate, the quantity will remain at zero and the fraction of harvest/consumption will be used to determine bonuses instead.


The second relates to the size of the bonus. Under the current system, having a supply of two resources will yield three times as big a bonus as having only one such resource. Thus the bonuses cannot simply be added together, as that would result in a change in the mechanic, which is not the purpose here.

An effective averaging formula is propsed:

time_fraction_with_both = (harvest_rate_1 / consumption_rate) * (harvest_rate_2 / consumption_rate)

time_fraction_with_neither = (1 - harvest_rate_1 / consumption_rate) * (1 - harvest_rate_2 / consumption_rate)

time_fraction_with_only_one = 1 - time_fraction_with_both - time_fraction_with_neither

total_bonus = const_bonus_for_one * time_fraction_with_only_one + const_bonus_for_both * time_fraction_with_both


The Result
-Change rates listed in the biodome and radio reciver screens will be a meaningful indication of what the colony is doing.
-The colony population and morale will not have such rapid rises and falls all over the place, instead will smoothly change to the appropriate level.

This simulation is of an oceanic planet with 5% tax, 45% harvest, owner charsima 5, no disasters, no researches, fully built. The population begins at 11,000 and morale begins at 1400. There are no resources in the refinery at time = 0. The planet is simulated over a 250 hour time interval.
Image

The same planet as above, only this shows the growth rate as given in the biodome window. The time scale has been reduced to 20 hrs through to 25 hrs for clarity.
Image

User avatar
NeatLogs
Posts: 115
Joined: Sun Sep 23, 2007 11:58 am

Post by NeatLogs » Wed May 07, 2008 11:35 am

This makes good sense. The fluctuations in pop growth really got to me; which is one of the reasons I don't do colonies any more.

/signed for making things simpler. Hard to think of any reason against this change. Heck, it also has the advantage of being realistic.

Also, great work on the graphs.

duece
Posts: 2117
Joined: Fri Jul 14, 2006 11:39 am

Post by duece » Wed May 07, 2008 9:20 pm

Great Idea.

MuTAnT
Posts: 1349
Joined: Thu Jan 13, 2005 11:19 pm

Post by MuTAnT » Wed May 07, 2008 9:40 pm

I totally agree.

User avatar
milo
Posts: 844
Joined: Tue Dec 12, 2006 4:58 am
Location: wouldn't you like to know
Contact:

Post by milo » Wed May 07, 2008 9:44 pm

i've never noticed this "random" fluxuation. to be perfectly honest you completely lost me.

what i've found is:

anaerobes and organics effect on reproduction goes as follows:

both yellow or white ==> +pop/39.2
one yellow or white (the other red) ==> +pop/117.65
neither yellow or white ==> +0

medicine and oil effect on morale goes as follows:

both yellow or white ==> +5.76
one yellow or white (the other red) ==> +1.92
neither yellow or white ==> +0

this method has been tested with different populations on different planet types and on multiple servers. (classic is different)

--------------------------------------------------------------------------------

this is how i understand reproduction is calculated

R = reproduction rate in colonists per hour
PT = base reproduction rate of the planet type
AO = anaerobe and organic bonus
MGR = morale growth rate bonus (calculated before reproduction)
CR = current morale
GT = government type bonus
WP = weather prediction bonus

R = PT + MGR + CR + GT + WP

PT =
arctic +(pop/-45.46) col/hr
desert +(pop/-40) col/hr
earthlike +(pop/-52.67) col/hr
greenhouse +(pop/-38.46) col/hr
mountainous +(pop/-43.48) col/hr
oceanic +(pop/-47.60) col/hr
rocky +(pop/-41.67) col/hr
volcanic
paradise +(pop/-55.56) col/hr

AO =
both yellow or white +(pop/39.2) col/hr
one yellow or white (the other red) +(pop/117.65) col/hr
neither yellow or white +0 col/hr

MGR = +((pop/400)*morale growth rate) col/hr

CR = +((pop/5000)*((curent morale value)/100)) col/hr

GT =
socialism +(pop/200) col/hr
democracy +0 col/hr
democracy(d3) +0 col/hr
directorship +0 col/hr
prison +0 col/hr

WP = +(lvl*(pop/500)) col/hr

----------------------------------------------------------------------

this is how i understand morale is calculated

MGR = morale growth rate
CR = crowdedness modifier
TR = tax rate modifier
GT = government type bonus
MO = medicine and oil bonus
BB = building bonuses
CD = channel descrambling bonus
OC = owner charisma bonus
EI = entertainment industry bonus
PD = pollution disaster modifier

MGR = CR + TR + GT + MO + BB + CD + OC + IE + PD

CR = -(pop/1111.11) units/hr

TR =
0 +(4.8) units/hr
1-20 +(4.2-((tax percent)*0.6) units/hr

GT =
socialism +0 units/hr
democracy +0.9 units/hr
democracy(d3) +1.8 units/hr
directorship -0.48 units/hr
prision -2.4 units/hr

MO =
both yellow or white +5.76 units/hr
one yellow or white (the other red) +1.92 units/hr
neither yellow or white +0 units/hr

BB =
artesian well +1.5 units/hr
radio tower +1.2 units/hr
broadcast reciever +2.1 units/hr (replaces radio tower bonus)

CD = +(lvl*0.36) units/hr

OC = +((average charisma)/8) units/hr

EI = +(pop/5555.56) units/hr

PD = -(0.24*(number of disasters)) units/hr

User avatar
Turkey
Posts: 507
Joined: Tue Nov 22, 2005 2:28 pm
Location: Rib'zki

Post by Turkey » Thu May 08, 2008 1:34 am

That's exactly it.

The problem is the way that the game calculates partial consumption bonuses (or rather, doesn't calculate them). Once a consumable hits red, it will stop being consumed and climb back into yellow. Then start being consumed again. This happens every five minutes. So your colony will say growing 120 people/hour, then five minutes later the org and ane will be gone and it'll say shrinking 170 people/hour. Neither will indicate what the colony is actually doing.

Been that way since, what, January? Somewhere around there.

User avatar
milo
Posts: 844
Joined: Tue Dec 12, 2006 4:58 am
Location: wouldn't you like to know
Contact:

Post by milo » Thu May 08, 2008 2:47 am

The problem is the way that the game calculates partial consumption bonuses (or rather, doesn't calculate them). Once a consumable hits red, it will stop being consumed and climb back into yellow. Then start being consumed again. This happens every five minutes. So your colony will say growing 120 people/hour, then five minutes later the org and ane will be gone and it'll say shrinking 170 people/hour. Neither will indicate what the colony is actually doing.
ok now that i understand. and yea i noticed this around January too. it is a big problem because colonies don't actually preform how they theoretically should.

simple solution.
make the bonus go negative instead of halting at 0. this will either balance an unstable col or kill it if the settings arn't changed. however this would make colonies harder to maintain since they are technically benifiting from this problem.

p.s. Turkey please mail me if you have something different for any of those calculations.

User avatar
Toonces
Site Admin
Posts: 1627
Joined: Mon Oct 04, 2004 10:23 am
Location: Beta Canum Venaticorum
Contact:

Post by Toonces » Tue May 13, 2008 4:23 pm

good idea

User avatar
Turkey
Posts: 507
Joined: Tue Nov 22, 2005 2:28 pm
Location: Rib'zki

Post by Turkey » Wed May 14, 2008 8:00 am

Hey, thanks for the reply Toonces. Thought I'd made those pretty graphs for nothing :D

User avatar
Stklr
Posts: 793
Joined: Thu May 17, 2007 12:33 am

Post by Stklr » Wed May 14, 2008 2:06 pm

oooo a graph.

MuTAnT
Posts: 1349
Joined: Thu Jan 13, 2005 11:19 pm

Post by MuTAnT » Wed May 14, 2008 2:42 pm

This thread needs pie charts!

User avatar
Mondaydark
Posts: 227
Joined: Wed Apr 11, 2007 3:52 pm
Location: \m/ (>_<) \m/ <^> (o_o) <^>
Contact:

Post by Mondaydark » Wed May 14, 2008 2:50 pm

OMG Turkey where you playin now?

Major.Arse

Post by Major.Arse » Wed May 14, 2008 4:10 pm

this thread makes me hungry.

(nice idea btw)

User avatar
milo
Posts: 844
Joined: Tue Dec 12, 2006 4:58 am
Location: wouldn't you like to know
Contact:

Post by milo » Wed May 14, 2008 7:47 pm

oh yea ... and i never said i liked this idea but i do.

User avatar
BLADE2
Posts: 547
Joined: Sat Jul 15, 2006 2:04 am
Location: Palermo, NY, USA
Contact:

Post by BLADE2 » Fri May 16, 2008 2:36 am

Wow Turkey, you have ALOTof time on your hands!

User avatar
Gloin
Posts: 496
Joined: Sun Nov 05, 2006 6:32 am
Location: I only use 0.09% of my brain...

Post by Gloin » Fri May 16, 2008 10:39 pm

BLADE2 wrote:Wow Turkey, you have ALOTof time on your hands!
You have ALOT of c0ck on your hands

User avatar
BLADE2
Posts: 547
Joined: Sat Jul 15, 2006 2:04 am
Location: Palermo, NY, USA
Contact:

Post by BLADE2 » Sun May 18, 2008 2:42 am

No need to flame Gloin, grow up, act your age.

User avatar
Toonces
Site Admin
Posts: 1627
Joined: Mon Oct 04, 2004 10:23 am
Location: Beta Canum Venaticorum
Contact:

Post by Toonces » Mon Jul 14, 2008 1:24 am

Bump. Still hoping to get around to a good idea here.

User avatar
omlow
Posts: 1734
Joined: Wed Jun 21, 2006 9:26 pm
Location: The Ferrari Dealership
Contact:

Post by omlow » Mon Jul 14, 2008 9:04 am

judging by the fact that turkey has written some important looking stuff up there, and he's incorporated graphs (very professional looking) i'm going to agree with this idea.

not that i actualy read it or anything...

User avatar
Nightmare
Posts: 1462
Joined: Fri Apr 29, 2005 1:58 pm
Location: Antwerp, Belgium

Post by Nightmare » Mon Jul 14, 2008 9:55 am

I read the whole thing, nice math Turkey, way too go :p

Yes I agree of course, having an actual reliable way to know what will happen to the colony is very handy.

Nightmare

KiT
Posts: 67
Joined: Wed Aug 29, 2007 8:51 am
Contact:

Post by KiT » Mon Jul 14, 2008 12:27 pm

I still dont completely understand in what order the resource and pop/morale calculations are made.
What i mean is, are bonuses counted before resource production or after?
Most probably the order is like that: add harvested resources, remove consumed resources (which is 0 if the planet had 0 of the resource on last check), allocate bonuses and set consumption statuses.
But these 3 actions can be juggled in some other ways, all of which make sense, and it needs some experimenting to see how it works.
Some solution can be then made by adding some additional check in between the steps.


Or you could just make consumption never turn off. If the resource goes below 1 after it is consumed, set it to 0 and dont give any bonuses.
This will make it impossible for colony to grow using these small portions of resources though.

The other way is also to make consumption never turn off, but give partial bonuses if the resource is harvested at least a little.
Bonus should be calculated like this:
If Stockpile/consumption >=1 then give full bonuses (bonus:= 1) and subtract consumption amount from stockpile
Else if stockpile >0 then give bonuses:=(stockpile/comsumption) and set stockpile to 0
Else give no bonus (bonus:= 0) and set stockpile to 0 (though it should already be).
The overall bonus (bonus given by 2 resources together) is calculated as
FullBonusFor1Resource*(bonus1+bonus2+bonus1*bonus2)
bonus1 and bonus2 are values between 0 and 1, the way of calculating them is described above. FullBonusFor1Resource is exactly what it means - its amount of bonus you would get if you had sufficient supply of 1 resource. Having full supply of both resources gives 3 times bigger
bonus than having only 1 resource supplied, just as in current system.
Since resource calculations are made every 5 minutes, "consumption" here is consumption of resource per 5 minutes, not an hour. Resource growth should be calculated before resource consumption for this to work.

So, if your colony produces 60 organics every hour (5 units every 5 minutes), consumes 120 organics every hour (10 units every hour), and also produces 150 anaerobes every hour (more than consumption), the income for org wil be displayed in the refinery as -60 and for ana as +30.
Every 5 minutes, 5 organics are added to refinery and immediately consumed. But since 5/10=0.5, you still get the bonuses for it, but amount of this bonus is multiplied by 0.5, and after every 5 minutes you are again left with 0 organics in your refinery, meaning that its state is the same as before and no fluctuations can happen. And since you also get full bonus for having enough anaerobes, the overall bonus multiplier for pop growth will be (1+0,5+1*0.5)=2. Twice as much than if you didnt collect any organics at all and used only anaerobes.

Well, it got a bit more complex than i thought it is, but thats mostly because im bat at explaining stuff simply.

User avatar
NeatLogs
Posts: 115
Joined: Sun Sep 23, 2007 11:58 am

Post by NeatLogs » Mon Jul 14, 2008 3:10 pm

KiT wrote:Well, it got a bit more complex than i thought it is...
Let me try making it sound more simple. Here is what KiT and Turkey have said so far:

Start of Proposal

The main thing here is that when there isn't enough resources, you don't get the full bonus for having that resource. Instead, you get (for this one resource) a fraction of the bonus. The code would be like so:

Code: Select all

If: (Stockpile+Harvest) > Consumption
  Then: Modified Bonus = 1
  Else: Modified Bonus = (Stockpile+Harvest)/Consumption
Now, KiT's proposal for getting the total bonus. In case you didn't notice, Turkey's proposal is, mathematically speaking, exactly the same:

Code: Select all

Total bonus = (Modified Bonus 1 x Modified Bonus 2 + Modified Bonus 1 + Modified Bonus 2) x Bonus Constant
In any case, the amount in the stockpile for each resource is calculated afterwards. This is:

Code: Select all

If: Old Stockpile > Consumption
  Then: New Stockpile = Old Stockpile - Consumption
  Else: New Stockpile = 0
As KiT noted, bonuses are calculated every 5 minutes, so the 'Consumption' used in the above calculations is really: consumption/(12xhour).

End of Proposal

There's something I need to say: The above assumes that the current version deactivates the bonus contributed by a resource when there isn't enough of that resource in the stockpile. Could we check to see if this is how it actually works?

A second thing: Is the bonus that both resources provide equal? As in, does having one type of resource give a bigger bonus than if you had the other type?

User avatar
toast
Posts: 909
Joined: Sun Aug 19, 2007 3:59 am
Location: New Hampshire.

Post by toast » Mon Jul 14, 2008 4:34 pm

i think i understand now thanks to neatlogs...and i really like the idea. Probably only requires that addition of a little math and a variable or two so it should be easy to implement?

Toast

User avatar
Turkey
Posts: 507
Joined: Tue Nov 22, 2005 2:28 pm
Location: Rib'zki

Post by Turkey » Mon Jul 14, 2008 6:26 pm

KiT wrote:FullBonusFor1Resource*(bonus1+bonus2+bonus1*bonus2)
Nice simplification. I wish I'd done that.
NeatLogs wrote:As KiT noted, bonuses are calculated every 5 minutes, so the 'Consumption' used in the above calculations is really: consumption/(12xhour).
The existing system uses every-five-minutes evaluation, so the bonus constants shouldn't have to change from what they are now.
NeatLogs wrote:There's something I need to say: The above assumes that the current version deactivates the bonus contributed by a resource when there isn't enough of that resource in the stockpile. Could we check to see if this is how it actually works?
At the time I did these graphs, I'd been using the radio tower to monitor the bonuses as resources were consumed. It appears very much this way.
NeatLogs wrote:A second thing: Is the bonus that both resources provide equal? As in, does having one type of resource give a bigger bonus than if you had the other type?
They are equal.

User avatar
MegaMan
Posts: 638
Joined: Thu Aug 17, 2006 5:24 am

Post by MegaMan » Tue Jul 15, 2008 12:29 pm

First research lab thread bumped by Toonces

Turkey = pwnage

User avatar
NeatLogs
Posts: 115
Joined: Sun Sep 23, 2007 11:58 am

Post by NeatLogs » Fri Jul 18, 2008 2:32 am

Thank you toast. But uhh.. Can I ask what you mean by the addition of a variable or two?

User avatar
NeatLogs
Posts: 115
Joined: Sun Sep 23, 2007 11:58 am

Post by NeatLogs » Thu Sep 11, 2008 4:41 am

Sorry for bringing this thread back up, but this looked like the best place for this.
*Prepares chlorine and water*

Is there any way we could get a spreadsheet showing what would happen if we fed pollution directly back into morale? So -0.1 morale for every percent of pollution. I'd do it, but I don't have any colonies for solid data. I also knoiw nothing about population growth.

If someone can tell me how population growth works, I can use the proposal in this thread to get an approximation.

Edit: I found some of the info in milo's post, but I still need to know how harvest rate is calculated on an arctic planet. Like, how many resources per hour do you get for anaerobes, medicine, organics and oil. Also, I need to know how pollution currently increases.

User avatar
NeatLogs
Posts: 115
Joined: Sun Sep 23, 2007 11:58 am

Post by NeatLogs » Sat Sep 13, 2008 11:36 am

Guys? Hey guys? I was thinking I might be onto something over here! *waves*

Is there anybody who knows about pollution and harvesting? Hello? Does Nightmare check this forum any more? Turkey?

Gah. I'm just not popular enough. Does anybody think Toonces will answer if I PM him?

User avatar
toast
Posts: 909
Joined: Sun Aug 19, 2007 3:59 am
Location: New Hampshire.

Post by toast » Sat Sep 13, 2008 5:27 pm

;)

I bet if you asked toonces for something that didnt have anything to do with game code or whatever, he would probably be willing to help you.

User avatar
Turkey
Posts: 507
Joined: Tue Nov 22, 2005 2:28 pm
Location: Rib'zki

Post by Turkey » Mon Sep 15, 2008 7:35 am

If I had to guess, Neatlogs, I would say that the population would slowly decline until you cleaned the pollution, at which point it would rise fairly quickly to its normal value then start declining again.

If you want to play with this, download Milo's spreadsheet and edit his morale calculation. (I think he took out pollution in the recent version, which makes it harder).

Post Reply