Author Topic: cost increase with unit amount  (Read 2700 times)

Zoythrus

  • Guest
cost increase with unit amount
« on: 15 January 2012, 06:44:37 »
ok, here's something that i desperately need for Constellus, and that's the ability to increase the cost of a unit/structure based upon the amount of that unit present. e.g. you build unit A for 50 gold, the next unit A would cost you 75 gold, then the next 100 gold, etc. this need to either be a multiplier or static, like all other things.

also, as a small bonus, it'd be nice if we could have a way to control how much the cost goes down if one unit is killed. like, unit A could have a 30% cost increase, but losing it would only decrease the cost by 15%, so it encourages keeping those units alive (because you're not fully refunded).

would cant be too hard for an experienced C++ coder to code....

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: cost increase with unit amount
« Reply #1 on: 15 January 2012, 19:32:35 »
And to try and expand this idea a little, it'd be best if there were ways to increase either statically (a set number, such as making each unit cost 10 more gold than the last) or by a multiplier (that is, a percentage, such as each being 5% more expensive). This code would be used on the unit tags of either morph, produce, transform, or build commands. Of course, there is one slight issue: we have to be able to raise only certain resources, not all (after all, we don't want to require an additional 50 gold and food, as the latter would be rediculous).

Multiplier:
Code: [Select]
<produced-unit name="worker">
<resource name="gold" cost-multiplier="1.1"  loss-multiplier="0.95" />
</produced-unit>
In this case here, for a single produce command, we produce a worker that costs 10% more gold with each additional worker we produce, and the cost reduces 5% with each worker that dies. This system is versatile, so you could even have the unit cost more when they die, to the modder's discreation. Missing either of the tags defaults to 1 for multipliers.

Static modifier:
Code: [Select]
<produced-unit name="worker">
<resource name="gold" cost-modifier="10" loss-modifier="-10" />
</produced-unit>
With nearly the same syntax as for multipliers, modifiers affect a static amount, a real number, such as in this case, making the worker cost 10 more gold for each one produced, and reducing the price by 10 gold for each worker that dies. If a modifier attribute is excluded, it defaults to zero.

I think that covers what Zoy is requesting, but with examples of how it would work for modders.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Zoythrus

  • Guest
Re: cost increase with unit amount
« Reply #2 on: 15 January 2012, 20:54:35 »
thank you, Omega, for clarifying. it was like, 11pm when i wrote that, so i was kinda tired....

Zoythrus

  • Guest
Re: cost increase with unit amount
« Reply #3 on: 15 May 2012, 00:22:52 »
ok, here's something that i desperately need for Constellus, and that's the ability to increase the cost of a unit/structure based upon the amount of that unit present. e.g. you build unit A for 50 gold, the next unit A would cost you 75 gold, then the next 100 gold, etc. this need to either be a multiplier or static, like all other things.

also, as a small bonus, it'd be nice if we could have a way to control how much the cost goes down if one unit is killed. like, unit A could have a 30% cost increase, but losing it would only decrease the cost by 15%, so it encourages keeping those units alive (because you're not fully refunded).

would cant be too hard for an experienced C++ coder to code....

Do you still need this? I was actually wanting this too. I think that if I add 2 new variables a static and a percent multiplier which you could modify and put those into the unit cost part of the code it should be pretty simple to get done. And you should be able to modify them up and down with upgrades.

well, any feature that could be made is needed, and i think that this adds a nice little mechanic to it all

 

anything