Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ...bruteforce the wiener out of it!
- -- So, I've recorded the total EXP values needed to advance a character to the next level in Disgaea 1.
- -- From a coding standpoint, it is more effective to implement a formula for total EXP, and then calculate ENEXT as a difference.
- -- Otherwise, you'd have to calculate a few thousand ENEXTs for every mob in a particularly deep dungeon,
- -- which is not a smart thing to do when your game runs on a PS2
- -- The EXP curve behaves very differently before LV99 and after LV99. Let's start with the first part.
- -- Assuming that EXP is given by a polynome, I've taken a few values as control points and obtained this approximation:
- -- EXP = 0.0100003 * LV^4 + 0.289923 * LV^3 + 1.05555 * LV^2 + 1.14207 * LV + 0.50246
- -- Most likely, the actual formula is an integer expression of a similar nature. I assumed it was something of this form:
- -- EXP = floor(((((A * LV + B) * LV + C) * LV + D) * LV + E) / 1000)
- -- This program tries different values of A..E in the neighbourhood of the ones above and compares the results with actual EXP from the game.
- -- As it stands, the EXP function for 1<=LV<=98 may be perfectly represented by this expression:
- -- EXP = floor(((((10 * LV + 290) * LV + 1050) * LV + 1271) * LV + 486) / 1000)
- local exp = {
- 3,
- 9,
- 22,
- 43,
- 75,
- 121,
- 184,
- 267,
- 373,
- 508,
- 673,
- 875,
- 1117,
- 1404,
- 1740,
- 2132,
- 2585,
- 3104,
- 3696,
- 4365,
- 5120,
- 5967,
- 6912,
- 7962,
- 9126,
- 10410,
- 11822,
- 13371,
- 15066,
- 16913,
- 18923,
- 21104,
- 23466,
- 26019,
- 28771,
- 31733,
- 34915,
- 38329,
- 41984,
- 45891,
- 50062,
- 54508,
- 59241,
- 64273,
- 69616,
- 75282,
- 81285,
- 87636,
- 94350,
- 101439,
- 108917,
- 116798,
- 125096,
- 133826,
- 143001,
- 152638,
- 162750,
- 173353,
- 184464,
- 196096,
- 208267,
- 220993,
- 234291,
- 248176,
- 262666,
- 277779,
- 293531,
- 309941,
- 327026,
- 344804,
- 363294,
- 382515,
- 402486,
- 423225,
- 444752,
- 467086,
- 490248,
- 514258,
- 539136,
- 564902,
- 591577,
- 619183,
- 647740,
- 677271,
- 707797,
- 739339,
- 771921,
- 805565,
- 840294,
- 876129,
- 913096,
- 951217,
- 990515,
- 1031016,
- 1072742,
- 1115719,
- 1159971,
- 1205523,
- 1303823,
- 1340870,
- 1377638,
- 1414198,
- 1450612,
- 1486933,
- 1523205,
- 1559465,
- 1595747,
- 1632078,
- 1668484,
- 1704986,
- 1741603,
- 1778352,
- 1815248,
- 1852303,
- 1889530,
- 1926939,
- 1964540,
- 2002341,
- 2040350,
- 2078573,
- 2117018,
- 2155689,
- 2194593,
- 2233733,
- 2273114,
- 2312741,
- 2352616,
- 2392743,
- 2433126,
- 2473766,
- 2514668,
- 2555833,
- 2597263,
- 2638961,
- 2680929,
- 2723168,
- 2765680,
- 2808467,
- 2851530,
- 2894871,
- 2938490,
- 2982390,
- 3026572,
- 3071035,
- 3115782,
- 3160814,
- 3206130,
- 3251733,
- 3297623,
- 3343800,
- 3390266,
- 3437020,
- 3484065,
- 3531399,
- 3579025,
- 3626942,
- 3675151,
- 3723652,
- 3772447,
- 3821534,
- 3870916,
- 3920591,
- 3970561,
- 4020826,
- 4071386,
- 4122242,
- 4173394,
- 4224842,
- 4276586,
- 4328628,
- 4380966,
- 4433601,
- 4486535,
- 4539766,
- 4593295,
- 4647122,
- 4701247,
- 4755672,
- 4810395,
- 4865417,
- 4920738,
- 4976359,
- 5032279,
- 5088498,
- 5145018,
- 5201838,
- 5258957,
- 5316377,
- 5374097,
- 5432118,
- 5490440,
- 5549062,
- 5607985,
- 5667208,
- 5726733,
- 5786560,
- 5846687,
- 5907116,
- 5967846,
- 6028877,
- 6090211,
- 6151846,
- 6213782,
- 6276021,
- 6338562,
- 6401404,
- 6464549,
- 6527996,
- 6591745,
- 6655796,
- 6720149,
- 6784805,
- 6849764,
- 6915025,
- 6980588,
- 7046455,
- 7112623,
- 7179095,
- 7245869,
- 7312946,
- 7380326,
- 7448009,
- 7515995,
- 7584284,
- 7652876,
- 7721771,
- 7790969,
- 7860470,
- 7930275,
- 8000383,
- 8070794,
- 8141508,
- 8212526,
- 8283847,
- 8355471,
- 8427399,
- 8499630,
- 8572165,
- 8645003,
- 8718145,
- 8791590,
- 8865339,
- 8939392,
- 9013748,
- 9088408,
- 9163372,
- 9238640,
- 9314211,
- 9390086,
- 9466265, -- 250
- }
- local function approximate(lv, a,b,c,d,e)
- local v = a
- v = v * lv + b
- v = v * lv + c
- v = v * lv + d
- v = v * lv + e
- return math.floor(v/1000)
- end
- local function distance(a,b,c,d,e)
- local s = 0
- for i = 1, 98 do
- local v = approximate(i, a,b,c,d,e)
- s = s + math.pow(v - exp[i], 2)
- end
- return s
- end
- local mindist = 1e30
- for a = 9,11 do
- for b = 280, 300 do
- for c = 1000, 1100 do
- for d = 1000, 1300 do
- for e = 300, 700 do
- local dist = distance(a,b,c,d,e)
- if dist < mindist then
- print(string.format('%4i %4i %4i %4i %4i %s',
- a,b,c,d,e, dist))
- mindist = dist
- end
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment