cloudll Posted February 13, 2017 Share Posted February 13, 2017 Hi guys. I'm using php to make a basic level up experience system. At the moment I'm using the following math. $level = 1; //increments on level up $constantValue = 150; $level * $constantValue = $exp2level; Ideally I would like it to be a little more complicated so the exp needed to level isn't so predictable. Now, me and maths have never got along so I'm struggling. Is there a way I can generate exp results a little like FF7. Like this: Thanks for any tips LEVEL 1: 0 LEVEL 2: 6 LEVEL 3: 33 LEVEL 4: 94 LEVEL 5: 202 LEVEL 6: 372 LEVEL 7: 616 LEVEL 8: 949 LEVEL 9: 1384 LEVEL 10: 1934 LEVEL 11: 2614 LEVEL 12: 3588 LEVEL 13: 4610 LEVEL 14: 5809 LEVEL 15: 7200 LEVEL 16: 8797 LEVEL 17: 10614 LEVEL 18: 12665 LEVEL 19: 14965 LEVEL 20: 17528 LEVEL 21: 20368 LEVEL 22: 24161 LEVEL 23: 27694 LEVEL 24: 31555 LEVEL 25: 35759 LEVEL 26: 40321 LEVEL 27: 45255 LEVEL 28: 50576 LEVEL 29: 56299 LEVEL 30: 62438 LEVEL 31: 69008 LEVEL 32: 77066 LEVEL 33: 84643 LEVEL 34: 92701 LEVEL 35: 101255 LEVEL 36: 110320 LEVEL 37: 119910 LEVEL 38: 130040 LEVEL 39: 140725 LEVEL 40: 151980 LEVEL 41: 163820 LEVEL 42: 176259 LEVEL 43: 189312 LEVEL 44: 202994 LEVEL 45: 217320 LEVEL 46: 232305 LEVEL 47: 247963 LEVEL 48: 264309 LEVEL 49: 281358 LEVEL 50: 299125 LEVEL 51: 317625 LEVEL 52: 336872 LEVEL 53: 356881 LEVEL 54: 377667 LEVEL 55: 399245 LEVEL 56: 421630 LEVEL 57: 444836 LEVEL 58: 468878 LEVEL 59: 493771 LEVEL 60: 519530 LEVEL 61: 546170 LEVEL 62: 581467 LEVEL 63: 610297 LEVEL 64: 640064 LEVEL 65: 670784 LEVEL 66: 702471 LEVEL 67: 735141 LEVEL 68: 768808 LEVEL 69: 803488 LEVEL 70: 839195 LEVEL 71: 875945 LEVEL 72: 913752 LEVEL 73: 952632 LEVEL 74: 992599 LEVEL 75: 1033669 LEVEL 76: 1075856 LEVEL 77: 1119176 LEVEL 78: 1163643 LEVEL 79: 1209273 LEVEL 80: 1256080 LEVEL 81: 1304080 LEVEL 82: 1389359 LEVEL 83: 1441133 LEVEL 84: 1494178 LEVEL 85: 1548509 LEVEL 86: 1604141 LEVEL 87: 1661090 LEVEL 88: 1719371 LEVEL 89: 1778999 LEVEL 90: 1839990 LEVEL 91: 1902360 LEVEL 92: 1966123 LEVEL 93: 2031295 LEVEL 94: 2097892 LEVEL 95: 2165929 LEVEL 96: 2235421 LEVEL 97: 2306384 LEVEL 98: 2378833 LEVEL 99: 2452783 Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/ Share on other sites More sharing options...
Jacques1 Posted February 13, 2017 Share Posted February 13, 2017 (edited) The data can be approximated with a polynomial function, e. g. f(x) = 3x^3 with f(x) being the experience points required for level x. Edited February 13, 2017 by Jacques1 Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/#findComment-1542713 Share on other sites More sharing options...
Barand Posted February 13, 2017 Share Posted February 13, 2017 Putting the first 20 sets of data into excel and plotting a polynomial trendline gavey = 2.3226x3 - 1.5788x2 - 22.829x + 43.886So you could use that or approximate it to $y = 2.323 * pow($x, 3); Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/#findComment-1542715 Share on other sites More sharing options...
cloudll Posted February 13, 2017 Author Share Posted February 13, 2017 Awesome, thanks guys. So I am using it like this, is this okay? $level = 1; $expNeeded = round(2.323 * pow($level, 3)); Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/#findComment-1542717 Share on other sites More sharing options...
Jacques1 Posted February 13, 2017 Share Posted February 13, 2017 Don't make it so complicated. $level = 1; $experiencePoints = 3 * $level ** 3; Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/#findComment-1542718 Share on other sites More sharing options...
Omnijak Posted March 10, 2017 Share Posted March 10, 2017 The data can be approximated with a polynomial function, e. g. f(x) = 3x^3 with f(tax) being the experience points required for level x. Don't make it so complicated. $level = 1; $experiencePoints = 3 * $level ** 3; Perfect thank you very much! You are a big help to all of us!! Quote Link to comment https://forums.phpfreaks.com/topic/303186-a-little-help-with-the-math-for-levelexp-code/#findComment-1544036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.