Sign in to follow this  
Chumad

Diminishing returns on planetary production

Recommended Posts

I've got a game where the players get planets. Each planet produces resources. I need a way to reduce the amount of resources on a the total amount produced such that each planet produces slightly less than the one before. I know I could do this on a planet-by-planet basis - for example: Amt = Planet1Production Amt = Amt + (Planet2Production * 99%) Amt = Amt + (Planet3Production * 98%) However, because of game restrictions, what I'd really like is a single equation/function that would let me pass in the total at 100% and the number of planets and figure it out that way. Anyone have some tips on such an equation?

Share this post


Link to post
Share on other sites
FYI: This is what I'm currently using - it seems to work out. The idea is that it reduces the amt produces on a whole.

Production = Production * (-10.6*LOG10(PlanetCount)+100) / 100

Anything better out there?

Share this post


Link to post
Share on other sites
The best way is probably whatever fits the best with your game. When trying to work out mechanics like this, sometimes I use a graphing calculator (or software, such as graphcalc, or maybe wolfram), and plug in various functions to visually see the curve. Or I'll write up a quick spreadsheet to generate a table within an expected range, and see if it 'feels' right. Usually I try to simplify things as much as possible, and keep any constants used in equations as variables that can be easily tweaked later on when balancing play.

Unless you're asking for some 'realistic' economical model, in which case, just ignore me...

Share this post


Link to post
Share on other sites
Whatever works, right? If you're happy with what you have, that's the end of it.

In terms of general principles, it really seems like any function 'f' which is,
1 - Monotonically increasing (i.e., has positive first derivative)
2 - Concave down (i.e., has negative second derivative)
and maybe satisfying,
3 - f(0) = 0
should do the trick. Just let

Production = f(Planet1Production + Planet2Production + Planet3Production + ...)

where f is any such function. E.g.,

1 - f(x) = A [ 1 - exp(-x/tau) ]
where A is the maximum value f can take and tau is the "time constant."

2 - f(x) = log(x+1)
which does not approach a supremum, unlike the saturating exponential given as #1

3 - f(x) = x/(1 + x)
which approaches f(x)=1 as x-->infty

4 - etc, etc, etc...

As for, "which curves might be theoretically justifiable?" Well, #1 arises as the solution to many, many differential equations, so it pops up all the time. Another theoretically-justifiable answer might be to use a logistic function somehow, as this models population growth (however, it is not concave down; for small populations, increasing population size gives increasing returns).

Finally, I should note that the function you're using might not behave exactly as you like, since

g(x) = x (-a log(x) + b)

actually is not monotonically increasing; in fact it has a maximum after which it decreases... which I think for your application would mean that there's a certain number of planets after which it actually hurts you to get another planet.

Anyway, as laztrezort said, just graph these things and see what they look like.

Share this post


Link to post
Share on other sites
Your first two posts (especially the first one with its percentages) indicate to me that you want to multiply each planet's production by a value in the range (0, 1], depending on the total number of planets the player has. The simplest function that comes to mind is:

f(N) = e-A(N-1)

Where 'A' is a positive constant you can adjust depending on how quickly you want production to diminish, and 'N' it the total number of planets. Notice that f(1) = 1, meaning that when you only have a single planet its production isn't affected, however as N increases the production of each planet diminishes (but never reaches 0). Just multiply f(N) by each planet's production.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
The simplest function that comes to mind is:

f(N) = e-A(N-1)


Assuming that each planet produces 'k' things (so the unadjusted production is N k), then the total production with this function is,

p(N) = k N exp(-A(N-1))

which has a maximum at

N = 1/A .

Is this what you want? Say A=1/10. This would mean that not only does the move from 10 planets to 11 not help as much as the move from 9 to 10, but in fact it hurts you; you're making less money if you have 11 planets than if you have 10. Is this what you want?

Now, I know that each planet does not have identical production 'k.' The point here is simply to demonstrate that with this choice your production will not be monotonically increasing in the number of planets.

This is the same problem -- if it is a problem -- that your "multiply by log" function has.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this