KillerMovies - Movies That Matter!

REGISTER HERE TO JOIN IN! - It's easy and it's free!
Home » Misc » Computer / Video Games Discussion » Game Math.

Game Math.
Started by: dadudemon

Forum Jump:
Post New Thread    Post A Reply
Pages (7): [1] 2 3 » ... Last »   Last Thread   Next Thread
Author
Thread
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

Game Math.

Use this thread for various math that occurs in a game. Instead of 50 different threads, I figure one thread is better.








Question: in a game where you purchase items and the value of the item increments by a certain value every time you purchase it, what is the explicit formula for determining this?


For example:

Items starts at $10.

You want to buy 10 of them.

It increments by $5 every time you purchase one.

What is the total amount of money that you will need to purchase 10 at once?

$10*5 + ((10 * $5) * 5) + 5 *5 = $325
Is that the right formula?

Let's check:

10+15+20+25+30+35+40+45+50+55 = 325


It might be.

Sum up the formula:

(Iv * t/2) + (t * i) * i) + (t/2 * i) = Fv

Iv = initial value
t = times the item purchased (we wanted 10, in the xample)
i = the amount the item increments with each purchase
Fv = final value after the purchase is complete



I know this is a lot of math but this keeps on bothering me and a recursive formula is far too easy to make but difficult to just randomly employ. I need an explicit one so I don't have to keep track of previous values. I don't think the above is correct.

Replace with other items to test:

Iv = 20
i = 10
t = 15

Fv = (20 * 15/2) + (15 * 10) * 10) + (15/2 * 10)

Fv = 1725

Check:

20 + 35 + 50 + 65 + 80 + 95 + 110 + 125 + 140 + 155 + 170 + 185 + 200 + 215 + 230 = 1875

Nope.

So I screwed up somewhere.





((n(n-1))/2) + Iv calculates the final value of the 10th item (in the first example).

n = number of items

(9*10)/2+10 = 55

We know it will cost $55 for the final item.

So I believe I'm onto something there.

Surely there's a much quicker way to go about calculating this.

Seriously, please help me figure this out as it's frustrating me.


Edit - Gauss did a calculation similar to the thing I'm looking for when he was in elementry school. 100+1, 99+2, etc. 101*50 = 5050 which is all the number 1-100 added up.

Maybe I could approach it from that angle. I'll try it.



Edit 2 - That works but it requires I figure out the final item's purchase value before I can make the calculation using Gauss's method. There's got to be an explicit formula for the whole thing.


__________________

Last edited by dadudemon on Jun 30th, 2011 at 12:31 AM

Old Post Jun 30th, 2011 12:17 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Tzeentch
#gottem

Gender: Male
Location: Morgan's Maxim

No. tbh I only made it halway through your post though. Could you summarize it?


__________________

"The Daemon lied with every breath. It could not help itself but to deceive and dismay, to riddle and ruin. The more we conversed, the closer I drew to one singularly ineluctable fact: I would gain no wisdom here."

Last edited by Tzeentch on Jun 30th, 2011 at 12:21 AM

Old Post Jun 30th, 2011 12:19 AM
Tzeentch is currently offline Click here to Send Tzeentch a Private Message Find more posts by Tzeentch Edit/Delete Message Reply w/Quote Quick Quote
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

quote: (post)
Originally posted by RE: Blaxican
No. tbh I only made it halway through your post though. Could you summarize it?


I can't. You can read the first portion and read the conclusions but the stuff in between is an example of what I'm talking about which makes it kind of important to understand the rest.


Many games have incremental purchase prices for their items. It prevents people from buying too much of one item as they get more money in the game.


Sometimes, the increment is a factor, not an exact value. (Iv * 1.2 versus Iv + n*x, for example.)





But, I figured it out using Gauss's method. It's still not complete as you have to figure out one set before you can use it in the second set. That's clunky and not elegant. I want a complete, single, formula for figuring this out. I could also re-work it to use factors and not an exact value. You know what I mean?


__________________

Old Post Jun 30th, 2011 12:35 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Nephthys
The Gr8est!!!!!!!!

Gender: Male
Location: The End

What the fvck kind of games do you play?


__________________

Old Post Jun 30th, 2011 12:38 AM
Nephthys is currently offline Click here to Send Nephthys a Private Message Find more posts by Nephthys Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

I thought maybe this was about game theorycrafting, which can be fun.


__________________

Old Post Jun 30th, 2011 01:11 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
ares834
Senior Member

Gender: Male
Location: United States

To add up all the numbers from 1 to 100 one can use the equation (n(n+1))/2. Thus we can use this however, since the first number equals 0 we actually want ((n-1)(n-1+1))/2 or (n(n-1))/2.

Here is what I came up with (Iv *t) + (t(t-1))/2*i = FV

