Results 1 to 2 of 2

Thread: Gains over time

  1. #1
    Mar 2009

    Gains over time

    I'll try to explain as thoroughly as possible.

    A user gains 1000 population per hour, that is broken down to 0.27 population per second (1000/3600), if X time has passed since the update then the population gain is X*0.27 and then capped at the maximum capacity that a user can have.

    The problem is when I want to calculate the gold gain, the gain is dependant on the population and in which the user will gain 1 gold per population that they have per hour. So if they have 1000 population they will gain 1000 population per hour. However to do it the same as above is not accurate and it doesn't take into consideration the gains over time.


    Population gain:
    GainPerHour = 1000;
    GainPerSecond = GainPerHour / 3600;
    ActualGain = TimeDiffInSeconds * GainPerSec;
    Population = Population + ActualGain;

    I did the same for gold gain without realising how inaccurate it was, and I have no idea at all how to make it accurate without placing it within a loop for each second and calculating it on a per second basis, which would be far too slow.

    One possible solution I think is to do the above for gold but with the OLD population value from before i was updated, and then a formula to work out the gain from what population was added, but with the capacity things that too could become complex. For example if 5000 seconds have passed but the user would have capped their population at 1000 seconds, it would need to take that into consideration for the actual gold gain.

    I'm totally confused and lost at how to do this, any help is very much appreciated. I just hope you guys can make sense out of this..
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Mar 2009
    After more research and asking about, I've learnt that this will use a series equation..

    That's as much progress as I've managed to make so far on this.

    But to try and make it easier to understand what I have to do i'll try another example.

    Say the user gains 1 population per second, the gold income that he would have would be the case of over the course of seconds...

    1+2+3+4+5 up to the capacity of the population, so if it capped at 5 population over what was currently there then it would continue as 5+5+5+5 etc up to the end of the range.

    I'm so terrible at trying to put things into explainations, so I really hope that this part with the first post makes more sense!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: Dec 19th 2011, 03:27 PM
  2. Replies: 3
    Last Post: Dec 6th 2010, 02:52 AM
  3. Replies: 4
    Last Post: Jul 21st 2010, 12:53 AM
  4. Working out welfar gains and losses from graph
    Posted in the Business Math Forum
    Replies: 0
    Last Post: Oct 27th 2009, 03:28 PM
  5. Increasing gains in diminishing returns
    Posted in the Calculus Forum
    Replies: 3
    Last Post: Oct 25th 2009, 09:16 AM

Search Tags

/mathhelpforum @mathhelpforum