Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2012-02-28 08:51:02

Apothem
Member
Registered: 2010-11-06
Posts: 17

Fun with drawing lines on statistical graphs using video games

Hello again! It's been a while since I've posted here, but I figured this would be the best place to get the information I needed. However, like always, I kinda drag at explaining what I'm trying to do. So bear with me, as it may take me a few tries to successfully explain what I'm trying to do. Trying to translate what I'm doing in my code to just full on math can be tricky at times tongue

I am attempting to graph out some of my formulas for a game I'm trying to make, but I dont know exactly how to write them into something like my graphing calculator. I want to focus on making certain types of slopes and curves on the line being drawn as the base value (or player level) is increased.

A base example for us to use will be the following formula I use for experience gain:
   
nextlevel = thislevelxplimit + (thislevelxplimit * ((currentlevel)/75 - ((currentlevel / 5) + difficultymodifier) ));

Okay so I know this looks horribly confusing, but I will explain the variables and what is going on inside here. I'm going to explain each variable and how they fit together, and then try to make it more numbers looking wink

To start off with I'm going to explain what player stats we are going to be playing with today, and their starting values.

These are:
CurrentLevel = The current level of the player. This is incremented by one every time the NextLevel xp value is reached. This value starts at 1.
CurrentExperience = The current collected XP of the player. This starts at 0. When ever the player's CurrentLevel is incremented this is set to 0.
TotalExperience = The total experience collected by the player. Whenever a value is added to current experience, this also recieves that value. Basically is just something to keep track of how much overall XP the player is going to need to get to X level. This also starts at 0 just like CurrentExperience.
NextLevel = The amount of CurrentExperience the player needs to have the CurrentLevel increment by 1. This value starts at 150.

Difficulty modifier = A number set in the game to modify how much experience you would gain based upon how hard it was. The higher it is, the harder the skill level. For this example, always assume that this value is 1.0 for now.

The idea here is to draw a line on a graph that would represent the value of NextLevel upon each iteration of CurrentLevel. So if you look at the example formula again (which I'll copy paste here for the sake of while I'm writing this):

nextlevel = thislevelxplimit + (thislevelxplimit * ((currentlevel)/75 - ((currentlevel / 5) + difficultymodifier) ));

As you can see, each time I calculate the next level's XP requirement, the newly acquired value is added on to the old nextlevel value to create a new value. This would be considered an iteration. At the time of which each level is reached, TotalExperience should be equal to or greater than the current NextLevel experience requirement.

So let's fill in the formula with the base values listed above, so we can make it easier to read:

nextlevel = 150 + (150 * ((1)/75 - ((1 / 5) + 1.0) ));

So my question is this: How do I go about graphing this on, say, a graphing calculator? As in, see each value for nextlevel as currentlevel increases?


PS: I understand this is very long winded, and may be hard to understand. Please just work with me and I'll try to answer your questions as best as I can. Also I have some other questions about graphing these lines, but I want to see the responses to this thread first before I start posting anything else. Just so I can better phrase and ask my later questions.

Offline

#2 2012-02-28 09:09:20

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Hi Apothem;

First, remember that a graphing calculator can only graph the relationship between 3 variables or 2 variables.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2012-02-28 09:32:38

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

If that is the case, then I am looking at the relationship between the value of nextlevel and currentlevel. More than anything else, even just having the ability to plot the point on a graph, I can do the rest with some form or another of code to make the graph. The goal is to take this formula and make it equate out to something like my mspaint drawing below:

Last edited by Apothem (2012-02-28 09:33:04)

Offline

#4 2012-02-28 09:34:44

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Then you will have to call everything else a constant. That means finding a fixed numerical value.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#5 2012-02-28 09:52:08

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Hmmm, I think I have that already figured out. I think I just explained this wrong, so I'm going to attempt to put this into another form.
To start all my formula is trying to do is take the base value of 150, add a percentage based upon the level. The new value that you would get out of the 150 would be the next value that you would use to add the next value of percentage onto it.