quote: (post)
Originally posted by dadudemon
Iv = 20
i = 10
t = 15

20 + 35 + 50 + 65 + 80 + 95 + 110 + 125 + 140 + 155 + 170 + 185 + 200 + 215 + 230 = 1875


Hmmm this is incorrect. You appear to be adding 15 everytime rather than 10.

Really it should be 20+30+40....= 1350

Old Post Jun 30th, 2011 02:15 AM
ares834 is currently offline Click here to Send ares834 a Private Message Find more posts by ares834 Edit/Delete Message Reply w/Quote Quick Quote
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

quote: (post)
Originally posted by Nephthys
What the fvck kind of games do you play?


It's mostly RPG games that do stuff like this.

They keep incrementing the value of items so you don't stack up too much on one particularly good item or don't become too powerful early on.

And example of incrementing purchases: the Gemcraft series. It increments quite a bit by factors creating almost a "soft cap" for many of the upgrades.

quote: (post)
Originally posted by Digi
I thought maybe this was about game theorycrafting, which can be fun.


It can be. This is all about game math, questions about it, or ideas. The first portion is just one of many things we can talk about.


quote: (post)
Originally posted by ares834
To add up all the numbers from 1 to 100 one can use the equation (n(n+1))/2. Thus we can use this however, since the first number equals 0 we actually want ((n-1)(n-1+1))/2 or (n(n-1))/2.

Here is what I came up with (Iv *t) + (t(t-1))/2*i = FV




I'll test this in just a second.



quote: (post)
Originally posted by ares834
Hmmm this is incorrect. You appear to be adding 15 everytime rather than 10.

Really it should be 20+30+40....= 1350


You're right. I incremented by 15, 15 times. In that example, you can just change the "i" to a 15 rather than changing the whole set.




Edit - YUP! It works. That's what I was looking for. Exactly what I was looking for. Ares...you are now my new favorite poster. big grin

(Iv *t) + (t(t-1))/2*i = Fv

This can be altered to use a factor instead of an increment. I'll rework this to do increments, in a while. Feel free to take these equations and put them into your own RPG game code. big grin


__________________

Last edited by dadudemon on Jun 30th, 2011 at 03:16 AM

Old Post Jun 30th, 2011 03:10 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

Glad you solved your boring math problem.

stick out tongue

quote: (post)
Originally posted by dadudemon
It can be. This is all about game math, questions about it, or ideas. The first portion is just one of many things we can talk about.


Cool. I do a fair amount of WoW theorycrafting, it's a good time. It's kind of leaked into my other gaming habits, and I think in terms of optimization. Most of it is paper napkin math, but I've worked out a few formulas and do a lot of in-game testing.

It's sometimes hard to model an ideal attack strategy (whether it's a sequence of attacks/spells/whatever, a specific combination of forces, formations, etc.), regardless of the game (shooter, strategy, RPG), and the best games leave too many variables to nail down a "best" because a lot of the strategy is context specific. But it's usually easy to identify a clear winner between two possibilities. Such binary comparisons, if done on a near-constant basis, can over time hone your approach into a few really, really good options. That's generally how I approach games, since I enjoy taking them seriously and getting a lot out of my characters, units, armies, etc. The actual formulas behind the mechanics are rarely transparent though, so it's an inexact art most times.


__________________

Last edited by Digi on Jun 30th, 2011 at 04:23 AM

Old Post Jun 30th, 2011 03:53 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

quote: (post)
Originally posted by Digi
Glad you solved your boring math problem.

stick out tongue



Cool. I do a fair amount of WoW theorycrafting, it's a good time. It's kind of leaked into my other gaming habits, and I think in terms of optimization. Most of it is paper napkin math, but I've worked out a few formulas and do a lot of in-game testing.

It's sometimes hard to model an ideal attack strategy (whether it's a sequence of attacks/spells/whatever, a specific combination of forces, formations, etc.), regardless of the game (shooter, strategy, RPG), and the best games leave too many variables to nail down a "best" because a lot of the strategy is context specific. But it's usually easy to identify a clear winner between two possibilities. Such binary comparisons, if done on a near-constant basis, can over time hone your approach into a few really, really good options. That's generally how I approach games, since I enjoy taking them seriously and getting a lot out of my characters, units, armies, etc. The actual formulas behind the mechanics are rarely transparent though, so it's an inexact art most times.



Those players that can stop and think about the math involed in the game will always have an advantage over their competitors.

I used to be part of a large alliance of players in an RTS game. Whenever they would release the new unit stats for each patch they released, I'd calculate all of the numbers that maximized upkeep costs to defense and attack ratios. This maximized our forces per unit gold spent and we were literally the number one alliance on the server due in part to our unit efficiency.



