My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum

LinkBack Thread Tools Display Modes
February 28th, 2012, 01:14 PM   #1
Joined: Feb 2012

Posts: 1
Thanks: 0

Fun with visually graphing video game stats

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 suck 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 :P

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

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.
Apothem is offline  
August 11th, 2012, 09:36 PM   #2
Senior Member
Joined: Aug 2012

Posts: 229
Thanks: 3

Re: Fun with visually graphing video game stats

Hey Apothem.

If you want to generate an explicit form of the formula (if it's possible), then you should look at something called difference equations: Difference equations work in exactly the same way and if there is a technique to do this, then it's bound to be in difference equations.

For your example though, this is a lot easier since your terms are basically of the form next term = oldterm * (1 + c) where c is independent of next term and old term and is considered a constant.

This is basically a geometric series, and it has a very well known solution:

Basically your c value is all the stuff inside the brackets that is multiplied by "old-term" and in the Wiki page, this corresponds to the "a" term in Wikipedia and the "r" term is the value of the first result.
chiro is offline  
August 11th, 2012, 09:45 PM   #3
Global Moderator
CRGreathouse's Avatar
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Fun with visually graphing video game stats

I think the formula is wrong, since it gives nextlevel < thislevelxplimit when thislevelxplimit, currentlevel, and difficultymodifier are positive (as in your example).
CRGreathouse is offline  
August 11th, 2012, 09:49 PM   #4
Senior Member
Joined: Aug 2012

Posts: 229
Thanks: 3

Re: Fun with visually graphing video game stats

It might help if the OP just gives only the formulas and constraints in one quick short post to alleviate the confusion: I was just looking at the formulas, and if they have hidden or complex constraints or dependencies, then I would have missed them.
chiro is offline  

  My Math Forum > Science Forums > Computer Science

fun, game, graphing, stats, video, visually

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me visually organize all these differential eqn types.. Niko Bellic Differential Equations 0 July 7th, 2013 01:39 AM
Analyzing a game for fairness? (game theory question) musicgold Economics 0 March 14th, 2012 08:04 PM
Suggestions for teaching high school calculus visually? Stevenx514 Calculus 1 September 2nd, 2011 09:11 AM
BASIC VIDEO GAME MATH!! Nukka-D Computer Science 6 June 22nd, 2011 08:06 PM
Stumped off a video game oldman321 Algebra 1 March 6th, 2008 11:35 AM

Copyright © 2019 My Math Forum. All rights reserved.