Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: Yitzi on September 30, 2013, 11:13:17 PM

Title: Stockpile energy thoughts
Post by: Yitzi on September 30, 2013, 11:13:17 PM
I've begun the investigation to fix the stockpile energy bug, and begun thinking about what would happen instead...

The most logical way to do it, I think, is as follows:
Case 1:If you finish something (doesn't matter what), and the next thing in your queue is stockpile energy, and the "build multiple things per turn" feature (which I will add while I'm at it, as it's the same area of the code) is on, any leftover minerals (up to a maximum equal to the usual maximum carry-over minerals) are immediately turned into energy.  Your production is then set to stockpile energy.  Changes in this case: 1. Any minerals already used for producing the facility are not turned into energy.  2. Any minerals over the maximum carry-over are not turned into energy.  (This makes sense; if they can't be used to make another unit or facility, why can they be made into energy?).  3. If you can't build multiple things per turn, you won't get any extra energy when you finish a facility or unit (also makes sense; if you can't use those extra minerals for a scout patrol until next turn, the same should go for turning them into energy.)  4. If it is turned into energy, those minerals are removed from production.  (This is the flip-side of #1: If you use it for production, it can't become energy.  If you use it for energy, it can't become production.)
Case 2:If you finish something with nothing left in the queue, and is set to automatically stockpile (e.g. a facility; I believe that this is customizable to some extent in-game) it switches to stockpiling energy but will not stockpile any energy this turn.  This is to allow you a chance to change production before losing it if you don't like messing with queues.  Changes in this case are the same as case 1, except that you don't get any extra energy (and don't lose production) regardless of whether it's possible to build multiple things per turn.  This doesn't make you lose energy, it's just delayed, because:
Case 3:If you are already "building" stockpile energy, any accumulated production is added to your per-turn production (and then used up when you get energy from stockpile).  This lets you "cash in" accumulated production if you want (at the usual inefficient rate of stockpile energy).  It also means that if a base is producing only 1 mineral per turn (and is therefore not going to produce anything via stockpile energy) it can be set to build something else and then cashed in once it's enough.  That's a bit of a hassle, though, and there's really no logical reason you shouldn't be able to make use of production that doesn't boost your energy anyway, so:
Case 4: Stockpile energy will give as much energy as it can, but any minerals not needed for that much energy will not be used, and will just be stored up as stored production.
Finally, two more changes while I'm at it:
1. The Planetary Energy Grid adds 25% to your minerals being turned into energy, rather than your actual energy received, i.e. it is not rounded down beforehand.  So, for instance, 7 minerals will be turned into 4 energy rather than 3 with the Planetary Energy Grid.  (This is simply because the less effect rounding has, the better).
2. While stockpile energy normally gives 1 energy per 2 minerals, it will be possible to change that, with the minerals to produce 1 energy being the value at "cost" for stockpile energy.  (So by default that will be 2, if you change it to 5 then you only get 1 energy per 5 minerals.)

So...thoughts?  Comments?  Criticisms?  Suggestions?  Nothing's been implemented yet, so it's easy to change any plans at this point.
Title: Re: Stockpile energy thoughts
Post by: JarlWolf on September 30, 2013, 11:21:59 PM
I think that it should remain that there be no efficient surefire way to convert minerals to energy by switching production. Something like that can be horribly abused and lead to more problems.

An example of that would be,

Someone is building up a high mineral building/unit, and then at the last second they switch their production to stockpile energy. If there was efficient mineral-energy conversion you'd just have people abusing changing production ques just to bootleg energy.

So keep it as is, it seems balanced to me. If someone counters and states, what if you have loads of leftover minerals from a failed project, well then I'd reply: That's your fault and problem for not finishing the project. Use those over abundant minerals to make a colony pod, we need more people.  ;lol  :danc:

Title: Re: Stockpile energy thoughts
Post by: Yitzi on September 30, 2013, 11:58:14 PM
I think that it should remain that there be no efficient surefire way to convert minerals to energy by switching production. Something like that can be horribly abused and lead to more problems.

An example of that would be,

Someone is building up a high mineral building/unit, and then at the last second they switch their production to stockpile energy.

Then they get the same energy as they would if they'd just used stockpile energy the whole time.

This doesn't let you convert minerals to energy any more efficiently than stockpile energy already would (except that it vastly decreases losses due to rounding*); the only real change is that you can change it and the stuff you were building is treated as if you'd been stockpiling all the time.

Although...maybe it should be made to have the usual production-change penalty.


*Instead of a maximum of .5 energy per base per turn, or up to 1.375 energy per base per turn with the Planetary energy grid, you lose nothing due to rounding without the PEG, or a maximum of 0.5 per base per turn with it.

Quote
So keep it as is, it seems balanced to me.

Well, the stockpile energy bug is definitely not balanced, so something has to change; the question here is whether you should be able to change production to stockpile at no penalty (but the same low efficiency stockpile always gets), or at the usual 50% penalty for everything after the first 10 minerals (on top of said low efficiency), or not at all.

What do you think of the other features (getting the energy the turn you finish the last thing if you have multibuild and queued stockpile, and having it stay as production otherwise, and letting leftover minerals carry over when stockpiling)?
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 01, 2013, 05:56:40 AM
It would be game changing for sure.  You would be able to drop everything in production to get energy to rush a secret project.  Granted it's not very efficient because its 2 mineral per 1 energy then you're spending 4 energy per 1 mineral (assuming no other exploits).  I think it's fine to allow this without an additional switching penalty.

I think carrying forward the excess minerals while stockpiling is fine too.  Would it be possible to convert them as they get to the required amount on subsequent turns (i.e. 1 mineral production base, first turn it stores the mineral, second turn you get 1 energy and it goes back to 0 minerals)?

While on the topic, if multiple builds are allowed per turn, would multiple rush buys be possible in the same base?  For example if I have 20 minerals and want to rush a Recycle Tanks and Rec Commons.  Would it be 40 for the Recycle tanks and 160 for the Rec Commons?   Or would it be 120 since I have 10 minerals already towards both.   I would say the latter...I think I'd say that if you rushed one item then the 'first 10 minerals' penalty wouldn't apply to any subsequent purchases.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 01, 2013, 12:12:40 PM
It would be game changing for sure.  You would be able to drop everything in production to get energy to rush a secret project.  Granted it's not very efficient because its 2 mineral per 1 energy then you're spending 4 energy per 1 mineral (assuming no other exploits).

"Not very efficient" is the least of it; building units (not crawlers) to disband in the project-building base is roughly four times as efficient.

Quote
I think carrying forward the excess minerals while stockpiling is fine too.  Would it be possible to convert them as they get to the required amount on subsequent turns (i.e. 1 mineral production base, first turn it stores the mineral, second turn you get 1 energy and it goes back to 0 minerals)?

That's the idea: Because you're adding whatever's accumulated, the first turn it stores the mineral and the second it adds that one to whatever it's got for a total of 2, so it converts it to 1 energy.

Quote
While on the topic, if multiple builds are allowed per turn, would multiple rush buys be possible in the same base?

Only by rushing to enough minerals to build both things, and only if the carry-over is allowed to be at least the cost of the second item (as multibuild just lets you build multiple things if enough minerals carry over; it doesn't let you carry over more than before).
Title: Re: Stockpile energy thoughts
Post by: gwillybj on October 01, 2013, 12:54:52 PM
:scratch:
I like this part of Case 1:
3. If you can't build multiple things per turn, you won't get any extra energy when you finish a facility or unit (also makes sense; if you can't use those extra minerals for a scout patrol until next turn, the same should go for turning them into energy.)  4. If it is turned into energy, those minerals are removed from production.  (This is the flip-side of #1: If you use it for production, it can't become energy.  If you use it for energy, it can't become production.)

And all of case 2:
Quote
Case 2:If you finish something with nothing left in the queue, and is set to automatically stockpile (e.g. a facility; I believe that this is customizable to some extent in-game) it switches to stockpiling energy but will not stockpile any energy this turn.  This is to allow you a chance to change production before losing it if you don't like messing with queues.  Changes in this case are the same as case 1, except that you don't get any extra energy (and don't lose production) regardless of whether it's possible to build multiple things per turn.  This doesn't make you lose energy, it's just delayed...

The PEG change looks good, too.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 01, 2013, 02:24:39 PM
It occurred to me...the whole point of multibuild is to let high-production bases build multiple cheap units at once.  But that won't happen due to the limit of 10 minerals carried over.  One option is simply to let more be carried over, which makes sense anyway so that high production bases lose less of their total production...the problem, though, is that then if you want to hurry a project you could instead build a cheap facility, hurry it (at the cheaper per-facility cost) to enough to build the facility and the project, queue the project, and effectively hurry the project at a cheaper cost.

It would be possible to have the high carry-over be only for things in the same category, but that would be a bit more difficult and still would leave problems (e.g. using a scout patrol hurry to hurry an expensive unit from scratch and bypass the high cost for hurrying expensive units, and that you'd lose a lot of minerals in high-production bases when switching types); perhaps the best way is just, if using multibuild, to have a rule (it's not like there aren't already anti-exploit rules) that you can't hurry to more than 10 minerals past completion if it would decrease the hurry price on something later in your queue (or hurry and then add something to your queue that is thereby hurried for cheap.)

Also, Jarlwolf, I'm wondering if I've persuaded you that the resulting ability to turn stored minerals into energy is not efficient, and is therefore no more of a problem than normal Stockpile Energy is.  (Everyone else seems ok with it, and it'd be easier to code with that happening than to prevent it but still be able to eliminate the rounding losses.)
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 01, 2013, 06:37:01 PM
I think the fix would be to jump the cost based on the next thing on the queue, and cap each rush to fill the mineral rows of the current thing in production.  Example rushing a Recycling tanks with 10 minerals done.  Limit is 60 energy towards it...any thing beyond 60 energy gets the rate of the next item.  However this could get complex indeed with queue switching.

Would it be simpler if rushing to fill every mineral (i.e. turns to complete = 0) gave you the facility, unit, SP immediately?  Granted this would have a big game impact.  But as it is you're best off rushing to 1 turn to completion (which requires manual calculation) to avoid going over the 10 mineral excess cap.

Another fix to simplify might be just to remove the doubling in cost for rushing before the first 10 minerals.  I never really understood the need for this, when rushing is already very expensive.  Maybe it was intended to make the -SUPPORT SE more punitive for new bases.  Alternatively this doubling could be removed only for rushes beyond the first *when you already had 10 minerals on the first rush*.  But that's more to keep track of.
Title: Re: Stockpile energy thoughts
Post by: Geo on October 01, 2013, 09:35:14 PM
Finally, I get the impact of what's discussed here. Thanks Nexii. ;)
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 01, 2013, 10:10:09 PM
Would it be simpler if rushing to fill every mineral (i.e. turns to complete = 0) gave you the facility, unit, SP immediately?  Granted this would have a big game impact.  But as it is you're best off rushing to 1 turn to completion (which requires manual calculation) to avoid going over the 10 mineral excess cap.

Giving it immediately would be too large an impact, not to mention being a huge pain to code.  Giving it as the rate of the next item of the queue would be easier, but still tricky, and I still don't really see that much need for it; without it there isn't a problem unless you rush to overflow by more than 10 minerals (which can be banned), with it there is still a problem if you queue switch.  The only thing it would really help with is if you want people to be able to rush (as opposed to build normally) multiple things in a single turn.  Thoughts?

Quote
Another fix to simplify might be just to remove the doubling in cost for rushing before the first 10 minerals.  I never really understood the need for this, when rushing is already very expensive.

Firstly, rushing really isn't that expensive when you consider that energy is a lot easier to boost than minerals.  Secondly, I think the idea is so that you make at least some through production, and they just didn't consider that you could rush to 10 overflow.

In any case, making the option to remove that doubling would be more work than I think it's worth at this point in time; the only real concerns here, as far as I see, are (1) making Stockpile make sense, and (2) allowing high-production bases to build more than one thing a turn, without allowing exploits to make rushing cheaper.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 02, 2013, 02:40:01 AM
I have made a discovery that changes things somewhat: If you have more production stored than is needed to build the current thing, the extra production is lost and none of it carries over; the 10 minerals carry-over is only for what you got this turn.  Thus, the concern about hurrying an extra amount so that you can hurry at the cheaper price is simply not an issue; you can never carry over more than your production for this turn.
Stockpile energy will still allow carry-over, though, I think...it's slightly easier to code, but more importantly it means that a finished facility can have the extra not immediately changed to stockpile energy (so that you have a chance to build something else instead and not lose the extra), but if you do keep it on stockpile energy the extra isn't lost.  That does mean that you can "cash in" a half-produced facility to get the money you would have gotten by stockpiling that whole time, but that's no more efficient than regular stockpile, or selling facilities, so I don't think it would be an issue.

I also found that the amount that carries over is not quite unchangeable; it's set to be equal to the size of a row at +0 INDUSTRY (i.e. no matter what your INDUSTRY is, it's the number of minerals per row at +0).  Still, I think it could do with being made separately changeable.
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 02, 2013, 03:26:02 AM
I discovered something else while playing around with customized mineral penalty/carryforward: the exempt minerals variable is also used as the mineral carry forward cap.  I put the exempt minerals to 20 and the game lets me carry forward 20 minerals instead of 10.  This is why going to +5 INDUSTRY doesn't change the fact that you still need 10 minerals by default to get the normal rush price (even though it would be 2 full rows of 5 minerals each in that case).

But I suppose that is good.  What does this imply for rushing to 1 turns completion vs 0 turns completion?  I'm seeing the same for rushing to 0 turns completion in bases with over 10 minerals production: the excess minerals are simply lost.  I'm not able to trigger the "Classic Stockpile" bug through empty queue or stockpile queue, is there something I'm missing here?

One could argue with multi building that even carrying forward 10 minerals would be a minor exploit.  It's cheaper to excess build a facility by 10 minerals and queue on a Scout Infantry in that case, rather than to just build the facility to 1 turns completion and rush the Scout Infantry the next turn.  What if for queue switches, you simply used the value of the excess *energy* rather than minerals, and converted it to what that energy would buy towards the next thing?  Would that be simpler?

Maybe all excess minerals should get stored and if stockpile energy isn't switched off then on the next turn it's all converted (plus that turn's stockpile energy).

Another bug I noticed with building and the city screen is that it assumes 10, 50% I believe when calculating the turns it will take to complete a switched thing.  For example a base with 40 minerals producing 7/turn and making a Recycling tanks, it'll show 3 turns if I switch to Rec Commons, even if I put the variables at 0, and 0% (no penalty).   It does display correctly once you've actually switched.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 02, 2013, 03:52:50 AM
I discovered something else while playing around with customized mineral penalty/carryforward: the exempt minerals variable is also used as the mineral carry forward cap.

You're right, my mistake.

Quote
But I suppose that is good.  What does this imply for rushing to 1 turns completion vs 0 turns completion?  I'm seeing the same for rushing to 0 turns completion in bases with over 10 minerals production: the excess minerals are simply lost.  I'm not able to trigger the "Classic Stockpile" bug through empty queue or stockpile queue, is there something I'm missing here?

Hmm...I thought it was unfixed, but it seems that Kyrub sort-of fixed it.  That is, he fixed it, but in the process he broke some other stuff, in that now (1) the extra minerals are completely wasted, when logically you should at least get for what you had beforehand, and (2) Stockpile Energy doesn't work properly even when you're not trying to exploit the bug.  (It simply gives you no energy for the first turn.)

Quote
It's cheaper to excess build a facility by 10 minerals and queue on a Scout Infantry in that case, rather than to just build the facility to 1 turns completion and rush the Scout Infantry the next turn.

Except that if you excess-rush, you lose the excess.  You never carry over more than the base's mineral production.

Quote
What if for queue switches, you simply used the value of the excess *energy* rather than minerals, and converted it to what that energy would buy towards the next thing?  Would that be simpler?

No, and it'd still allow for unusual behavior.  I think the best way is simply that the carry-over is capped at the base's production, so you can never hurry past 100% completion and get an advantage that way.

Quote
Maybe all excess minerals should get stored and if stockpile energy isn't switched off then on the next turn it's all converted (plus that turn's stockpile energy).

That's the idea; the only exception would be if you explicitly queue stockpile with multibuild on; in that case, they turn into energy immediately.

Quote
Another bug I noticed with building and the city screen is that it assumes 10, 50% I believe when calculating the turns it will take to complete a switched thing.  For example a base with 40 minerals producing 7/turn and making a Recycling tanks, it'll show 3 turns if I switch to Rec Commons, even if I put the variables at 0, and 0% (no penalty).   It does display correctly once you've actually switched.

That's a different part of the code, and as a minor display bug it's just not enough to make the short list.  Once I start taking general requests, it's definitely a valid request, though.
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 02, 2013, 04:51:12 AM
Another minor and longstanding exploit is that you can rush a facility and then pay the 50% switching cost to a unit, and come out ahead (related to what I mentioned before).  Only is true however when not much has been produced towards the current.  Not sure this can be fixed without making unit rush costs linear and it's probably not related to stockpile energy directly anyways. 

[I think the best way is simply that the carry-over is capped at the base's production, so you can never hurry past 100% completion and get an advantage that way.]

Is this assuming multi building or in both cases?  This seems like a logical start, since then you will never lose the excess minerals for rushing to turns:0 which the game wants you to do by default.   I assume that if you switch down (i.e. something expensive to cheap) then the carried forward minerals in excess of production would get auto-converted back to energy on the next production turn?  I think if Stockpile energy isn't explicitly selected then they should still go to energy rather than be lost.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 02, 2013, 12:27:07 PM
Another minor and longstanding exploit is that you can rush a facility and then pay the 50% switching cost to a unit, and come out ahead (related to what I mentioned before).  Only is true however when not much has been produced towards the current.  Not sure this can be fixed without making unit rush costs linear and it's probably not related to stockpile energy directly anyways. 

It's not related, and there's no real way to fix it.  But it can't be used to bring unit hurry cost below 4 credits/mineral, which is fairly expensive even with multipliers being more prevalent for economy than minerals.  (For facilities, 1 energy "on the map" is actually as helpful as as one mineral "on the map" for much of the game because economy is boosted so much more than minerals.  And it doesn't cause ecodamage, so you can get more of it.)

Quote
Is this assuming multi building or in both cases?

Both cases.

Quote
I assume that if you switch down (i.e. something expensive to cheap) then the carried forward minerals in excess of production would get auto-converted back to energy on the next production turn?

No, they'd be lost; there's no easy way to tell between that and rushing past completion.

Quote
I think if Stockpile energy isn't explicitly selected then they should still go to energy rather than be lost.

The way I'm planning, it will, though not until the next turn.
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 02, 2013, 02:05:35 PM
Ok that's fine.  If you rush to completion and switch you can see the Red minerals which denote exactly what you will lose next turn by doing this (in the case of cap = base production only).  Technically you can also rush past completion without switching if you hurry with a cost beyond what it takes to go to turns: 0.  For example I can dump 100 energy into a Recycling tanks that only takes 60 to complete, and it gives 20 excess red minerals.  Also a minor bug as it's visible and you have to try in order to make this occur (though it might be possible to rid this one by capping rush energy to the recommended amount, it can still be circumvented in sometimes less efficient ways).

So essentially the rush cap and exempt minerals amount would be two variables in alphax rather than one?  Rush cap = -1 could equal the bases production or something?
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 02, 2013, 02:32:55 PM
Quote
Also a minor bug as it's visible and you have to try in order to make this occur (though it might be possible to rid this one by capping rush energy to the recommended amount, it can still be circumvented in sometimes less efficient ways).

Not a bug at all.  That thing I mentioned about the red minerals just being lost?  It's already in there.

Quote
So essentially the rush cap and exempt minerals amount would be two variables in alphax rather than one?

Yes.

Quote
Rush cap = -1 could equal the bases production or something?

Seems like a good plan (but even if you set it to a value, it still is also capped at the base's production).  (Well, more specifically that will cap it at 4 billion and change, but if production ever goes higher than that you'll run into rollover issues anyway.)  It does, however, mean that the cap (when not using "capped only by production") will have a maximum of half what it otherwise would.  Still, that'll be 32 thousand and change, so it shouldn't be an issue.
Title: Re: Stockpile energy thoughts
Post by: Nexii on October 02, 2013, 08:34:09 PM
Yea, I think it would be hard to spend even 32000 a turn.  Theres only 8 queuable slots so thats 4000 minerals per item.  And really 8 is plenty...I would rarely see a need for more

Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 02, 2013, 09:28:59 PM
Yea, I think it would be hard to spend even 32000 a turn.  Theres only 8 queuable slots so thats 4000 minerals per item.

No, as some things (e.g. most units), when you finish them, just build more of the same.

The only real limit is the base's production...which also isn't going to be that high.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on October 15, 2013, 06:53:58 PM
Another point I found while working through the code to figure out how to change it: Stockpile energy calculations round up (so, for the most extreme example, a 1-mineral base whose owner owns the PEG will get 2 energy per turn from stockpiling: 1/2 rounds up to 1, and 1+25% rounds up to 2).

So the question is: How should I handle this?  Here are my options, as I see them:
1. Leave it as it is.  This is the least work, of course.  Accumulated production (such as from having finished something last turn with nothing in the queue, or with stockpile energy in the queue and multibuild off) will still be added to current production for the calculation, and will then be set to 0 (which means that queueing nothing rather than stockpile will actually sometimes give 1 credit's less energy in total).
2. It still rounds up and includes (and thus deletes) all accumulated production, but it applies the PEG before rounding, so a 1-mineral base will produce only 1 energy even with the PEG.  This isn't much more work.
3. It rounds down, and any leftover production not needed to produce energy is not used (and remains there for next turn).  This is somewhat more work, but still not by very much.
4. I make this an option through alphax.txt.  This is going to be substantially more work than any of the other options.

So...any preferences?
Title: Re: Stockpile energy thoughts
Post by: Geo on October 15, 2013, 08:17:41 PM
I have a slight preference for option 3.
Title: Re: Stockpile energy thoughts
Post by: Lord Avalon on October 15, 2013, 09:51:56 PM
Rounding down sounds good.
Title: Re: Stockpile energy thoughts
Post by: TarMinyatur on December 01, 2013, 09:43:22 PM
Eventually, I figured out why the SManiaC Mod was crashing under Yitzi's v2.4 terrran.exe. I should have read Yitzi's readme.

If your Mod sets the cost of Stockpile Energy to zero, a divide-by-zero error occurs. Once I changed the alphax.txt value in #Facilities to 2, the build queue became useable.

Yitzi states that the construction cost of the Stockpile Energy "facility" must be an integer. Is zero an integer?

An effective way to cripple Stockpile Energy in v2.4 would be to set the value to 1000, rather than zero.
Title: Re: Stockpile energy thoughts
Post by: Yitzi on December 01, 2013, 09:53:37 PM
Eventually, I figured out why the SManiaC Mod was crashing under Yitzi's v2.4 terrran.exe. I should have read Yitzi's readme.

If your Mod sets the cost of Stockpile Energy to zero, a divide-by-zero error occurs. Once I changed the alphax.txt value in #Facilities to 2, the build queue became useable.

Yitzi states that the construction cost of the Stockpile Energy "facility" must be an integer. Is zero an integer?

An effective way to cripple Stockpile Energy in v2.4 would be to set the value to 1000, rather than zero.

Zero is an integer; when I said it must be an integer I meant that you can't put in 2.5 to have it give 2 energy for every 5 minerals.  And in fact, I said to put in whatever you want the exchange rate to be; setting it "zero minerals per energy" will make the program do exactly that, hence divide-by-zero.
Title: Re: Stockpile energy thoughts
Post by: gwillybj on December 02, 2013, 02:53:41 PM
In such cases of divide-by-zero, why not capture the error and make the result zero? :dunno:
(Simple algebra will have to do for my examples; I don't know code.)

x/y=z; if y=0 then z=0


in some cases it might have to be

x/y=z; if y<=0 then z=0
Title: Re: Stockpile energy thoughts
Post by: Yitzi on December 02, 2013, 03:14:12 PM
In such cases of divide-by-zero, why not capture the error and make the result zero? :dunno:

Because it would be extra work, and accomplish nothing; anyone who wants to make Stockpile Energy not be used can simply set its prerequisite to "disable".  (And anyone who modded it without meaning to change the value would be unhappy at it becoming useless anyway; at least this way it's obvious so they'll find it to fix it.)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 15.

[Show Queries]