Some people get pissed and say you shouldn't bring "schoolwork" to play. I love those types because they provide some hilarious victories. smile Spending an hour to workout the best possible strategy with some math is really cool when it gives you an advantage. Then they get mad and say you're cheating. laughing


__________________

Old Post Jun 30th, 2011 07:53 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Morridini
Morridini

Gender: Male
Location: Norway

quote: (post)
Originally posted by dadudemon
This can be altered to use a factor instead of an increment.


If the price is changed by a factor f after each purchase instead of an increment, then I believe the following formula will work;

Fv = Iv*(1-f^t)/(1-f)

or since I hate to write math like that, let me use TeX syntax;

F_v = I_v \frac{1-f^t}{1-f}


__________________
GoldenEye for XBLA!!

Thanks to Raoul for the sig!

Last edited by Morridini on Jun 30th, 2011 at 09:14 AM

Old Post Jun 30th, 2011 09:10 AM
Morridini is currently offline Click here to Send Morridini a Private Message Find more posts by Morridini Edit/Delete Message Reply w/Quote Quick Quote
S_D_J
Bane

Gender: Male
Location: Coming to Gotham

I prefer Randy Marsh's TMI equation:

(please log in to view the image)

roll eyes (sarcastic)


__________________


"When Gotham is ashes, you have my permission to die." -BANE

Old Post Jun 30th, 2011 03:25 PM
S_D_J is currently offline Click here to Send S_D_J a Private Message Find more posts by S_D_J Edit/Delete Message Reply w/Quote Quick Quote
Morridini
Morridini

Gender: Male
Location: Norway

