Search Unity

Graphing and Game Design

Discussion in 'Game Design' started by LMan, Oct 26, 2015.

  1. LMan

    LMan

    Joined:
    Jun 1, 2013
    Posts:
    493
    I'm not great at math. I can see relationships between things and pick up on what makes systems act a certain way, and I'm very analytical by nature- but mathematical expressions always drove me bonkers with frustration. All discussions about the shortfalls of mathematics educational material aside, I've been tinkering with graphing curves to get a picture on how my RPG type stat system scales over time, and I've hit upon an expression that I think will work.



    The X axis is the level of the character, the Y axis is the Attack stat for that level. If I knew how to limit the graph to just positive numbers, I would do that, but as it is, I just ignore the negative half of the parabola.

    Y= (X^2 /S) + B

    S
    controls the severity of the slope, the less the value of S, the steeper the slope. So a warrior class would use an S value of .6 or so, as he would gain more Attack per level than other classes.

    B stands for the base value of that stat for the class. At a hypothetical "level 0" the attack stat might start with 12, so that the curve returns a more reasonable stat for early levels.

    I know this is high school level stuff, but I'm curious, does anybody else use mathematical expressions to model how their systems work over time? Are graphs a part of your design method?
     
    Last edited: Oct 26, 2015
    Gigiwoo likes this.
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Sure, I do this sort of thing all the time!
     
    Gigiwoo and LMan like this.
  3. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    That sounds really steep. The growth rate being 2X/S just seems like it's going to be murder for anything a couple levels lower. I suppose it's going to depend on the damage equation, but it seems like the level is going to be the biggest factor.

    I don't typically model too much (I don't get around to that point). I'll pop in an equation I'm working on to make sure it's accurate, but that's about the extent of it. I just don't typically find it fruitful to monkey around with them for long.
     
    Gigiwoo and LMan like this.
  4. LMan

    LMan

    Joined:
    Jun 1, 2013
    Posts:
    493
    I actually hadn't thought of that yet- I'm still floundering around when it comes to interpreting what an expression puts in front of my face.
     
  5. michal_k

    michal_k

    Joined:
    Jul 31, 2014
    Posts:
    33
    I'd would also like to use such thing but only if there was an integrated solution... Making up formulas and transferring them into C#, then tinkering, updating again seems to be too cumbersome for me.

    For simple "Level up" formula I've just made an Excel sheet with points range at some rate, and tested it there before putting into C# code...

    EDIT: Nevertheless, it's a very nice tool you have found and might be quite useful. It would be great if there was a tool that would automatically convert equation in C/C# notation :p
     
  6. Dennis_eA

    Dennis_eA

    Joined:
    Jan 17, 2011
    Posts:
    380
    I also want to add that AnimationCurves are absolutely nice to work with, when you need something else than += Time.deltaTime or standard lerp,slerp etc
     
    Kiwasi and LMan like this.
  7. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    There are a lot of different ways to do stat increases. I've done some pretty serious research into different ways of doing it. In many cases, I don't think that it's actually particularly important how the base stats work so much (in single player games). Far more important from the players perspective (at least in terms of RPGs) is how the ability selection works. Seeing their attack stat go up is cool, but it's the special abilities that really make a player feel they're moving.

    Most games that feature very steep stat curves are either JRPGs or Diablo. The result in the case of diablo includes having stat numbers that rise from single digits into the millions by level 50.

    I personally think that in terms of power level growth, what feels best is a kind of flat, spike, flat, spike, flat, spike, approach rather than a smooth curve. As a player, you don't really notice smooth incremental increases, but you do notice spikes. In terms of JRPGs, you can see this kind of system in Vandal Hearts - where there are only something like 6-8 equipment upgrades total. Reaching each equipment upgrade feels very significant.

    When I was originally modelling my equipment upgrade system, I used a 'tier' system. There were basically 4 major tiers, each of which had 3 minor tiers. This was based roughly off of Wasteland 2's loot tables (although I'm sure hundreds of other games use a similar approach). Hitting a new minor tier would give you a slight boost, but hitting a major tier would give you a more significant one.

    I found the tier system to be a very good approach, because it also lets you build an idea of enemy strength at each point, and it gives you a 'word' to use to describe how strong things should be at a given point in the game. "There is too much difficulty spike when the player hits Tier 2B". You can say the same kind of thing about levels, but having strict tiers just makes it a little easier to think about as a whole, or move different bits around.

    My game also had a lot of random generation, so it was harder to reason about difficulty progression since there werent content landmarks.

    EDIT:
    Finally, in terms of just using an exponential growth curve. The reality is that a similar curve will appear any time you're using any kind of compounding - as in the long run any kind of compounding growth will look exponential.

    So if the stat growth rate increases relative to each step before it, then your stat curve will be exponential in the long run, even if you're using a small multiplier instead of strict powers.

    The golden ratio is a nice example of compounding growth without using explicit exponents (like x squared).



    I used this as the basis for my equipment gold costs. You can build the golden ratio by either adding the two previous numbers, or a rough estimate by multiplying the current number by ~1.61.

    5 + 8 = 13
    8 * 1.61 = 12.88

    8+ 13 = 21
    13 * 1.61 = 20.93

    etc...

    Given the difficulty that most games have in organizing equipment and difficulty in general, my guess is that using a strict equation is not going to be very useful in general as anything other than a rough jumping off point.
     
    Last edited: Oct 26, 2015
    Gigiwoo, LMan and JoeStrout like this.
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I frequently go the other way. As in I designed a tool for extracting actual game data and plotting it on a curve.

    In general math terms a polynomial is a good choice. Its relatively easy to manage and check that the system is balanced.
     
    LMan likes this.
  9. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Gigiwoo and LMan like this.
  10. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Consider using a spreadsheet. For prototypes, I start with a math equation (mostly linear, as opposed to quadratic). Then, I usually end up in spreadsheets. The reason is that it's REALLY difficult to balance all the things you want in your game using one, simple equation. For instance, in your example, your warrior will have gear. He'll have buffs, special skills, and debuffs from the monsters. The mobs will also have stats that grow.

    Pretty soon, one equation ain't gonna cut it. Whereas, you could have gotten pretty far with a 'relative' power scale, per level, listed in a spreadsheet.

    Gigi

    PS - The golden ratio (1.618) rocks, from a human perspective.
     
    LMan and Kiwasi like this.
  11. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,013
    I try use mathematical expressions when I can, even if it means simplifying something a little more than it should be. But when you have to slice out domains so that you can apply different functions for different situations you need something better. Animator curves are great for these situations.
     
    LMan and Kiwasi like this.