Find User here you can look for a user

New decay formula proposal

Hi, following this:

And since I had some spare time, I attempted to create a new formula for the decay. 3 considerations:
  • I wanted something that would decay faster with higher numbers, and slower for lower amounts. Something exponential with the excess amount.
  • Of course, "high" number is relative. So the formula shouldn't take as argument the absolute resources stored, but rather the excess ratio = amount you have/amount you can store (eg if you have 9M over 1M storage, you have an excess of 9).
  • Finally, our formula can't decay according to time. We can't just have something looking like Ae^(-Bt), because we don't have time memory of the previous amount.

Here is what I came up with:

v(n+1)=v(n)*exp(-v(n)/90000), v(n+1)=amount after one iteration of decay

Of course, since this tends towards zero, you need to cap it so it doesn't go below 1.

This is what your resource curve will look like if it doesn't do anything other than decay, and if you have an excess ratio of 9 (9M over 1M storage).
The decay will stop after 44 minutes.

Excess ratio of 1.5, decay in 15 minutes.

44 minutes may still be too much, you just have to play with the C=90000 constant.
Click to expand section.

import matplotlib.pyplot as plt
import math
import numpy as np

def v(u):
return u*math.exp(-u/90000)

points = 1800*30
x = np.linspace(0, points+1, points)
y = []
y.append(1.5) # we have 10 units over 1 unit storage (unit=million/billion/trillion)
found_y = False
for k in range(1, len(x)):
if y[k]<1:
y[k] = 1
if not found_y:
found_y = k

print('Last value', y[-1], 'reached after', round(found_y/30/60,1), 'minutes')
plt.plot(x, y)
plt.xlabel('ticks (30 per second) (0h30 here)')
Which you can execute here

(yes, I had fun making this)
Creator of Coloniae
Admin of the MC2 translation project
My Colony

Ape Apps, LLC is an independent software development company founded in 2010 by Brandon Stecklein. Over the years, Ape Apps has published over 400 apps and games across various platforms. You can get in touch with Brandon on Twitter or by leaving a post on his wall @bastecklein
App of the Day