Author Topic: Stockpile energy thoughts  (Read 5081 times)

0 Members and 1 Guest are viewing this topic.

Offline Nexii

Re: Stockpile energy thoughts
« Reply #15 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?

Offline Yitzi

Re: Stockpile energy thoughts
« Reply #16 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.

Offline Nexii

Re: Stockpile energy thoughts
« Reply #17 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


Offline Yitzi

Re: Stockpile energy thoughts
« Reply #18 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.

Offline Yitzi

Re: Stockpile energy thoughts
« Reply #19 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?

Online Geo

Re: Stockpile energy thoughts
« Reply #20 on: October 15, 2013, 08:17:41 PM »
I have a slight preference for option 3.

Offline Lord Avalon

Re: Stockpile energy thoughts
« Reply #21 on: October 15, 2013, 09:51:56 PM »
Rounding down sounds good.
Your agonizer, please.

Offline TarMinyatur

Re: Stockpile energy thoughts
« Reply #22 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.

Offline Yitzi

Re: Stockpile energy thoughts
« Reply #23 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.

Offline gwillybj

Re: Stockpile energy thoughts
« Reply #24 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
Two possibilities exist: Either we are alone in the Universe or we are not. Both are equally terrifying. ― Arthur C. Clarke
I am on a mission to see how much coffee it takes to actually achieve time travel. :wave:

Offline Yitzi

Re: Stockpile energy thoughts
« Reply #25 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.)

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

God does not play dice.
~Albert Einstein

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 41.

[Show Queries]