Math Is Fun Forum

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

You are not logged in.

#1 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-03-10 12:10:49

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.

#2 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 13:30:44

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.

#3 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 12:47:47

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

#4 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 10:41:58

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.

#5 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 10:19:15

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.

#6 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 10:05:37

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?

#7 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 09:52:08

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.

#8 Re: Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 09:32:38

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:

#9 Help Me ! » Fun with drawing lines on statistical graphs using video games » 2012-02-28 08:51:02

Apothem
Replies: 17

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.

#10 Re: Help Me ! » fun with two points on a graph » 2010-11-09 04:14:14

Okay well it sorta works. Right now I'm having issues with C. Basically it keeps coming up as 0. If I just make step 3 c = d-512, it works. Doing (d-512)/d doesnt work for some reason, I'll post the code here because it's literally what you posted above.

When I take out the /d the object moves in the correct direction, and it does do what it's supposed to, but just really slowly. If point C is far enough away, it starts to quickly travel, but only when the total distance is above like 1024 or so.

Oh and thank you again for your patience and your knowledge, it has been EXTREMELY helpful.


EDIT: NEVERMIND I GOT IT. Turns out I had to used some fixed point division as well as multiplication. The language I'm working with makes a distinction between fixed point numbers and integers. The coordinates are fixed point numbers so when you're working with distance which is returned as an integer, it throws the whole thing off.

Thank you very very much for your help!!!! big_smile

#11 Re: Help Me ! » fun with two points on a graph » 2010-11-08 18:20:34

in part 3) you have there, what is D? Total distance?

#12 Re: Help Me ! » fun with two points on a graph » 2010-11-08 12:16:12

bobbym wrote:

But you will not need it for this problem. There is a much easier way.

I fail to see what you mean. Could you enlighten me? wink

I figured I could just apply the slope of the line to the coordenates based off of the difference between the current distance and the desired distance, but clearly it was never that simple. Unless that IS it and I just REALLY dont know what I'm doing.

I am incredibly rusty when it comes to this type of math, so I may need to reteach myself a good bit.

#13 Re: Help Me ! » fun with two points on a graph » 2010-11-08 03:45:27

Oh noes, I think the last time I touched quadratics musta been about 6 years ago. I'm crazy rusty on how to solve those, are there any reference materials I can teach myself that list again?

#14 Re: Help Me ! » fun with two points on a graph » 2010-11-07 10:53:24

okay, I made a diagram. I hope my mad MSPAINT skillz will be able to clarify. If not, or the diagram makes no sense, I'll just keep trying until either you guys get it or the thread hits 2 pages. tongue

diagram1.PNG

Okay, so let's give this another go. Basically the goal is to keep the above line segment from reaching anything above a maximum size of 512. So what I'm portraying in this diagram is basically when the line is too big. The distance between line segment BC is the distance A has to travel towards C on the already determined line ABC. The coordinates of A and C are known and the distance of line segment AC is known.

What I'm trying to do in game is the equivalent the cursor in a strategy game such as Starcraft. Point A is basically the coordenates of what your perspective is in the game, and point C is the cursor. As the cursor (point C) moves around it will eventually reach an outer edge. You can detect the distance of that via a center focal point being Point A basically.

As I've been writing this I believe I'm basically trying to understand how to apply slope to the coordinates of a single object. Since I'm basically programming it in, I need to be able to apply it to the x and y separately.

I hope that clears things up a bit, I'll keep trying 'till I get it.

#15 Re: Help Me ! » fun with two points on a graph » 2010-11-06 10:08:21

Well it's more programming related, but the code side of it is figured out. Basically I have a center point which is the focal point for the camera, and then a cursor that you manipulate with the mouse. Whenever the cursor goes outside a certain range, it's supposed to drag the center point along with it in the direction of the cursor.

I figured I could use a slope formula for this and just translate the focal point towards the cursor. That's what I meant by always having the x and y coordinates of both points. It's just that one point is outside the range I want it and I'm more pulling one point closer to the other.

I hope that clears things up, I'll keep trying to figure out a way to explain this until I get it right.

#16 Re: Help Me ! » fun with two points on a graph » 2010-11-06 08:56:40

okay let's try this again. I think I've found a better way to describe what I'm trying to do.

I've got the coordinates of two points on a graph, and I want to find a point between the two. How do I find a point in the line segment?

#17 Help Me ! » fun with two points on a graph » 2010-11-06 06:39:33

Apothem
Replies: 18

I'm trying to calculate coordenates between two points on a graph on the XY plane in a programming project I'm working on. Basically when object B is a certain distance from object A, object A will follow a line that is directly related to the angle (or slope) of said line until it meets the maximum distance again. I already have the code figured out, I just cant remember how to calculate out the coordenates. I think I'm supposed to be using slope for this, but I dont know how to apply it over a distance, nor do I know how to actually properly get the slope between two points using only numbers with no graph.

The main goal here is to find the formula for calculating points on a predetermined line between two sets of coordenates.

Forgive me if I'm not being descriptive enough, I've never really tried asking on a forum for help on this topic before.

Board footer

Powered by FluxBB