d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Experience Algorithm > Ft: Hugs & Kisses
Add Reply New Topic New Poll
Member
Posts: 2,217
Joined: Sep 10 2007
Gold: 35.88
Dec 3 2012 09:15pm
Hey guys & gals!
It's been a long day for me... I'm currently working on a UDK project and I've spent all day cramming tons of information on Flash/HUDs in my head.
That being said, the part of my brain that typically does math is completely frazzled and I'm in the need of some help.

I'm trying to create an algorithm for my character advancement (leveling) system.

Here is a short version of my chart
Basically, each level cost 100 experience more than the previous.

Level EXP
1 = 0
2 = 100
3 = 300
4 = 600
5 = 1000
6 = 1500
7 = 2100
8 = 2800
9 = 3600
10 = 4500
... ...

I'm trying to solve for EXP.
So it'll be like...

Level Cost = (Level - 1) * 100 blah blah blah
idk.. Like I said.. I'm drawing blanks.
Thanks in advance!

Edit: I'm sure I'm over thinking this * 100000000

This post was edited by grievance on Dec 3 2012 09:27pm
Member
Posts: 8,564
Joined: Jun 13 2006
Gold: 4.75
Dec 3 2012 09:52pm
Quote (grievance @ 3 Dec 2012 22:15)
Hey guys & gals!
It's been a long day for me... I'm currently working on a UDK project and I've spent all day cramming tons of information on Flash/HUDs in my head.
That being said, the part of my brain that typically does math is completely frazzled and I'm in the need of some help.

I'm trying to create an algorithm for my character advancement (leveling) system.

Here is a short version of my chart
Basically, each level cost 100 experience more than the previous.

Level EXP
1    =    0 
2    =    100 
3    =    300 
4    =    600 
5    =    1000 
6    =    1500 
7    =    2100 
8    =    2800 
9    =    3600 
10    =    4500
...        ... 

I'm trying to solve for EXP.
So it'll be like...

Level Cost = (Level - 1) * 100 blah blah blah
idk.. Like I said.. I'm drawing blanks.
Thanks in advance!

Edit: I'm sure I'm over thinking this * 100000000


Well your chart is not Previous lvl + 100 XD
That might not help the solving

If you want it to be +100 each lvl, formula would be (CurrentLvl-1)*100

This post was edited by Fawar on Dec 3 2012 09:53pm
Member
Posts: 61,418
Joined: Nov 21 2006
Gold: Locked
Dec 3 2012 10:07pm
The equation that models your chart is n(50n - 50)

This post was edited by Ectasy on Dec 3 2012 10:11pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Dec 3 2012 10:08pm
that's just the series 1 + 2 + 3 + ... + n shifted by 1 since you include 0. which is the same as n(n+1)/2 then multiply by 100. adjust n since you shifted by 1
Member
Posts: 2,217
Joined: Sep 10 2007
Gold: 35.88
Dec 3 2012 10:08pm
I think I've found a solution. I'll post it here in case anybody else in insterested.

Current Algorithm

ExpNeededforNextLevel = ExpNeededforCurrentLevel + (100) CurrentLevel


If I plug it in it seems to work fine..

Level 2
100 = 0 + (100) 1

Level 3
300 = 100 + (100) 2

Level 4
600 = 300 + (100) 3


I've tested it up to level 15, and I haven't seen a problem so I feel safe assuming that it will indefinitely.
There is however another potential problem I'm predicting.

In my project the player 'spends' their experience to purchase player level ups, skill level ups, ability level ups, etc.
I'm not sure how to code and track all of my variable or what my variables should be so that I can keep up with their experience despite the fact they've been 'spending' it.


Quote (Ectasy @ Dec 3 2012 10:07pm)
The equation that models your chart is n(50n - 50)


This also appears to work fine mathematically.
I'm not sure which would be better for the given system I'm trying to implement.

My equation works using a Constant. Which I like, but probably just because in the programming course I have taking my peers always seem to underrate them.
Sure Constants might be unneeded, however they help me a lot when it comes to 'thinking' about my system.

This post was edited by grievance on Dec 3 2012 10:12pm
Member
Posts: 61,418
Joined: Nov 21 2006
Gold: Locked
Dec 3 2012 10:15pm
Quote (grievance @ 3 Dec 2012 23:08)
I think I've found a solution. I'll post it here in case anybody else in insterested.

Current Algorithm

ExpNeededforNextLevel = ExpNeededforCurrentLevel + (100) CurrentLevel


If I plug it in it seems to work fine..

Level 2
100 = 0 + (100) 1

Level 3
300 = 100 + (100) 2

Level 4
600 = 300 + (100) 3


I've tested it up to level 15, and I haven't seen a problem so I feel safe assuming that it will indefinitely.
There is however another potential problem I'm predicting.

In my project the player 'spends' their experience to purchase player level ups, skill level ups, ability level ups, etc.
I'm not sure how to code and track all of my variable or what my variables should be so that I can keep up with their experience despite the fact they've been 'spending' it.




This also appears to work fine mathematically.
I'm not sure which would be better for the given system I'm trying to implement.

My equation works using a Constant. Which I like, but probably just because in the programming course I have taking my peers always seem to underrate them.
Sure Constants might be unneeded, however they help me a lot when it comes to 'thinking' about my system.


I'd use my way, unless anyone else wants to offer an opinion since I'm no pro
because you're going to have to either A. store the current level's exp or B. work through it each time recursively/iteratively
using the exact function will be quick and easy without storing the previous experience variable and referring to it

I say my way, but carteblanche's is the same thing (except he didn't give it to you outright)

This post was edited by Ectasy on Dec 3 2012 10:22pm
Member
Posts: 2,217
Joined: Sep 10 2007
Gold: 35.88
Dec 3 2012 10:24pm
Quote (Ectasy @ Dec 3 2012 10:15pm)
I'd use my way, unless anyone else wants to offer an opinion since I'm no pro
because you're going to have to either A. store the current level's exp or B. work through it each time recursively/iteratively
using the exact function will be quick and easy without storing the previous experience variable and referring to it

I say my way, but carteblanche's is the same thing (except he didn't give it to you outright)



Good point. I guess in this situation using a constant would be doing WAYYY too much excessive work.
I'm going to try and this. If you're interested I'll be more than happy to let you know how it works out.

Yeah, you made it much simpler. Thank you. Thank both of you, actually.
My brain is pretty overloaded atm and simpler is definitely better, for now.

This post was edited by grievance on Dec 3 2012 10:26pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll