Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: DynamixDJ on 2015-12-20 13:29:42

Title: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-20 13:29:42
I've recently discovered this forum, and while I know very little about reverse engineering, I don't believe it to be outside the realm of my capability of understanding. Knowing how to manipulate the RNG however is fairly simple, and I have undertaken the task of trying to map out each RNG's outcome for sex/breed, as well as receiving and increase to both MDash and MRun. So far I have been successful with mating 2xGreats, less than 4 wins, and also 2xGreats, 4 wins or more. If anyone would like to see those RNG locations then let me know and I'll post 'em. I'm yet to do my tests with 2xGoods.

3 queries:

This is the biggy. When moving my Chocobo in from the pen, I am mapping down the Sex, and also the stats it receives (by feeding it 11 Sylkis Greens then takling it to the Chocobo Square). My results are not consistent, and while I experience consistency for the 1st Chocobo I move, I am not not for the 2nd. I can only assume that a different RNG is used depending on which stable a chocobo is being moved into. Also, when moving my Good (into stable no2), I noticed that the gender RNG was the same as the one when moving my Great. Again, I imagine that this is due to the stable it is being moved into. I could work this out for myself, but it would require A LOT of testing, I'm hoping someone could confirm it for me.

When testing to see how many battles are required before breeding can continue, I'm getting different results when selecting a different gender, although a lot of the time the difference is minimal (i.e. one parent can breed 1 battle prior to the other parent), but other times the difference is significant (i.e. the newborn being ready 5 battles earlier). Is the RNG selected based on which gender of Chocobo I select first, or is there something I'm missing?

This last one isn't major, and I can work this one out for myself soon enough. After I have finished mapping out my 2xGood 0 wins, and 2xGood 4 wins results, I am going to sit down with 1xGood 1xGreat. Is the RNG that is selected dependant on which Chocobo I pick first, or which pair i pick. Meaning, if I select Great first, will I be able to refer to my mapping of my 2xgreats, or will a new RNG be used. And if so, will a different RNG be used if I select Good first before Great (as opposed to Great before good)? I'm hoping that I'll just be able to refer to my previous findings as that will greatly reduce the amount of tests I need to do.

If I find that my discoveries are solid enough then I plan to make a FAQ detailing the optimal RNG location for each circumstance, as so that one can achieve the 'best' possible chocobo with minimal effort, everytime. Any help offered will be very much appreciated, as I'm still learning in-depth how the RNG's work!
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-20 13:41:32
You've definitely come to the right place. I just saw your PM to me on GFAQs and was going to suggest to come here. I can rarely answer questions on weekends, but if no one gets to this by tomorrow I'll come help.

Basically the tool you're looking for is Makou Reactor (http://forums.qhimm.com/index.php?topic=9658.0). What I'd do (and probably anyone else) would be to open the flevel.lgp file in that program and scour through the Chocobo Breeding Scripts. I have mine annotated, but I can't get to the machine with those scripts until tonight at the earliest.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-20 14:16:25
Legend. I was just about to post on here - it's not the stable (in regards to the 'stat assignment' RNG when moving chocobos) that's giving me trouble, and I'm not sure what is. I came across my troubles at 2am last night, and I wasn't thinking clearly. As soon as i came on to my emulator just, I realised that I could release the chocobo that was being kept in stable 1 that's being used solely for advancing the marker (by feeding Karaka Greens).

All of the testing that I've conducted is under the circumstance of moving a chocobo into the second stable, with a 'feeding' chocobo being kept in stable 1. And, as I understand, releasing a chocobo advances the marker by 1.

So, with 2 Goods in the pen and one weak in stable 1, I fed the chocobo in stable 1 - 20 Greens to bring the RNG to 22 (resulting in a Female, 97KPH and 341 Stamina after 11 Sylkis Greens (give or take 1 to each value given the way in which the Sylkis Greens work)). then I released the chocobo in stable one, freeing up stable two, then I moved the remaining Good chocobo into stable 2. The result was inconclusive. I entertained the possibility that releasing a chocobo could advance the RNG by more than one, but the figures weren't even in the correct ballpark.

The most important thing is that there is consistency with the second 'move', so I will be able to determine a fixed set of results to achieve what I'm after (one chocobo of opposite sex, one with the highest Stamina possible (or over 50 RNG 'spins'), and the other with the highest MDash possible). Understanding what I am to do, and understanding how the thing I am doing works are two different thing though, and if I can understand how it works then I could save myself a lot of time in regards to having to find a 'second' set of results (which may inevitably be unavoidable anyway).

Cheers for the tip though NT, I'll definitely check out that tool, for now I'm keen to crack on with a few more tests
Title: Re: [FFVII] Chocobo RNG help
Post by: DLPB_ on 2015-12-20 14:48:33
http://www.gamefaqs.com/ps/197341-final-fantasy-vii/faqs/58077

That may also help
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-20 14:52:17
Completely scoured it. In fact, it's thanks to the RNG section in that guide that sent me on my RNG adventure!

Oh, and I can say that releasing a chocobo does not advance the marker by 1.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-20 18:26:39
Basically the tool you're looking for is Makou Reactor (http://forums.qhimm.com/index.php?topic=9658.0). What I'd do (and probably anyone else) would be to open the flevel.lgp file in that program and scour through the Chocobo Breeding Scripts. I have mine annotated, but I can't get to the machine with those scripts until tonight at the earliest.

I must say, this program is fascinating, and is really going to help me with my walkthrough in a number of ways. But, I struggled to find the file you mentioned, I booted up my NTSC Rom (.iso), is there another ffvii 'image' file I could try? Also, I struggled to find anything on the enemy AI. If I could view the actual source of Terence's mechanics FAQ then it'll really help when I get round to doing the enemy section. Even being able to see the random encounter probabilities is fascinating!!
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-20 20:24:23
OK never mind, I downloaded the PC version of FFVII found the flevel.lgp file that way. It basically does the same thing as loading up my .iso version. Still struggling to find any script on the enemies though
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-21 02:26:10
OK never mind, I downloaded the PC version of FFVII found the flevel.lgp file that way. It basically does the same thing as loading up my .iso version. Still struggling to find any script on the enemies though

Enemy Scripts can be found in the scene.bin file with the help of Proud Clod (http://forums.qhimm.com/index.php?topic=8481.0).
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-21 12:39:35
Yes, I found Proud Clod a while before you posted. I also found Black Chocobo, and in regards to my walkthrough, all three programs are going to help massively, although I am still struggling to find any raw script pertaining to chocobo RNG. Not that I would be able to understand it properly; I'm thinking about learning hexadecimal, it seems to be something I could grasp. If anyone has any great links that would help I'd be grateful (although I'd probably be able to find a few by myself).

In regards to my RNG side project, Black Chcobo will help loads, as it enables me to view the exact figure of every stat, and my main endeavors is to breed the 'best' possible chocobo with minimal effort, by using the precise RNG locations. Also, using Black chocobo I can set up the exact parameters of the 'test' that I wish to conduct without having to catch/race the chocobos manually (i.e. I am currently testing for 1xGreat and 1xGood with less than 4 wins between them). All in all, a good find, but I'm still very keen to view the script that pertains to RNG, if you (or anyone else) can assist with where to look within Makou Reactor, I'd be grateful.
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-21 12:48:24
It might be more complicated than that. While I understand how the field's RNG works, on rare occasions it doesn't increment at all. Recall our discussion about the field's RNG (http://www.gamefaqs.com/boards/197341-final-fantasy-vii/72552680)? There's no randomness going on in the ranch to advance the RNG....UNLESS there's a pinned-but-not-stabled chocobo. That will move around randomly and can advance the RNG every time it turns and walks. I'll open it up in a bit and see what I can deduce from the whole matter. Choco breeding is a pain to try to max without just pumping them full of steroids.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-21 14:39:21
I'm on very limited time, so I'll have to be brief. I remember that discussion, and from what I can recall we established the fact the PC/Steam version use a different set of RNG mechanics than the console versions. All of my experminets are beinjg conducted on a PS1 emulator, then tested on the PS4 version. I think you would find my results interesting, I'll send you my 'raw dta' to browse through if you're interested.

I can say for certain that a fixed RNG is 'locatable' in terms of moving chocobos from the pen into the stable, it just matters which stable they are moved into. I achecive consistency by catching three chocobos, moving one into stable one as a 'feeding' choc (to advace the RNG), then I put one of my other choc's into stable 2 (after hard resetting) @RNG-xxx (I have the figure on my home computer), and the Speed and Stamina are consistent with my results (and now thanks to Black Chocob I can also determine the other 'random' stats). Then, I release the choc in stable one, thereby freeing up stable 2. Hard reset. @RNG-xxx (the same as before), I'll achieve identical results, everytime.

I'll go into more depth on some of my other findings when I get home, that's all I have time for at the min, but some of my discoveries are fascinating!
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-21 15:16:07
I can tell you that the Chocobo move code starts in field frcyo, group gaki, script 1 (talk) line 546. Then it executes a few other scripts from the same field. It looks like the actual stat assignment is in keisan scripts1-5.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-21 19:40:17
OK, so if what I'm looking at is correct, then lines 599 onwards basically confirms my notion that a different RNG is used for each stable when determining the stats for the Chocobo when moving. But this is the first time I've looked at script in this way, and without spending a lot of time with it I can't really be sure. But, I'd like to talk about some of my findings, I'm sure you'll find it interesting.

So, just to be clear on my method of manipulating the RNG on a PS1 Emulator (just so we're on the same page) is: From hard resetting (having saved outside the ranch), I'm heading into the stables as quick as poss. Then, I'm feeding a Krakka Green (or Karaka) to a random chocobo to advance the RNG by 1 (at least I believe it to be 1). So, to get to RNG-016, I'm feeding 14 Greens, then I'm mating/moving (heading into the barn area automatically advances the marker by 2, so I'm entering the stables @002).

Moving a Great into stable 2, then feeding it 11 Sylkis Greens:

@RNG-016 = Female 88KPH 486 Stam
@RNG-019 = Male 107KPH 363 Stam

These are the chocs that had the highest Dash and highest Stamina, over 50 RNG 'rolls'. You'll need a dummy (or 'feeding) chocobo in stable one to begin with, once you've moved your first great Chocobo, release the choc in stable 1 then save.

Bear in mind that I've just realised today that my maths is off in terms of how many Greens is needed to bring Dash to MDash. Seeing as Dash is set to either 50, 60, 70 or 80 percent of MDash, I'll always assume the worst case scenario (although now, thanks to Black Chocobo I can manage my choc's stats more closely). From what I can currently work out, 8 Greens are all that's needed to bring Dash to Mdash (and subsequently Run to MRun), but it is very very possibe (but unlikely) that 9 may be required. To achieve the above figures, you must feed 11 Sylkis Greens, and also bear in mind that the Stamina figure may be slightly out due to the way in which the Greens work (also bear in mind that (obviously) the figures are the ones shown in the race lobby, I didn't have Black Chocobo when I started these tests, I'll be sure to review them in much more detail. Also, the Stamina figure is (obviously) Stamina/10 - the in-race figure).

Now for the Breeding part:

Mating 2 Greats, less than 4 wins between them:

*@RNG-064 = Green F DASH RUN STAMINA 
   (M) Parents M-8  battles F-7  battles, Newborn 6  battles
   (F) Parents M-7  battles F-8  battles, Newborn 6  battles

*@RNG-115 = Blue  M DASH RUN         
  *(M) Parents M-9  battles F-6  battles, Newborn 6  battles
   (F) Parents M-10 battles F-10 battles, Newborn 10 battles

I've also found Green M & Blue F that receives a boost to Dash, but the above figures were the best results.

So, the gender of chocobo we select first has no affect whatsoever on the breed/sex/stat that is selected, however it does make a difference on how many battles are resired before some of the chocobos can mate again. It's a crying shame that Black Chocobo does not detail the amount of battles required before a chocobo can mate again, it would have saved me A LOT of testing time.

Mating 2 Greats, 4 or more wins between them:

*@RNG-067 = Green F DASH RUN STAMINA
   (M) Parents M-8  battles F-8  battles, Newborn 8  battles
  *(F) Parents M-7  battles F-8  battles, Newborn 7  battles

*@RNG-117 = Blue  M DASH RUN
   (M) Parents M-9  battles F-6  battles, Newborn 6  battles
   (F) Parents M-6  battles F-9  battles, Newborn 6  battles

I've still got a hell of a lot of test to conduct. A few interesting things:
 - Buying greens does *not* increase the RNG
 - Chloe tells you the MDash/MRun value, NOT Dash/Run; so you don't need to feed greens after you've bred to see whether or not they've received a boost in stats (I know from testing, but if you wish to check [kodomo] [talk] [line 93] for me, I'm not sure how to decipher what I'm reading).
 - It was always around the mid 60's and the mid 110's that I would find my 'magical RNG number', gaining a boost to all three stats (or just Dash and Run)!!
 - Class makes no difference to the breed/sex/stats, although I haven't tested for battle count.

Lastly, sorry to drag this post on too long, but for the hell of it I thought it might be interesting to see a snippet of the raw data i've collected, from the raw data I intend on finding out exactly what actions advances the RNG and by how much (i.e. releasing a chocobo).

Moving Good Chocobo, feeding 11 Sylkis Greens (stable 2):

 @RNG-002 = F 89 372
 @RNG-003 = F 89 405
 @RNG-004 = F 81 420
 @RNG-005 = F 95 349
 @RNG-006 = M 94 342
 @RNG-007 = M 94 352
 @RNG-008 = M 79 426
 @RNG-009 = M 93 367
 @RNG-110 = M 80 403
 @RNG-111 = M 80 422
 @RNG-012 = M 86 392
 @RNG-013 = M 87 347
 @RNG-014 = M 89 383
 @RNG-015 = F 94 308
 @RNG-016 = F 82 449
 @RNG-017 = F 94 332

2 Goods Less than 4 wins: (Values un-shown yielded a regular Chocobo)

 @RNG-004 = Blue F RUN
 @RNG-005 = Green M DASH
 @RNG-007 = Green F
 @RNG-014 = Green M DASH
 @RNG-016 = Green M
 @RNG-020 = Green F
 @RNG-026 = Blue F
 @RNG-033 = Blue M
 @RNG-045 = Green M DASH
 @RNG-047 = Blue F
 @RNG-053 = Green M
 @RNG-054 = Blue F,
 @RNG-062 = Blue M DASH
 @RNG-063 = Green F DASH STAMINA
 @RNG-064 = Green M RUN STAMINA
*@RNG-065 = Green F DASH RUN STAMINA
Title: Re: [FFVII] Chocobo RNG help
Post by: sithlord48 on 2015-12-22 12:32:14
Quote
It's a crying shame that Black Chocobo does not detail the amount of battles required before a chocobo can mate again,
do you know where (if) this is stored in the save ?I Can add that if you do. For now there is the toggle "can't Mate" but you need to quit the game edit then reload. And when testing that can be what you spend most of you time doing.. check something , close game , small change , relaunch ... i hate to think how much time i have spend doing just that myself.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-22 12:51:26
do you know where (if) this is stored in the save ?I Can add that if you do. For now there is the toggle "can't Mate" but you need to quit the game edit then reload. And when testing that can be what you spend most of you time doing.. check something , close game , small change , relaunch ... i hate to think how much time i have spend doing just that myself.

The problem is that I am trying to ascertain the amount of battles required after mating on a particular RNG Value. The 'can't mate' toggle is nor good to me, because after I have mated I need to then get into a battle, tallying each time I do, save state, then attempting breed. If they can't mate, then I'll reload my state, battle, tally, save , then see if they are ready. Simply toggling the 'can't mate' flag will not help me (for these current tests anyway, they may help later on, but every test I am conducting is being followed by a '# of battles' test.

But for all concerning purpose, Black Chocobo is fantastic, it really is. Being able to view the chocobos core stats is imperative to my project.
Title: Re: [FFVII] Chocobo RNG help
Post by: DLPB_ on 2015-12-22 15:43:29
You can also see their change in real time with Ochu (along with a mem logger that you can use to see memory changes).
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-22 19:18:34
You can also see their change in real time with Ochu (along with a mem logger that you can use to see memory changes).
Firstly, when I read the name 'Daniel Burke' I was like "holy, strawberries, I know that name...", you made 'beacause', right? You even had a small mention on the introduction section of my walkthrough, but due to the fact that I had to shorten down a few bits I had to delete that paragraph.
Secondly, from what I can gather Ochu works on the PC version, right (and not on an emulator)?

I have two current queries that I could probably answer myself through the course of my tests, nevertheless someone may be able to offer me (even more) help in my endeavors (tools, etc):

1) Greens. Sylkis Green, for example, give a 10% boost to our Dash & Run (give or take a very small figure, for arguments sake let's just say 10%). So, does the formula take place for every single Green fed? Or is the formula applied just once, and subsequent Greens (on that feed) follow suite? So let's say Dash is 3000, will all Greens fed increase Dash by 300, or does it go 3000 + 300 =3300. 3300 + 330 = 3630. 3630 + 363 = 3993 and so on... If the latter occurs, then only 8 Sylkis Greens are required (unless breeding the weaker 4 of the 8 'types') .

I plan to do some RNG tests involving Mimmet Greens

2) (This one's a big one) When mating my second generation, does the chocobo type affect which RNG used? I could be in for a lot of testing if it does (and I have a feeling it does). So, will 2 x Greats Blue/Green M/F have a different RNG to 2 x Goods Blue/Green M/F? Seeing as the 'regular' chocobos have varying RNG's based on the type of chcobos being mated, I'm going to assume the same for the 2nd generation (which means there's a LOT of work to be done). I can work this one out for myself though.

Oh, and one last thing, can someone please confirm for me whether or not the Enemy Away Materia is available pre- Tiny Bronco or not, thanx
Title: Re: [FFVII] Chocobo RNG help
Post by: DLPB_ on 2015-12-22 20:57:00
Yup. And yeah, Ochu is PC only :)
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-23 12:40:30
1) Greens. Sylkis Green, for example, give a 10% boost to our Dash & Run (give or take a very small figure, for arguments sake let's just say 10%). So, does the formula take place for every single Green fed? Or is the formula applied just once, and subsequent Greens (on that feed) follow suite? So let's say Dash is 3000, will all Greens fed increase Dash by 300, or does it go 3000 + 300 =3300. 3300 + 330 = 3630. 3630 + 363 = 3993 and so on... If the latter occurs, then only 8 Sylkis Greens are required (unless breeding the weaker 4 of the 8 'types') .
I would be shocked and appalled if it wasn't compound (300, then 330, then 363...etc). While I'm not certain it's a percentage increase, the general pattern in the field scripts is make a change, write to memory, re-read from memory. That would pull compound percentages. I'll double check this, but this seems 96% likely.

2) (This one's a big one) When mating my second generation, does the chocobo type affect which RNG used? I could be in for a lot of testing if it does (and I have a feeling it does). So, will 2 x Greats Blue/Green M/F have a different RNG to 2 x Goods Blue/Green M/F? Seeing as the 'regular' chocobos have varying RNG's based on the type of chocobos being mated, I'm going to assume the same for the 2nd generation (which means there's a LOT of work to be done). I can work this one out for myself though.
There's only one RNG for the field module and it's used for everything. From movement patterns of NPCs to random chance mini-games (3D battler, anyone?).
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-23 19:01:31
There's only one RNG for the field module and it's used for everything.
OK, what i mean is there is a differentiation in the outcome of the breed for the RNG value based on the which types of chocobos are being bred (but NOT the stable that they are in - 100% sure of this).

Take for example these patterns I noticed last night (note that these were the 'best' results, or in the case of the Blue F, the earliest):

Code: [Select]
2 Greats, 4 wins or more:
@RNG-053 = Blue  F DASH
@RNG-067 = Green F DASH RUN STAMINA
@RNG-079 = Green M DASH STAMINA
@RNG-117 = Blue  M DASH RUN

2 Goods, 4 wins or more:
@RNG-052 = Blue F DASH
@RNG-066 = Green F DASH RUN STAMINA
@RNG-078 = Green M DASH STAMINA
@RNG-116 = Blue M DASH RUN

So as you can see, there is a small difference in the RNG positions for the desired outcome, but the difference is not consistent. If I could understand why/how this works it could save me a chunk of time with my tests. Saying that, a very similar pattern emerges when comparing the '0 win range':

Code: [Select]
2 Greats, Less than four wins:
@RNG-064 = Green F DASH RUN STAMINA 
@RNG-087 = Green M DASH STAMINA     
@RNG-115 = Blue  M DASH RUN         
@RNG-128 = Blue  F DASH 

2 Goods, Less than four wins:
@RNG-065 = Green F DASH RUN STAMINA
@RNG-077 = Green M DASH STAMINA
@RNG-115 = Blue M DASH RUN
@RNG-128 = Blue F DASH

So there is as little as 1 and as much as 10 figures difference. Using this, I can isolate the 'desired' figures for future tests.

One last thing, I have to ask this, as an uber-noob to script reading/writing, am I on the right forum? In the sense that, would these findings be better suited on something such as a blog? I kind of feel like a fish out of water, then again, perhaps someone who is looking into the coding of the RNG could use these results to further their grasp their understanding of it?
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-24 21:48:58
do you know where (if) this is stored in the save ?I Can add that if you do.

It's taken me a few days of learning, wrapping my head around hexadecimal and binary number systems (for the first time in my life I actually understand how 8 bit and 16 bit actually work), and I believe I may have found where the battle count requirement is kept:

0x0D01 - 0x0D11.

These figures were all at 00 before breeding, then several of them increased according to how many chocobos I'd had stored

0x0D0D was at 07 after breeding, reducing this figure enabled breeding of the chocobo kept in stable 4, although from what I can gather the 'can't breed' flag was still enabled (0x0D00). I wasn't sure how to determine the 'battle count required' though. There were 2 other figures set to 7, these were for the other two chocobos that couldn't mate. There was also a decreasing value for the three chocobos, going from 181-179 (or B5 - B3) at 0x0D01, 0x0D08 and 0x0D0C. I couldn't make heads or tails of these, but they ran alongside the '07' figures.

