Random Function - Printable Version +- Little Fighter Empire - Forums (https://lf-empire.de/forum) +-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7) +--- Forum: [2.0] Exe Editing (https://lf-empire.de/forum/forumdisplay.php?fid=43) +--- Thread: Random Function (/showthread.php?tid=8072) |
|
Random Function - Boop - 07-17-2012 So in case anyone is curious about how the Marti implemented randomness in lf2, well it's magic :p. To get the rand() function working in the AI stuff we had to use lf2 seeds rather than our own, so that when replays get loaded our rand functions give the same values as when the game was first played. Anyway, the random function is located at 00417170. Here it is reversed:
Slightly different than the original, the original accepts 2 parameters instead of one, but doesn't use one because magic. Anyway, gotta love marti and his crazy implementations. %1234 , %3000 ... Arbitrary numbers ftw! RE: Random Function - A-Man - 07-17-2012 Oh cool. I was just wondering what seeding with random means. I guess I understood now. It doesn't allow any randomly choose item be selected more than once. Pretty awesome reverse engineered u did here! Good job man!i always enjoy seeing ur work though i only understand like 10% from it. I gotta learn these assembly stuff. RE: Random Function - Boop - 07-17-2012 (07-17-2012, 06:40 PM)A-MAN Wrote: Oh cool. I was just wondering what seeding with random means. I guess I understood now. It doesn't allow any randomly choose item be selected more than once. Pretty awesome reverse engineered u did here! Good job man!i always enjoy seeing ur work though i only understand like 10% from it. I gotta learn these assembly stuff. No. That's not what a seed is. http://en.wikipedia.org/wiki/Random_seed Random isn't really random, its pseudorandom. The seed is used to initialize it. If you use the same seed you can recreate these "random" numbers. That's why this random function works in replays, because the random seed will be the same ingame and in the replay, the same random numbers will be generated and replays will work. RE: Random Function - o_g349 - 08-17-2014 I add this function into [documented] Functions decompiled. This reply is just for reference this thread. |