Author Topic: observation about building structures  (Read 1008 times)

TheMachineIsSentient

  • Guest
observation about building structures
« on: September 27, 2010, 11:22:10 pm »
I was playing a round of AI war tonight, c.o.n. beta, and I noticed something peculiar about the way things are building with different units.

I had the zenith trader appear on my home planet and decided to stockpile a few goodies, one of which was an ion cannon Mark III. Seeing as the game had just started, I paused everything I purchased except for the cannon, and watch closely as the build meter did not increase!

Everything else continued to produce, fighters and bombers, riot control starships, but the health for that Cannon did not increase. Looking at the graph, it showed a 666 ( interesting choice, developers) deduction on the cannon for Crystal and metal, but the health of the cannon would not increase!

My hypothesis is, let us say that over a 1 second you make 1000 credits.

It prioritizes, so that one starport build point takes some amount of credits, let's say 700.
One build point of the starship constructor takes 200 credits.
And deductions for maintenance, takes 250 credits.
One build point of the Mark three Cannon takes 6000 credits.

And each deduction can only take place at the 1 second mark. The timings are hypothetical.

At the 1 second mark, the first three items take their deductions. There are no leftover credits besides perhaps a fraction, and you may see some stuttering in the builds if the deductions for maintenance interfere with the construction of the building of a ship at the time of build points. There seems to be a very discrete, universal interval to apply a build point (the entire universe at a given point in time gets credited, hypothetically 1 second).

Anyway, you can clearly see, you will never have 6000 credits at any universal build point, so the health never increases by even a fraction. It gets starved. The Cannon will never complete unless your net income rises above the first three items +6000 over one universal point in time ( hypothetically stated at 1 second).

The obvious consequence of this is that your income is not spread evenly among what is building; the lowest per build point costs get deducted at each Universal time interval, and if there is nothing left, the high deductible projects get starved.

Is this correct?
« Last Edit: September 27, 2010, 11:34:10 pm by TheMachineIsSentient »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: observation about building structures
« Reply #1 on: September 27, 2010, 11:40:46 pm »
Good guess, I can see why you'd think that, but wildly incorrect.  Here's how it works in a nutshell:

Income:
All the various income you get is added to your stores once per second.

Expenses:
All the various expenses you have are subtracted from your stores in tiny increments 20 times per second.

Implications:
You are correct that if you don't have enough to fund all the things your are building, that not all of them will build.  BUT, based on the above, you have to have really super incredibly negative income for that to happen -- the more likely case is that everything builds, just at various super slow rates. 

On at least the first few of those 20x cycles per second, for instance, you'd have some resources going to everything unless you were spending 20x more than your income, see what I mean?  And if you're spending that much more than your income is, the game assumes that this is such an invalid situation that you'll be disabling some expenses any moment now, eh?

One important note, though: if your expense-per-cycle (1/20th of the shown expense per second) is not able to be met even on the first cycle per second, then you'll see zero process even if you're not thousands into the negative.

What I think was happening in your case was this: it was building, just very slowly.  For a ship with relatively low health (even a few hundred thousand) but an astronomical cost, if you're building very slowly you'll see a very slow buildup, especially if it's not able to spend all the resources per second on actually building it.  You should be able to verify that it is building by hovering over it with the mouse and looking at the BP (Build Points) counting upwards.  If those are really low and slow, then it might be that it's only spending on a couple of cycles per second, rather than all 20.  If those are going up not at all, then you're really bottomed out.

Either way, sounds like it is working fine -- or at least, I'm not aware of any outstanding issues with this at the moment, let's put it that way, and this has been rather vigorously gone through by players in the past.  We used to do expenses 1x per second as well, but through a lot of trial and discussion we made the expenditures more precise specifically to avoid the sort of situation you were hypothesizing about.  But, with extremely-high-costing structures in an extremely low-yield economy, you might still see that to some degree, unavoidably.  It's not wasting any of your resources if it can't actually gather build points, though, don't worry.

PS -- Incidentally, that 666 was mathematically incidental, we don't set the resource outflow rates in a direct fashion -- we set costs and time to build, and resource rates come about from that.  So, purely a coincidence there.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Lancefighter

  • Core Member
  • *****
  • Posts: 2,440
Re: observation about building structures
« Reply #2 on: September 27, 2010, 11:57:28 pm »
of slightly similar note, how are resources allotted?

do things always get the same fraction of your economic output  as they attempt to drain? (in the aforementioned scenario, a ion cannon requesting 666 mc/s, total 1332 drain, only gaining +500mc, will the ion cannon get 250mc/s?)
this would seem the simplest way to do it, however it is perhaps not the most effective (a high level ion cannon being overall less important to have constructing at maximum efficiency than a space dock, imo)
Ideas? Suggestions? Concerns? Bugs to be squashed? Report them on the Mantis Bugtracker!

Author of the Dyson Project and the Spire Gambit

Offline Diazo

  • Master Member Mark II
  • *****
  • Posts: 1,717
  • I love/hate Diff 10
Re: observation about building structures
« Reply #3 on: September 28, 2010, 12:30:50 am »
Umm, I've never really looked at it but I spend more time bottomed out then not and it feels like it's a straight division based on count. If you have 10 things building, each thing gets 10% of your resources, regardless if it's a Mk I fighter or a Zenith Power Generator.

I can't prove that, but it's my guess based on how I see units produced when my economy is bottomed out.

D.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: observation about building structures
« Reply #4 on: September 28, 2010, 01:33:47 am »
of slightly similar note, how are resources allotted?

do things always get the same fraction of your economic output  as they attempt to drain? (in the aforementioned scenario, a ion cannon requesting 666 mc/s, total 1332 drain, only gaining +500mc, will the ion cannon get 250mc/s?)
this would seem the simplest way to do it, however it is perhaps not the most effective (a high level ion cannon being overall less important to have constructing at maximum efficiency than a space dock, imo)

There's no specific logic to it, nor could we add that sort of logic without a lot of CPU overhead (and likely bugs).  It simply goes based on the order of the objects in the loop, which is generally the oldest objects first and then the newer ones.  But, since that's a loop over all objects 20x per second, you're right that you might see one ship getting substantially more than another (partly because 666/20 is higher than 500/20, and if they both make it through, say, 16 of the 20 cycles then one would have a lot more than the other built up by that stage).

The other challenge is that not everything pulls metal and crystal evenly, right?  The restriction is that it must have enough to be able to pull its per-cycle metal and crystal.  So if you had a ton of metal, and something cost 40/s metal and 0/s crystal, it would keep building past when something that cost 10/s metal and 10/s crystal would if crystal was bottomed out.

It's surprisingly complex, actually.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Lancefighter

  • Core Member
  • *****
  • Posts: 2,440
Re: observation about building structures
« Reply #5 on: September 28, 2010, 02:10:26 am »
well it just sounds to me that your saying each tick (1/20th of a second) the resource pull is done in a queue, so potentially 'newer' jobs get the shaft

And yeah, I was attempting to simplify it.. mainly because i was thinking back to TA the entire time where generally your only ever short on one resource..

But i agree, a lot of complex stuff would have to happen behind the scenes to decide where gets resources - this was a huge problem for a similar project (warzone 2100 remake team).. They wanted to go from a debit system (resources pile up and are pulled all at once to build an item) to a flow system (like here, resources are pulled gradually as a unit is built), but nobody could decide how they would queue the resource draw without other issues (ui clutter being a main point, player priorities are always very different as well)
Ideas? Suggestions? Concerns? Bugs to be squashed? Report them on the Mantis Bugtracker!

Author of the Dyson Project and the Spire Gambit