EDIT: nvm (why can't I delete my own post?)


__________________
GoldenEye for XBLA!!

Thanks to Raoul for the sig!

Old Post Jun 30th, 2011 04:54 PM
Morridini is currently offline Click here to Send Morridini a Private Message Find more posts by Morridini Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

quote: (post)
Originally posted by dadudemon
Those players that can stop and think about the math involed in the game will always have an advantage over their competitors.

I used to be part of a large alliance of players in an RTS game. Whenever they would release the new unit stats for each patch they released, I'd calculate all of the numbers that maximized upkeep costs to defense and attack ratios. This maximized our forces per unit gold spent and we were literally the number one alliance on the server due in part to our unit efficiency.



Some people get pissed and say you shouldn't bring "schoolwork" to play. I love those types because they provide some hilarious victories. smile Spending an hour to workout the best possible strategy with some math is really cool when it gives you an advantage. Then they get mad and say you're cheating. laughing


That's awesome.


__________________

Old Post Jul 1st, 2011 12:46 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
Tzeentch
#gottem

Gender: Male
Location: Morgan's Maxim

No it's not, it's nerdy. You guys are nerds.


__________________

"The Daemon lied with every breath. It could not help itself but to deceive and dismay, to riddle and ruin. The more we conversed, the closer I drew to one singularly ineluctable fact: I would gain no wisdom here."

Old Post Jul 1st, 2011 12:58 AM
Tzeentch is currently offline Click here to Send Tzeentch a Private Message Find more posts by Tzeentch Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

quote: (post)
Originally posted by RE: Blaxican
No it's not, it's nerdy. You guys are nerds.


Yes. Yes we are. I just wrote a trinket comparison for the newly-dropped 4.2 patch for WoW, that got posted to a popular class-specific website as a guide.

I am a nerd.


__________________

Old Post Jul 1st, 2011 01:09 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

quote: (post)
Originally posted by Digi
Yes. Yes we are. I just wrote a trinket comparison for the newly-dropped 4.2 patch for WoW, that got posted to a popular class-specific website as a guide.

I am a nerd.


No-no...THAT'S awesome. That big-time for WoW players.


quote: (post)
Originally posted by Morridini
If the price is changed by a factor f after each purchase instead of an increment, then I believe the following formula will work;

Fv = Iv*(1-f^t)/(1-f)

or since I hate to write math like that, let me use TeX syntax;

F_v = I_v \frac{1-f^t}{1-f}


That's awesome. I may test that out.


There are games, like Gemcraft, that use factors with each "purchase" so the factor version will be useful.


quote: (post)
Originally posted by RE: Blaxican
No it's not, it's nerdy. You guys are nerds.


And you're the type of person that is fun to pwn...cause you get all ragey on the mic and accuse us of cheating. Meow.


__________________

Old Post Jul 1st, 2011 03:12 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

Heh. Well, it IS geeky, so there's only so much I can take pride in it. But I enjoy it. I have a semi-regular spot on a heavily-trafficked hunter website. The guy who runs it updates every weekday (so 5 articles/posts a week). I pop in occasionally with articles, and also take over for brief stretches of time when he goes on vacation and such.


__________________

Old Post Jul 1st, 2011 03:22 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
dadudemon
Senior Member

Gender: Male
Location: Bacta Tank.

quote: (post)
Originally posted by Digi
Heh. Well, it IS geeky, so there's only so much I can take pride in it. But I enjoy it. I have a semi-regular spot on a heavily-trafficked hunter website. The guy who runs it updates every weekday (so 5 articles/posts a week). I pop in occasionally with articles, and also take over for brief stretches of time when he goes on vacation and such.


Off-topic...but how do you have time for WoW gaming, WoW geeking, teaching (I assume you're still a teacher?), working out, KMC posting and modding, AND a dating life? Do you not sleep much? [Back on topic...]The math just doesn't add up.


__________________

Old Post Jul 1st, 2011 04:06 AM
dadudemon is currently offline Click here to Send dadudemon a Private Message Find more posts by dadudemon Edit/Delete Message Reply w/Quote Quick Quote
Digi
Forum Leader

Gender: Unspecified
Location:

quote: (post)
Originally posted by dadudemon
Off-topic...but how do you have time for WoW gaming, WoW geeking, teaching (I assume you're still a teacher?), working out, KMC posting and modding, AND a dating life? Do you not sleep much? [Back on topic...]The math just doesn't add up.


Heh. My degree is in teaching, I actually work as the director of communications for an organization. Writing, editing, marketing, pr, etc. Not unrelated to my English background, but not teaching. Just as busy day-to-day, but I don't take much work home, which is nice.

I don't work out. I'm naturally sexy .

I make it a rule never to allow WoW to override my social life or work though. I keep my priorities aligned. It's surprising what you can do with not much play-time though. I just don't do anything frivolous. I don't grind useless things like achievements or mounts, anything I do has a tangible benefit to my play (which is primarily raiding, I don't PvP...though I do other things like extreme soloing and hunter-tanking, which are basically the same skills as raiding). As long as you've done your homework, and play with a specific focus, you don't need to sink epic amount of time in. So I raid 2 nights a week for 3 hours each night (weekdays, so usually nothing else going on). Then I'll put in time on weekends when I have spare time, so my overall playtime varies.

But I don't f--- around with alts (literally 2 toons ever with more than an hour of gameplay, and the other is mostly there to support the main with professions), and I enjoy the game when I'm getting the most out of my class and my performance, and that shows when I play.

But as a result, it takes me a long time to work through other games, or books I'm reading, stuff like that.

I'm also deceptive with KMC. I pop into my forums that I mod or frequent, post maybe 5 posts a day, check the reports, ban a sock or two, and am out in 10-15 minutes. I never spend long on here. If I'm ever "online" for longer than that, which is often, I probably just left my browser up and went to wank do something else.


__________________

Last edited by Digi on Jul 2nd, 2011 at 12:57 AM

Old Post Jul 2nd, 2011 12:34 AM
Digi is currently offline Click here to Send Digi a Private Message Find more posts by Digi Edit/Delete Message Reply w/Quote Quick Quote
Burning thought
Restricted

Gender: Male
Location: The end of eternity

Account Restricted

Ok, I have a calculation here but the formula is under scrutiny. I am calculating force used in someone flipping 300 tons, roughply 4 meters in 1 second;

quote:
mass= 272235.422

Speed= 4 meters over 1 seconds

velocity= 4 divided by 1= 4

Velocity squared= 16

Multiply squared velocity with Mass= 272235.422 x 16

Kinetic energy= 4355766.752 x 0.5= 2177883.376 joule

2177883.376 / 1.3558179483314004 = Pounds per square foot

Pounds per square foot of force= 1606324.3436777866507306658200642 (803.162172 tonnes)

Pounds per square inch (PSI)= 11155.030164429073963407401528224 (5.57751508 tonnes)


Is there a flaw in this calculations formula? regardless of the actual numbers used, is the formula sound? What can improve it or a counter formula that can fix errors?


__________________

Old Post Jul 25th, 2011 10:37 PM
Burning thought is currently offline Click here to Send Burning thought a Private Message Find more posts by Burning thought Edit/Delete Message Reply w/Quote Quick Quote
All times are UTC. The time now is 08:36 AM.
Pages (7): [1] 2 3 » ... Last »   Last Thread   Next Thread

Home » Misc » Computer / Video Games Discussion » Game Math.

Email this Page
Subscribe to this Thread
   Post New Thread  Post A Reply

Forum Jump:
Search by user:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON

Text-only version
 

< - KillerMovies.com - Forum Archive - Forum Rules >


© Copyright 2000-2006, KillerMovies.com. All Rights Reserved.
Powered by: vBulletin, copyright ©2000-2006, Jelsoft Enterprises Limited.