Author Topic: Unit cost formula: Alternate approaches (taking requests)  (Read 10189 times)

0 Members and 3 Guests are viewing this topic.

Offline Yitzi

Unit cost formula: Alternate approaches (taking requests)
« on: June 21, 2013, 05:27:03 PM »
As part of patch version 2.2, I will be making new options for the unit cost formula.  I have room for 8 options, numbered 0 to 7; 0 is for Firaxis' formula, and 1 is for my own, but that leaves 6 for people who have other ideas.  (If I get more than 6, we'll use a vote.)

The following values may be used in the formulas (I'm using lowercase letters for unmodified versions, uppercase for modified):
r: The unit's reactor value.
a: The cost of the unit's armor.
A: The cost of the unit's armor, halved for sea units and multiplied by 2*r for air units.
w: The cost of the unit's weapon or module.
W: The modified cost of the unit's weapon or module; choose the modification as part of the proposal.
C: The cost of the unit's chassis.  There will be an additional option to add the reactor cost for sea units and plus the bonus reactor-based speed (twice the reactor by default) for air units (this option is active in the un-modded version).
S: The total cost of the unit's special abilities.

And some not-really-numerical values:
-Whether the unit is land, sea, or air.
-The unit's module type (probe team, formers, weapon, etc.)
-Each submission will also get a single alternate form (which can be set to on or off in alphax) for a minor variant.

When submitting a formula, remember that it must be the cost in rows; there's no way to add a mineral cost besides the rows.  Furthermore, whenever dividing by something, make sure to say whether you want to round up, down, or normally.

Note that none of this will apply to planet buster missiles; their cost in rows is simply the cost marked for planet busters.

Post 2 will be reserved for listing the submissions.
« Last Edit: September 24, 2015, 08:11:12 PM by Yitzi »

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #1 on: June 21, 2013, 05:27:42 PM »
Mode 0 (submitter:Firaxis; variant proposed by Yitzi):
W is w or A/2+1 (rounding down), whichever is more.
Base cost is WX(A+C)/(2^(r+1)), rounding normally. 
If C=1, divide by 2 (rounding down) and add 1. 
If w>1 and a>1 and either it is a combat unit or the alternate form is not being used, add 1, and then another 1 if it is a land unit with C>1.
If it is a non-probe-team sea unit, divide by 2, rounding up.
If it is an air unit, divide by 2, rounding down; if it is also a combat unit, divide by 2 again, rounding down.
Unless W=A=C=r=1, apply a minimum of (1.5)Xr, rounding up.
Now multiply by (S+4)/4, rounding normally.

Mode 1 (submitter: Yitzi):
W is w or A/3 rounding up, whichever is more.
Base cost is WX(A+C)X(6-r)/20, rounding normally. 
If w>1 and a>1 and either it is a combat unit or the alternate form is not being used, add 1, and then another 1 if it is a land unit with C>1.
If it is a non-probe-team sea unit, divide by 2, rounding up.
If it is an air unit, divide by 2, rounding down; if it is also a combat unit, divide by 2 again, rounding down.
Unless W=A=C=r=1, apply a minimum of r+1.
If C=1, divide by 2 (rounding down) and add 1.
Now multiply by (S+4)/4, rounding normally.
If the result is more than 250, reduce to 250.
« Last Edit: July 05, 2013, 09:01:07 PM by Yitzi »

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #2 on: July 05, 2013, 11:02:12 PM »
Mode 1 looks good and likely would be a huge improvement over Mode 0.  Would this be including your proposed tech tree and weapon/armor cost changes, or is that something for a later patch?  I think there were some discussions about making ECM and AAA to -1 (cheap on defense units).  Also, could you perhaps do ~4 examples of costs with Mode 1 to demonstrate?  Maybe an air unit, a sea unit, a non-combat unit, and an infantry unit.

I think the only variant I'd perhaps like to see is one that encourages maxing weapons and armor on all units.  I know it's not in the spirit of the game to have ultimate units.  So that formula might have to have a higher weight on better chassis.  I think that even with the reactor nerf, reactors vastly overpower weapon and armor techs.  I'm not sure I'd always play on this mode but I think EM or someone else wanted it as well.  I can come up with a formula based on the answer to the above.

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #3 on: July 05, 2013, 11:30:20 PM »
Mode 1 looks good and likely would be a huge improvement over Mode 0.  Would this be including your proposed tech tree and weapon/armor cost changes, or is that something for a later patch?

Neither.  This thread is only for things that can't be done via alphax.txt, which tech tree and weapon/armor cost both can.

Quote
I think there were some discussions about making ECM and AAA to -1 (cheap on defense units).

Also doable with alphax.

Quote
Also, could you perhaps do ~4 examples of costs with Mode 1 to demonstrate?  Maybe an air unit, a sea unit, a non-combat unit, and an infantry unit.

I have to go soon, but I'll try to do examples later.  This is mainly for if anyone else has options they'd like to see, though.

Quote
I think the only variant I'd perhaps like to see is one that encourages maxing weapons and armor on all units.  I know it's not in the spirit of the game to have ultimate units.

That's fine; people will pick which formula, so they can use that one if they want a different spirit of the game.

You want to write that variant, or should I come up with one?

The whole point here is that you can submit whatever variants you want (well, unless it's too many, in which case people vote on them.)

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #4 on: July 06, 2013, 12:00:35 AM »
Fair enough.  You can come up with the formula, since you'll be coding it you know better what's easier to implement.  In general my thought was to add weapon/armor rather than multiply.  A more extreme version would take the maximum costing of weapon and armor.  I think in Mode 2 that faster units will need a high multiplier (~2x inf cost for fast land, ~3x inf cost for air) to discourage making all-rover or all-air armies.  Since they will be much better on defense than they currently are.

Where weapons, armor, and chassis speeds can be edited in alphax.txt; there isn't much else but reactor tweaking.  Perhaps two corresponding modes where reactor scaling is reduced a bit more (~50% cost reduction each reactor level rather than 100%-150%).  Just my opinion but I think even 100-150% is edging on game-breaking - at least for military units.  Non-combat units might need to scale a bit stronger with reactor in these modes.
« Last Edit: July 06, 2013, 01:47:18 AM by Nexii »

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #5 on: July 07, 2013, 03:51:41 AM »
How's this sound:

-In mode 2, the cost is (w+a)X2, halved for infantry and +50% for air.  Reactor would then have no effect on cost, giving it +100% advantage for fusion, +50% for quantum, and +33% for singularity.  In the alternate form, reactors other than level 1 have a +33% increase to price, reducing the advantage for fusion to 50%.  Note, however, that either way, there will be no point in using rovers once hovertanks become available, and no point in using foils once cruisers become available. 

-Mode 3 is the same as mode 1, except that the cost formula is instead WX(A+C)/4 for reactor level 1, and WX(A+C)/3 for other reactors.  (This means it actually increases in cost with fusion, to compensate for the huge hit point boost; that way, fusion and quantum are worth a 50% effectiveness boost each, and singularity is worth a 33% boost.)  Note that even without increasing the cost of armor and weapons, late-game troops will have costs comparable to mid-to-late-game facilities.

Mode 4 is the same as mode 2, except that the base cost is Max(w,a)X2 instead.

So does that look good, or you want to change things?


As for examples for mode 1, I realized that giving enough examples to give a good sense of what's going on would just be too prohibitive.  Instead, once I code it and publish the patch, you can play around with it as much as you want...and if you want changes, you can put them here for the next patch.

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #6 on: July 07, 2013, 04:10:31 AM »
Agreed.  The unit workshop would be a faster way to test the modes.  This is probably a good enough starting point without doing up many cases.

IMO rovers and foils going obsolete isn't a huge deal.  They kind of already do, and the same could already be said of needlejets and copters.

And on a side note I think that the side-effect of higher overall unit costs in the mid and late game is a good thing.  I feel that it should be a real challenge to get a city to the point where it can make a good unit every turn. 

Offline Earthmichael

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #7 on: July 25, 2013, 01:54:30 AM »
Can one mod so that zero cost option are truly zero in any unit.

For example, if my armor is great than weapon, Trance should always cost 0, regardless of any other options picked.   It does not do this now.

Also, it would be great if cost of Clean reactor did not go up with reactor size.

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #8 on: July 25, 2013, 03:20:45 AM »
Also, it would be great if cost of Clean reactor did not go up with reactor size.

I kind of felt it was an oversight that higher reactors didn't require more support in minerals (i.e. 2x/3x/4x the base for the later reactors).  This is a bit on a tangent but it does tie in as mineral upkeep is very closely tied to unit costs.  SUPPORT SE becomes very useless beyond the early-mid game, and not just because of Clean

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #9 on: July 25, 2013, 03:59:10 AM »
Can one mod so that zero cost option are truly zero in any unit.

For example, if my armor is great than weapon, Trance should always cost 0, regardless of any other options picked.   It does not do this now.

This is a bug, and was fixed as early as patch version 1.3.  If you're finding that it still applies, please let me know which options you picked and which patch version you're using, and I'll look into it.

Quote
Also, it would be great if cost of Clean reactor did not go up with reactor size.

Can you explain what you mean?  Last I checked, it costs 2 points (+50% cost) no matter which reactor you use.

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #10 on: September 13, 2013, 06:46:59 PM »
To clarify myself/EM:
I think that meant that Clean went up in absolute cost as the game went on, whereas mineral cost is always fixed (1 mineral per unit).  Therefore the value of Clean gets diminished on more expensive units.  An early game unit costing 20 goes to 30, for a 10 turn break-even on investment.  A unit that costs 60 (later game/reactor), goes to 90 cost with Clean, for a 30 turn break-even. 

So Clean could have a fixed cost (probably difficult to code in.  Or it could just be accepted that it's better on cheaper units.

An alternative way to somewhat balance out later reactors with Clean would be to make Fusion units cost 2 minerals per turn, Quantum 3 minerals per turn, and Singularity 4 minerals per turn.  This way the break-even time stays more constant.  As well then Support SE and/or a mix of Clean is more relevant in the mid and late game.  Not sure how hard that would be to put in either.  It's sort of doing the same thing as reducing the construction cost, but rather nerfing down Reactors by means of maintenance costs.

--

Also as an aside great work on the cost formulas.  I've been playing around with variants #2/#4 lately.  Obviously they take re-scaling of the base weapon/armor costs but it looks good.  Is it possible to make chassis cost the multiplier rather than a fixed 2x(land/sea) and 3x(air)?  Admittedly, this probably isn't that useful unless non-integer values can be put in.  2x/3x is a good default otherwise.

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #11 on: September 13, 2013, 07:40:07 PM »
To clarify myself/EM:
I think that meant that Clean went up in absolute cost as the game went on, whereas mineral cost is always fixed (1 mineral per unit).  Therefore the value of Clean gets diminished on more expensive units.  An early game unit costing 20 goes to 30, for a 10 turn break-even on investment.  A unit that costs 60 (later game/reactor), goes to 90 cost with Clean, for a 30 turn break-even.

So Clean could have a fixed cost (probably difficult to code in.  Or it could just be accepted that it's better on cheaper units.

An alternative way to somewhat balance out later reactors with Clean would be to make Fusion units cost 2 minerals per turn, Quantum 3 minerals per turn, and Singularity 4 minerals per turn.  This way the break-even time stays more constant.  As well then Support SE and/or a mix of Clean is more relevant in the mid and late game.  Not sure how hard that would be to put in either.  It's sort of doing the same thing as reducing the construction cost, but rather nerfing down Reactors by means of maintenance costs.

Giving Clean an absolute cost would not be all that difficult; it would be in addition to the usual ability cost, and then you could set the ability cost to zero.  It does seem somewhat awkward to me, though.

Increasing the support cost for higher-reactor units would also be definitely doable, and would make Support scale better as well.  It wouldn't scale all that well itself, though (as unit cost does not scale proportional to reactor), unless you change the unit cost formula to one that does scale pretty closely with reactor (which actually is worth doing for other reasons too; such considerations were what gave rise to this thread in the first place.)

Do you have a preference between the two?  Or would you rather make both be options?

Quote
Also as an aside great work on the cost formulas.  I've been playing around with variants #2/#4 lately.  Obviously they take re-scaling of the base weapon/armor costs but it looks good.  Is it possible to make chassis cost the multiplier rather than a fixed 2x(land/sea) and 3x(air)?

Yes; that would be yet another two formulas.  You want me to add them?  (If I do, also note that it won't be halved for infantry.)

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #12 on: September 13, 2013, 08:35:48 PM »
I agree - having Clean be the only modifier with an absolute cost is clunky and might introduce more bugs with dual-ability units.  What if support cost was based on the total unit cost as an end-around?  i.e. support per turn = ceiling[unit cost/40] or something of the like?  It might get complex to code though, as the game would have to prioritize the highest support cost units first to be free.  Ideally I suppose the game would exempt the top X costing units, then sum the cost of the rest, and divide by 40 (or some factor in alphax.txt) for the total maintenance per turn on the base.  For SUPPORT SE -4 and below, the maintenance would then just be doubled.

This is sort of another aside - the limitation of 1 unit a turn per base.  How easy/hard is this to change?  I assume fairly difficult...there are so much complexities with how bases make things as-is. Which maybe isn't a bad limitation, but later game units are often made in a single turn due to reactor cost reduction effects, and the later mineral facilities.  As far as military units go, higher armor/weapon costs&values are one way to go, but then that shifts things deeply to PSI units in the later game (as they have fixed cost).  But that does create some interesting counter-play which I'd have to look into.

The bigger impact to 1 unit per base/turn is that in the early-mid and on, a base always can make a crawler or former, and they're incredibly powerful throughout the entire game.  On the whole I think formers and crawlers are overpowered on their cost and tough to balance.  Early game that first former seems fine in cost, but churning out lots is really simple later on. If they had some sort of satellite-like limitation based on city size I think that would go a long way to balance.  One idea might be to make them cost more minerals based on how many total formers/crawlers you already have.  At least with how the game is now, the loss of formers/crawlers in a war tends to even outweigh the military losses - since you're pretty much restricted to a unit per base/turn.  It can take a long time to get them all back even if your mineral production is really good.



Isn't infantry basically straight costed in #2/#4?  The cost is multiplied by 2 then divided by 2 bringing you back to 1.  I think this model is only worth it as a replacement to #2/#4 if non-whole numbers can be put in for chassis multipliers.  For example, I could put in 1.5 for chassis cost on Rovers and they would cost 150% that of a Rover.  Another workaround if its an integer only field is 50 could correspond to a +50% cost multiplier?  I'm just looking at more customizability on a per-chassis basis, not a change to the formula.

Offline Yitzi

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #13 on: September 13, 2013, 09:57:02 PM »
I agree - having Clean be the only modifier with an absolute cost is clunky and might introduce more bugs with dual-ability units.  What if support cost was based on the total unit cost as an end-around?  i.e. support per turn = ceiling[unit cost/40] or something of the like?

I like that idea.  But it needn't be 40; that (or rather one-tenth that, so it's the number you divide the cost in rows by) could be settable by alphax, and if you set it equal to 255 that results in a constant cost of 1 (since no unit can cost more than 255 rows).

Quote
It might get complex to code though, as the game would have to prioritize the highest support cost units first to be free.

I don't think that would be so hard...it'd be a bit fancy (I haven't figured out exactly how to do it yet, by which I mean that I've figured out a way to do it but think I can do better), but nothing really problematic.  Probably easier than some stuff I've done already.

Quote
Ideally I suppose the game would exempt the top X costing units, then sum the cost of the rest, and divide by 40 (or some factor in alphax.txt) for the total maintenance per turn on the base.

No, as then 4 scout patrols would only cost 1 support, which is probably too low.  And the support icons would be a total mess...let's leave it at a full number for each unit.

Quote
This is sort of another aside - the limitation of 1 unit a turn per base.  How easy/hard is this to change?

Fairly easy, I think, though it'll still be fairly limiting unless you increase the amount of minerals that can carry over.  I think I'll add it as an option, though at the end of my list.  Or I might do it earlier, together with fixing the stockpile energy bug, if that proves easier.

Quote
Which maybe isn't a bad limitation, but later game units are often made in a single turn due to reactor cost reduction effects, and the later mineral facilities.  As far as military units go, higher armor/weapon costs&values are one way to go, but then that shifts things deeply to PSI units in the later game (as they have fixed cost).

So do the counters to PSI units, though...

Quote
The bigger impact to 1 unit per base/turn is that in the early-mid and on, a base always can make a crawler or former, and they're incredibly powerful throughout the entire game.  On the whole I think formers and crawlers are overpowered on their cost and tough to balance.  Early game that first former seems fine in cost, but churning out lots is really simple later on. If they had some sort of satellite-like limitation based on city size I think that would go a long way to balance.  One idea might be to make them cost more minerals based on how many total formers/crawlers you already have.  At least with how the game is now, the loss of formers/crawlers in a war tends to even outweigh the military losses - since you're pretty much restricted to a unit per base/turn.  It can take a long time to get them all back even if your mineral production is really good.

Things to think about...

Quote
Isn't infantry basically straight costed in #2/#4?  The cost is multiplied by 2 then divided by 2 bringing you back to 1.

Yes; with the proposed rules it wouldn't be divided by 2.

Quote
I think this model is only worth it as a replacement to #2/#4 if non-whole numbers can be put in for chassis multipliers.

That's so infeasible as to be effectively impossible...you could, however, reduce weapon and armor costs to compensate, and then assign infantry a cost more than 1.

Offline Nexii

Re: Unit cost formula: Alternate approaches (taking requests)
« Reply #14 on: September 14, 2013, 12:11:14 AM »
Good points.  Maintenance on a per-unit basis is probably best. 

Keep the #2/#4 modes as-is then.  I can balance things around ECM/AAA cost and power from there.

And yea, I think that's my only real remaining gripe is the former/crawler cost.  They're fine to start but should increase the more of them you have.  Other veteran players can weigh in but I find the whole 5+ formers and crawlers per base a bit tedious.  I feel there should be a bit more of a balance between investment in military, buildings, and non-combat units.

 

* 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

I saw the alien phalanx coming toward us, and I calmed my mind as Kri'lan had taught me. And what I saw next to the phalanx was a shadow regiment, half-formed from the resonance around them. I cursed the aliens... with power like that, each one could fight as many, and I thanked Planet for sending us the betrayer.
~Prophet Cha Dawn 'The Betrayer and I'

* 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: 47 - 1280KB. (show)
Queries used: 41.

[Show Queries]