think of Y as the current level, and X as the value of the nextlevel

X + (X*(Y/100)) = next data point.

And I'm basically trying to get the value I'm calculating here to either show up as a point on a graph or a line so I can look at the relationship of all calculated values.

Last edited by Apothem (2012-02-28 09:52:52)

Offline

#6 2012-02-28 10:01:56

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

If X and Y are to two variables that you want to plot then you need a 3D grapher.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#7 2012-02-28 10:05:37

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Ah i see, any suggestions as to a good online one I could use for this kind of stuff?

EDIT: It also seems I have no idea how to read/use one of these. Any place I can learn more about translating my function into a formula that the 3D grapher can use?

Last edited by Apothem (2012-02-28 10:07:51)

Offline

#8 2012-02-28 10:12:45

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

There are good 3D graphers out there I am sure and they come with documentation. Perhaps we can squeeze a little bit more out of a 2D representation. Hold on while I try to graph your function in 3D.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#9 2012-02-28 10:19:15

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Another thing to point out is that the usage of currentlevel is under the assumption that it is constantly going up by ONLY one each time we try to find the value of nextlevel. It's being used to calculate how much of a percentage to add to NextLevel.

Offline

#10 2012-02-28 10:24:52

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Hi;

This it the graph of your function

Z = X + (X*(Y/100))

As you can see it is a surface not a line. A line is of the form

y = (something) times x + something.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#11 2012-02-28 10:41:58

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Okay, so at this point, what I'm trying to figure out is how to manipulate the shape of that graph. I want the slope of it to get steeper as the value of the current level goes up. How would I accomplish this? (As in making the value between each change in Z larger or smaller?


The other thing I can do is actually generate the constant values for each level and put them in a table and plot the points where x would equal the level and y would be the next level value. Would that better fit into what I am doing here?

EDIT: In some respects, I'm trying to draw a line based off of the values that these 3D graphs would represent.

Last edited by Apothem (2012-02-28 10:48:35)

Offline

#12 2012-02-28 10:56:59

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Hi Apothem;

What are values you expect X and Y to take?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#13 2012-02-28 12:47:47

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

x would be nextlevel xp.
y would increment by one each time and would represent the current level.

Offline

#14 2012-02-28 12:59:41

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Hi;

So y goes from 0 to say 10. With the same for x?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#15 2012-02-28 13:30:44

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Hmmm, I would more say like y would start at 1 and go to 10. Then x would be something like (150 * (y/100)). But, no, X would not also increment from 1 to 10 like y.

EDIT: I get the feeling that me brushing up on linear algebra would help me a bit. I'm gonna do some googling and figure out some more stuff.

Last edited by Apothem (2012-02-28 13:33:01)

Offline

#16 2012-02-28 14:14:48

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

HI;

Okay, see you then.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#17 2012-03-10 12:10:49

Apothem
Member
Registered: 2010-11-06
Posts: 17

Re: Fun with drawing lines on statistical graphs using video games

Okay, So I figured out why what I was explaining made no sense. IT's because you CANT draw a line with the type of data im trying to produce. Basically the type of statistical graph I meant to try and make was something like the following:

XPtoLevel.png


Which, as you can tell, isnt exactly a line graph. I started laughing at my self because of the fact I didnt think of showing a graph like this sooner. From the looks of things, I dont know how one would express this as a math formula and still have it output on a screen correctly without either tediously making an excel file or doing some programmer tricks. I dont know what kind of tools I would use to produce this type of data easily to be visualized.

I figured I'd clairify here in case anyone was wondering what the hell was actually going on. I guess I would more say that I already have the formula for producing all the numbers, I would almost want to call it a function that I want to visualize.

If you happen to have any ideas on what to read up on or where to go from here to learn more about this particular piece, it'd be much appreciated.

Offline

#18 2012-03-10 21:11:58

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Fun with drawing lines on statistical graphs using video games

Hi Apothem;

You could try a piecewise function.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB