{"id":96,"date":"2021-05-07T03:31:23","date_gmt":"2021-05-07T03:31:23","guid":{"rendered":"https:\/\/dev.krayzar.org\/?p=96"},"modified":"2021-05-07T03:31:23","modified_gmt":"2021-05-07T03:31:23","slug":"ogre-battle-rng-reseach","status":"publish","type":"post","link":"https:\/\/krayzar.net\/blog\/2021\/05\/07\/ogre-battle-rng-reseach\/","title":{"rendered":"Ogre Battle: MotBQ &#8211; RNG Research"},"content":{"rendered":"\n<p>I recently started doing deep dives into all versions of the games, initially focusing on differences, but my goal is to gain a complete understanding of RNG across all versions.<\/p>\n\n\n\n<p><strong>Currently I&#8217;m working on:<\/strong>&nbsp;Mapping initial Tarot RNG<\/p>\n\n\n\n<p><strong>DONE<\/strong>&nbsp;&#8211; Preliminary search for time counters.<br><strong>DONE<\/strong>&nbsp;&#8211; Found Tarot locations in Memory for ALL versions.<br><strong>DONE<\/strong> &#8211; Find Leader Name Memory locations.<br><strong>NEXT<\/strong>&nbsp;&#8211; Scripting a bot to play through and find all possible card sets per version.<\/p>\n\n\n\n<p>I&#8217;ll update this with information as I confirm more. For now, the high level stuff is:<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>SNES USA and JPN<\/strong><\/h6>\n\n\n\n<p>Both versions use a 256 counter for initial card RNG.&nbsp;<small>@<\/small><a href=\"https:\/\/www.speedrun.com\/user\/Dragondarch\"><strong>Dragondarch<\/strong><\/a>&nbsp;&#8216;s RNG manipulations for the name &#8220;!&#8221; will work well on all original versions of SNES. The documented card sets may be off by a single digit compared to hardware perhaps due to recent accuracy improvements in emulation or issues with the BSNES core in recent bizhawk versions that make replicating accurate to hardware results impossible, but in practice it doesn&#8217;t change how anything works. I&#8217;ll probably need to test with save states on real hardware to figure what the discrepancy really is with the SD2SNES, assuming I can get save states working on my older model.<\/p>\n\n\n\n<p>Time Counter stored at WRAM:<br>0x51<\/p>\n\n\n\n<p>Tarot Cards stored at WRAM:<br>0xDBE &#8211; 0xDCC<\/p>\n\n\n\n<p>Leader name stored at WRAM:<br>0x7A4 &#8211; 0x7AB<br>0x87B &#8211; 0x882<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Nintendo Power Kiosk version<\/strong><\/h6>\n\n\n\n<p>Nintendo Power SNES ROM uses a 256 counter for initial card RNG but has a vastly different algorithm that seems very similar to the PSX version. Current Manipulations for &#8220;!&#8221; do not work. 0x52 is a secondary time counter that resets to 0 once it gets to FF (255). Not quite PSX, but close. Hopefully scripting the card RNG will illuminate just how close it is.<\/p>\n\n\n\n<p>Time Counter stored at WRAM:<br>0x51<\/p>\n\n\n\n<p>Secondary Time Counter stored at WRAM:<br>0x52<\/p>\n\n\n\n<p>Tarot Cards stored at WRAM:<br>0xDBE &#8211; 0xDCC<\/p>\n\n\n\n<p>Leader name stored at WRAM:<br>0x7A4 &#8211; 0x7AB<br>0x87B &#8211; 0x882<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>PS1<\/strong><\/h6>\n\n\n\n<p>Seem to have RNG based on program start &#8211; there is a main counter that counts up indefinitely and initial card RNG seems entirely based on it. That appears to be a full 32bit counter and does reset to 0 once it reaches the limit. There are semi frequent areas of lag frames on PS1. This essentially means that there are small 2 to 4 frame windows where it&#8217;s very likely you will get a specific set of cards, but the card sets are based solely on the timer and algorithm and the periods of lag being inconsistent can make things tricky. There is also a 0 to 64 counter I&#8217;m aware of that doesn&#8217;t seem involved in card RNG, but may have a role in other types of RNG.<\/p>\n\n\n\n<p>Tarot Cards stored at PSX MainRAM:<br>1C6B85 &#8211; 1C6B93<\/p>\n\n\n\n<p>Leader name stored at PSX MainRAM:<br>1C6C14 &#8211; 1C6C1B<\/p>\n\n\n\n<p>Time Counters stored at PSX MainRAM:<br>00E20C<br>13C910<br>13C8FC<br>135104<br>14188C<\/p>\n\n\n\n<p>Unknow why there&#8217;s so many on slightly different offsets\/starting positions.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Saturn<\/strong><\/h6>\n\n\n\n<p>Seems to have RNG based on program start &#8211; there is a main counter that counts up indefinitely and initial card RNG seems entirely based on it. That appears to be a full 32bit counter and could take over a year to figure out if there&#8217;s any interesting effects if it maxes out. Tarot cards are stored odd\/even in the address range &#8211; only version that does this.<\/p>\n\n\n\n<p>Time Counter stored at SAT work ram high:<br>0F9670<\/p>\n\n\n\n<p>Secondary Time Counter stored at SAT work ram high:<br>0F9671<\/p>\n\n\n\n<p>Another time counter (Realtime) stored at SAT work ram high:<br>0C63F8<\/p>\n\n\n\n<p>Tarot Cards stored at SAT work ram high:<br>0CD46C &#8211; 0CD479<\/p>\n\n\n\n<p>Slot 01 = 0CD46D<br>Slot 02 = 0CD46C<br>Slot 03 = 0CD46F<br>Slot 04 = 0CD46E<br>Slot 05 = 0CD471<br>Slot 06 = 0CD470<br>Slot 07 = 0CD473<br>Slot 08 = 0CD472<br>Slot 09 = 0CD475<br>Slot 10 = 0CD474<br>Slot 11 = 0CD477<br>Slot 12 = 0CD476<br>Slot 13 = 0CD479<br>Slot 14 = 0CD478<\/p>\n\n\n\n<p>No idea why Saturn does this. Cards are reordered shortly after final pick too.<\/p>\n\n\n\n<p>Leader Name stored at SAT work ram high:<br>0F9674 &#8211; 0F967B<\/p>\n\n\n\n<p>Same odd\/even storage pattern.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently started doing deep dives into all versions of the games, initially focusing on differences, but my goal is to gain a complete understanding of RNG across all versions. Currently I&#8217;m working on:&nbsp;Mapping initial Tarot RNG DONE&nbsp;&#8211; Preliminary search for time counters.DONE&nbsp;&#8211; Found Tarot locations in Memory for ALL versions.DONE &#8211; Find Leader Name &hellip; <a href=\"https:\/\/krayzar.net\/blog\/2021\/05\/07\/ogre-battle-rng-reseach\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Ogre Battle: MotBQ &#8211; RNG Research<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[7,10],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-speedrunning","tag-hacking","tag-rng"],"_links":{"self":[{"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":0,"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/krayzar.net\/blog\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}