Also, you may want to look into 0x0CAD, 0x0CAE, and 0x0CAF. As far as I can tell, this doesn't mirror 0x04F8 (etc), but instead displays the character that was last in that particular slot when you saved. Possibly.
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-25 12:40:05
Since you're on an emulator, can you track that after each battle and see if it decreases?

As for your RNG quandary, there are likely more checks going on depending on a variety of factors. I'm mostly certain "personality" plays a part in it. The better they "get along" the higher the chick's stats will be (It appears to be a maximum of average PLUS difference [a*b/2 + |a-b|]). The order you pick them in apparently has an effect too. If the first parent you pick has a great personality, it won't matter what the other chocobo's personality is. However, if the first pick is low it will throw as many as two additional RNG rolls to see if they just do get along. If both have a low personality it will roll as many as three times. If you pick the one with the highest personality first it bypasses all of these rolls.
I could be completely wrong. I don't have it in front of me. I'll examine it in more detail later.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-25 18:08:18
This is interesting. I am fairly certain that the stats received (along with sex and breed) have absolutely no difference whatsoever depending on which chocobo is selected (I've just checked, and the three 'variations' that I've tested on so far all had varying personalities). This does help however with the fact that i am having variations on the battle count required depending on which chocobo is selected.

Speaking of which, I tried to 'spot the difference' with two saves, and my head was spinning when I uncovered the 0x0D01 - 0x0D11 range, I'm gonna spend some more time with it today to try and uncover what's going on (the '07' figure appears to be a flag, but I'm not sure)

I did have a few weird things occur. Here's the difference between the two saves that i evaluated:

First I loaded my save. Then I switched Yuffie for Vincent, then I made a fresh save (the party I keep is my way of keeping track of which tests I perform). This is why 0x0CAE had a value of 5 (for Yuffie) instead of 7 (for Vincent) (or possibly vica versa). Then I ran into the stables, fed 62 Karakka Greens, mated chocobo 1 & 2 to fill stable 4 (3 was filled). Then I saved into a new slot.

The following 'peculiar' things happened:

The chocobo in slot one received a penalty in Intelligence (100-50), and a boost in Co-op (0-62)

0x0E41 changed from 00-02 (?)

(This is definitely noteworthy) The values between F06 and F0B changed accordingly:

0x0F06 - 2D - 26 (45 - 38)
0x0F07 - 41 - 45 (65 - 69)
0x0F08 - 4C -4D (76 - 77)
0x0F09 - 45 - 41 (69 - 65)
0x0F0A - 00 - 4C (0 - 76)
0x0F0B - 00 - 45 (0 - 69)

I've just double checked to make sure that these are the 'right way round'. I'd like to spend some more time with these. Perhaps I am looking at them wrong, maybe they are 3 groups of 2 bytes...

The last range of 'peculiar' value changes are:

0x0FE4 - 2D - 24 (45 - 36)
0x0FE5 - 2F - 21 (47 - 33)
0x0FE6 - 2D - 24 (45 - 36)

Also, do you think that the chocobos in stable 5 & 6 act differently in any way due to the fact that they are being stored in a different part of the memory bank?
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-25 22:16:28
Ok then Sithlord, I've found the values that affect the battle count, which are all 2 bytes. They do not decrease each time you battle, rather they 'dictate' how many battles are required.

Stable 1 - 0x0D01
Stable 2 - 0x0D08
Stable 3 - 0x0D0A
Stable 4 - 0x0D0C
Stable 5 - 0x0D0E
Stable 6 - 0x0D10


EDIT - sussed it! It's amazing what a good night's sleep can do! 0x0D01 is 16 bit, and is the figure your battle count needs to be before mating to continue. So, the value of 0x0D01 minus the value of 0x0BBC (current battle count) is the battle count required before mating can continue.

i hope this is enough to go on, as having the ability to see the count required will really help my my rng testing. Also, is there a way to view the chocobo 'type' once it's in the stable? I can help you find that aswell, this little venture has been fun! Lastly,

CONFIRMED - 0x0CAD - 0x0CAF is NOT a mirror of 0x04F8 - 0x04FA. It is indeed, the party member that was in that slot the last time you saved (or simply just the last person in that slot? more testing required).
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-26 13:29:05
This is interesting. I am fairly certain that the stats received (along with sex and breed) have absolutely no difference whatsoever depending on which chocobo is selected (I've just checked, and the three 'variations' that I've tested on so far all had varying personalities). This does help however with the fact that i am having variations on the battle count required depending on which chocobo is selected.
Perhaps not directly, but the RNG should be moving differently depending on what the personality of the first parent is.

(This is definitely noteworthy) The values between F06 and F0B changed accordingly:
0x0F06 - 2D - 26 (45 - 38)
0x0F07 - 41 - 45 (65 - 69)
0x0F08 - 4C -4D (76 - 77)
0x0F09 - 45 - 41 (69 - 65)
0x0F0A - 00 - 4C (0 - 76)
0x0F0B - 00 - 45 (0 - 69)

These values are peppered all over the chocobo scripts, both in breeding and moving to pens. I don't know what these mean.

Also, do you think that the chocobos in stable 5 & 6 act differently in any way due to the fact that they are being stored in a different part of the memory bank?
I don't think they're treated any differently. I think they just got shoehorned in late in development because breeding certain chocobos with just four pens is a little tricky (maybe).

EDIT - sussed it! It's amazing what a good night's sleep can do! 0x0D01 is 16 bit, and is the figure your kill count needs to be before mating to continue. So, the value of 0x0D01 minus the value of 0x0BBC (current kill count) is the kill count required before mating can continue.
...
CONFIRMED - 0x0CAD - 0x0CAF is NOT a mirror of 0x04F8 - 0x04FA. It is indeed, the party member that was in that slot the last time you saved (or simply just the last person in that slot? more testing required).
Kill count? That's new. If this is the case, couldn't you just have a character with a low kill count make a chocobo mate, switch to a character with a high kill count and immediately mate again?

i hope this is enough to go on, as having the ability to see the count required will really help my my rng testing. Also, is there a way to view the chocobo 'type' once it's in the stable? I can help you find that aswell, this little venture has been fun! Lastly,
As far as I know, no. The only difference is each type of chocobo has a range of stats. Goods & Greats share a certain flag somewhere and Wonderful has a different flag. The others don't have any flag. It's only used to determine what color chocobo results from mating. Certain nuts even have different effects on stats, but that's not well documented.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-26 14:39:14
Kill count? That's new. If this is the case, couldn't you just have a character with a low kill count make a chocobo mate, switch to a character with a high kill count and immediately mate again?

No. 0x0BBC is the total number of battles fought, the same figure that the sleeping man states. I messed up my wording (now edited).

As far as I know, no. The only difference is each type of chocobo has a range of stats. Goods & Greats share a certain flag somewhere and Wonderful has a different flag. The others don't have any flag. It's only used to determine what color chocobo results from mating. Certain nuts even have different effects on stats, but that's not well documented.


If this is true, then when it comes to doing my 2nd generation tests (later on today) there shouldn't be any variation on the outcome of the offspring based on which 'type' of parent is used, which will be nice  :) There has to be a flag somewhere though that states which type a yellow 'stabled' chocobo is, I'll try to find it.

Also, the reason I am under the impression that the 'coloured' offspring is assigned a type, is because of Terence's Chocobo breakdown http://forums.qhimm.com/index.php?topic=3241.0 (http://forums.qhimm.com/index.php?topic=3241.0) but after having just re-read it, I realise now that it is slightly misleading
Code: [Select]
Otherwise, if both of the parents are Great or Good Chocobos:
        If the total number of races won by the parents is 4 or more, then
          the baby is automatically either a Blue (50%) or Green (50%)
          Chocobo
        If it's less:
                   69/256 chance: Blue Chocobo
                   69/256 chance: Green Chocobo
                  118/256 chance: Yellow Chocobo
        The Rating of the newborn Chocobo will be Great if both parents have
          the same Rating, and will have an equal chance of Great or Good if
          the parents were of different Ratings

it doesn't actually state that the rating only applies to the yellow chocobo born. I'm glad that's been clarified!
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-26 19:50:53
From my own testing, chocobo offspring have no "rating". They are colored and inherit type flags from their parents. If you mate two goods, you'll get a good. Two greats make a great. A good and a great might be a good or a great (I still think they share the same flag). A wonderful mated with anything else other than a wonderful will lose the wonderful flag.

I think of it like this (but it's probably not like this:

Code: [Select]
Chocobo type:
0x00 (Yellow, nothing special)
0x01 (Yellow Good/Great)
0x02 (Yellow Wonderful)
0x04 (Blue)
0x08 (Green)
0x0C (Black)
0x0E (Gold)

I have no confirmation of this so I can't point to anything that says this is correct.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-27 17:28:19
From my own testing, chocobo offspring have no "rating". They are colored and inherit type flags from their parents. If you mate two goods, you'll get a good. Two greats make a great. A good and a great might be a good or a great (I still think they share the same flag). A wonderful mated with anything else other than a wonderful will lose the wonderful flag.

FOUND IT!!! It took me a while, but (at last) I can safely say after having ran a few tests that:

0x0E3E - Type of chocobo in stable 1 (1=Wonderful, 8=Terrible)
0x0E3F - Type of chocobo in stable 2
0x0E40 - Type of chocobo in stable 3
0x0E41 - Type of chocobo in stable 4
0x0E42 - Type of chocobo in stable 5
0x0E43 - Type of chocobo in stable 6

I am fairly certain that the Great and Good do *not* share the same flag, as if they did then there would not be any variation with my RNG testing when varying 2xgreats, 2xGoods and 1xGreat with 1xgood.

Also, Personality has no affect whatsoever on the sex, colour or stats that the newborn receives.

So Sithlord, there's two ways in which the chocobo section in BC can be improved (which btw I'd be very grateful if you could include 'type' of chocobo in the stables, along with battle count required, it'll help me on my RNG quest, although now I know where the values are myself....)

Is there anything else that I could look for? I'm on a roll.
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-27 18:00:23
Sorry I've misdirected you at almost every step. I either know what I'm talking about or I am completely wrong. :D

So do offspring have a chance of being a better quality chocobo than either parent? What quality are the colored ones? More importantly, what does quality do other than cap stats and determine what color comes out?
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-27 18:22:48
It's all good, if it wasn't for you I wouldn't have a clue how to read MR  :D

By 'quality' I'm going to assume you mean 'type', according to everything I've read, type means very little after the 1st generation. If you are able to breed a Wonderful Gold Chocobo, then you 'qualify' for the Gold chocobo breeding circumstances when breeding the Wonderful Gold with a Black (if the Gold was a 'Great' Gold, then you could still get Gold, as when you fail to qualify for the 'special breeding circumstances', you will have 50% of father/mother's colour).

Breeding a Great Gold with a Great Yellow (with 4 races) would result in a Green/Blue. I'm not 100% on all this, this is just from what I've read, but now I know where on the hex editor I can monitor which type a chocobo is, so I'll be able to test in due course :)

In terms of my experiments, I beleive I may be in for a lot of testing. I'm mapping out every outcome of each RNG's position (all 256 of them), for every variation of chocobo. I'm currently on 1Good, 1Great 0 wins. Now that I know that the chocobo's type varies with Green & Blue, I could be in for a ridiculous amount of testing. I.e.

Great Green M with Great Blue F
Great Green F with Great Blue M
Great Green M with Good Blue F
Great Green F with Good Blue M
Good Green M with Great Blue F
Good Green F with Great Blue M
Good Green M with Good Blue F
Good Green F with Good Blue M

And then I have to throw Wonderful into that equation. Ugh! I'm thinking, is there a program available that would map out the result of each RNG position? It may be less time consuming that way, even if I do have to decipher the hex positions and values. -edit- I've just worked out that there are 18 2nd generation breeding variations, which is 4608 RNG outcomes!!!

i won't know until I get there, but I may get lucky and find that the RNG sequence for stat distribution (as an example) would be the same as the previous generation, and only the colour varies. It's possible..... (fingers crossed)
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-28 18:03:58

As for your RNG quandary, there are likely more checks going on depending on a variety of factors. I'm mostly certain "personality" plays a part in it. The better they "get along" the higher the chick's stats will be (It appears to be a maximum of average PLUS difference [a*b/2 + |a-b|]). The order you pick them in apparently has an effect too. If the first parent you pick has a great personality, it won't matter what the other chocobo's personality is. However, if the first pick is low it will throw as many as two additional RNG rolls to see if they just do get along. If both have a low personality it will roll as many as three times. If you pick the one with the highest personality first it bypasses all of these rolls.
I could be completely wrong. I don't have it in front of me. I'll examine it in more detail later.

I stand corrected, you are right. I ran a few basic tests before, but I'd overlooked something. Going back to testing personality, it does affect the RNG by 'offsetting' the value by as much as two, however the 'sequence' remains the same (thankfully). However, the parent that I selected first made no impact whatsoever on the results.

-edit- I'm wrong again, 3 different RNG sequences are used depending on whether or not the chocobos are both personality 0, either of them are personality 0, or neither of them are. I can't be 100% sure at this stage though, but that's how it appears.

This is a huge spanner in the works
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-29 17:48:21
Hey, have you found initial stats yet? It just occurred to me that the stat assignment is probably in the world map scripts. There's no editor or viewer for those scripts. MOST of it has been reversed, but I don't know how to determine what chocobos are assigned.

I say this because I know the same battles always yield the same class chocobo (eg. you won't find greats in icicle land and wonderfuls only appear with one or two "Jumping" enemies). I'm pretty sure the whole chocobo battle is a world script. You can't get one without the chocobo lure materia; The chocobo battle actors all share the same AI scripts and they don't assign type or anything; The "send to ranch" menu has to be a script. I'll take a look and see if anything pops out.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2015-12-30 18:42:01
Judging by what I've read in Terence's Chocobo breakdown, the fact that I can't find the values (although I haven't looked too deeply), and my RNG results, I'd say that a penned Chocobo has no stats assigned to it other than 'type', but I could be wrong.....

In fact, if the stats were determined at the point at which a chocobo is caught (yes I am aware that MDash and Stamina are initially determined (from 8 varying possibilities), then every stat (including MDash and Stamina) is then decided/adjusted accordingly), then there would be some inconsistencies with my RNG results. I've just ran a few tests, I put one Great chocobo in my pen via BC, then I caught a 3 Great chocobos, one alongside two Spirals, one alongside 1 Spiral, and one alongside 2 Valrons. The stats that are given was the same for all four, when moving @RNG-002.

I'm using a great program at the moment called Cheat Engine, I have been able to assign the address for each of the chocobos stats for each of the 6 stables, so I can see them live. I can also edit the RNG value live, I'm currenty assigning a load of desired values, such as 'Love points', hell I can even put a chocobo into the pen without even having to exit the game! It's brilliant!!!!
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2015-12-30 19:11:21
OK. If that's not the way it works I'll have to keep looking.

I only suggested the world scripts because I know that's how type gets defined before penning it. I happened across the code that assigns battle formations on the WM and noticed that there's a chunk for chocobo formations including type of chocobo. This comes from the enc_w.bin file, which is documented, but I only recently noticed it.

Cheat Engine is great. I use it along side lots of programs I try to modify. It's great at most stand-alone games (even newer gen ones like Dead Space and FTL). Not so hot on flash games though. Using a combination of that and a debugger called IDA (https://www.hex-rays.com/products/ida/) I can reverse engineer/modify the game to do nearly anything. I made a No-CD patch with its help that only changes eight bytes in the exe.
Title: Re: [FFVII] Chocobo RNG help
Post by: DLPB_ on 2016-01-01 00:24:49
Finally, CE 6.5 is out!  Will fix a load of issues I reported :)
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2016-01-01 01:40:17
Wow! I knew there are tons more features to CE than I've been using, but I had no idea there were still so many features it could use! If I did anything other than increase money/HP/MP/Ammo/etc with games then I'd care more. ;)

Still, good to know it's getting even more powerful.

Edit:
They need to proof-read their release notes a bit more:
Quote
Rightlicking on "your system supports dbvm" will let you manually load DBVM for each cpu. This is usefull if for some reason your system crashes when it's done too quickly
Title: Re: [FFVII] Chocobo RNG help
Post by: Bain86 on 2016-09-08 04:28:05
About Chocobo Breeding.. as to, how to get a blue or green at your first try. I have found that the order of what gender you pick first to breed, "Male" then "Female" = blue.  "Female" then "Male" = Green. I would assume the gender must have to change by what spot the chocobo ends up in the stables but i dont know forsure. 
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2017-12-14 13:42:43
^^Replying to a post made over a yr ago lol. It's amazing how much I've learned since I started this topic (this is where it all began for me, right here).

It's safe to say, that with the help of NFITC1 I'm completely sure of the breeding mechanics, and there is no doubt in my mind of how it works now. The first Chocobo you select does matter, but only in certain circumstances. It is not as simple as saying that picking "male" then "female" will result in a blue; more likely that the first Chocobo you select will affect the RNG roll, and will give you a different colour accordingly, but that colour is not set in stone. The RNG marker position at the time of breeding ultimately dictates the outcome, of which there are 256.

Note that the order of the Chocobos that you pick will only affect the colour of the Choc, the stats of the newborn remain consistent regardless of which one you pick 1st (again, the RNG marker position dictates all)
Title: Re: [FFVII] Chocobo RNG help
Post by: DLPB_ on 2017-12-14 18:39:47
Is there no way to just add a few calls to the RNG opcode in field using makou?  Could make it more random using certain tricks like feeding the timer into it?  Havent looked at how it works.
Title: Re: [FFVII] Chocobo RNG help
Post by: DynamixDJ on 2017-12-27 13:07:52
Yes, I'm sure there are too. I know that when a random number is generated, the RNG marker advances by one. I think that there are numerous random numbers pulled with certain character animations; I planned to look at the Chocobo Square or Wonder Square to fully work out the tricks they are using, then try to apply that to Esther.

Let me know if/when you want me to look into it for you.
Title: Re: [FFVII] Chocobo RNG help
Post by: nfitc1 on 2017-12-27 13:52:08
Is there no way to just add a few calls to the RNG opcode in field using makou?  Could make it more random using certain tricks like feeding the timer into it?  Havent looked at how it works.

Field RNG is in a LUT like the battle system's. The only way to "randomize" it is to have it cycle unpredictably. Like the 3D Battler in Gold Saucer is influenced by the NPCs in the room moving about. There's just nothing in the stable itself to influence the RNG. Outside the stable in the pen field there's lots of RNG cycling if you have at least one chocobo penned.