views:

190

answers:

5

I'm creating a game where players can make an alloy. To make it less predictable and more interesting, I thought that the durability and hardness of an alloy should not be calculated by a simple formula, because it will be extremely easy to find extrema, where alloy have best statistics.

So the questions is, is there any formula for a function where extrema can be found only by investigating all points? Input values will be in percents: 0.0%-100.0%. I think it should look like this: half sound wave

A: 

Modulating a simple linear or exponential function with trigonometric functions whose frequency and amplitude are dependent on the input should get you what you want.

Ignacio Vazquez-Abrams
+4  A: 

A very simple way would be a couple of sin function, just vary the constants and the sign for each new player. Here is one example (sin(1.1*x) + sin(x) + sin(0.9 *x))^2 alt text
If you use this between 10pi and 20pi you have an by average increasing function with local minima.

Nifle
You might want to multiply this by an envelope (possibly a polynomial with irregularly spaced peaks) to get a more interesting overall spectrum, after you fiddle with the frequencies to get the kind of beat spacing you want.
Jefromi
A: 

An interesting formula to use would be that of gamma of the Black-Scholes options pricing model. It goes as follows:

alt text
alt text
alt text
alt text

You can easily replace the variables, here's a graph of how the fuction looks:

alt text

ast4
It's a lovely rendition, and some beautiful equations, but I'd be more in favor of a model based on material science and physics rather than one for financial instruments. A viscoplastic material model like Chaboche or Walker would be far better suited. Even a made-up function would be better than one based on options pricing.
duffymo
A: 
AVB
A: 

If you want something that is very hard to predict then I would suggest involving a random number generator with the same seed every time. You can use it as an envelope for whatever function you come up with (trig functions or what not) to make it more jagged.

Justin Peel