I need a math genius!

0 favourites
  • 4 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
  • No, not really a genius. I'm so bad at maths anyone could probably help me out.

    There is some kind of diminishing return pattern I want to use for my game, but I can't figure out the formula for it. Without a formula I'd have to use a long array of values for my variables to match up with. I can do that instead, but I'm curious if there is a formula exist for this kind of pattern.

    It goes something like this: 100% -> 50% -> 33% -> 25%-> 18%-> 14%, and so on. The pattern pictures some kind of a declining curve graph in my mind, but I just can't remember any terminology related to that sort of mathematics to google it in the first place.

  • I'd say try out y = (1/x+1) * 100. With an input of 0 'steps' you will get an output of 100, with input of 1 you will get 50, 2 gives you 33, 3 gives you 25, just as you asked.

    See the graph here.

  • One way to go about it is to look up graphs of various formulas and see which most closely matches the shape of a plot of your numbers. Then you could then use some sort of regression to find a formula for it.

    In this case a little bit of intuition helped me find the formula. The more you do the easier it gets.

    formula:

    (1-n/(n+1))*100

    where n is the nth number (0 for the first)

    Edit: ninja'd with a simplified formula.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you guys. Never have thought I'd be interested in maths one day.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)