Tables Posted February 9, 2012 Share Posted February 9, 2012 To put it bluntly, I'm writing an essay for my maths degree on random number generation, and I'd like to use Fire Emblem's RNG as an example - ideally, I want to break it apart and prove that with any three consecutive values, you know the precise sequence of values of the generator (although that may be either not very mathematical, or may be beyond me to prove). However, I currently can't find the formula for the generator - I know I've seen it somewhere online, but a quick forum and google search haven't found it. If anyone could point me in the correct direction, that would be appreciated. Quote Link to comment Share on other sites More sharing options...
Klokinator Posted February 10, 2012 Share Posted February 10, 2012 (edited) http://www.gamefaqs....ones/faqs/37253 Should be what you're looking for. http://www.gamefaqs....red-stones/faqs this is in case it's something else. Edit: Actually this is probably what you're looking for. http://www.gamefaqs.com/gba/921183-fire-emblem-the-sacred-stones/faqs/37685 Edited February 10, 2012 by Klokinator Quote Link to comment Share on other sites More sharing options...
Tables Posted February 10, 2012 Author Share Posted February 10, 2012 As far as I can see, none of those even contain anything remotely close to an equation for the RNG. Which isn't surprising, since there'd be no point quoting an FAQ when the equation should be one line long. All I know about the equation off the top of my head is that it's a linear feedback shift register. Quote Link to comment Share on other sites More sharing options...
Rewjeo Posted February 10, 2012 Share Posted February 10, 2012 In the GBA era, there isn't a generator. There's a set order for the RNG, which is why certain prologue hits/misses/criticals happen the same way so often. The variation comes from how you move the units and certain menu selections, I think, as well as of course doing different things. Quote Link to comment Share on other sites More sharing options...
Thor Odinson Posted February 10, 2012 Share Posted February 10, 2012 (edited) Hm, I don't really know if it'd be considered a formula or not, but I dug up an old programming practice I did that writes a random number generator. The order of the rn string generated is always the same though. Here's a screen from my code: http://gyazo.com/6f9723e5f04646f9d3fcc076cca85116 So I would imagine FE's would be something similar except more complicated. Edited February 10, 2012 by Luminescent Blade Quote Link to comment Share on other sites More sharing options...
zahlman Posted February 11, 2012 Share Posted February 11, 2012 (edited) In the GBA era, there isn't a generator. Yes, there is. You yourself are calling it an RNG; what do you think the G stands for? There's a set order for the RNG That's how RNGs work. The reason you get consistent behaviour is that the RNG is seeded with the same value each time you reset. The rest of the sequence is still generated, though. It's not stored somewhere. It's determined, one number at a time, as they're needed, with math. Based on a combination of what I can figure out from Hex's documentation, and playing around with the VBA disassembler, the routine in question starts at xBDC in the ROM and goes all the way to xCA6 (i.e. about a hundred opcodes long). Good luck sorting through it :) The actual RNG state is held in ROM at 0x3000000, i.e. the very beginning of IRAM. 6 bytes are used, with a seed of 71 36 EA 90 96 14. AFAIK the code is identical for all three GBA FEs. Edited February 11, 2012 by zahlman Quote Link to comment Share on other sites More sharing options...
Tables Posted February 11, 2012 Author Share Posted February 11, 2012 Hm. There's certainly a generator, and as I said I believe it's a linear feedback shift register, but I don't know the details. Ah well, to be honest it would have just been a cute example, so it's not that important to me. I can easily talk about things like... the Mersenne Twister (for suitable definitions of 'easily') Quote Link to comment 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.