Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Pokémon Discussion

A pokemon first gen undertaking, a little technical advice needed - Page 1

A pokemon first gen undertaking, a little technical advice needed

Posted by: Jacob91
Date: 2014-01-24 20:47:05
I'm attempting to map the entire pokemon red/blue game according to probabilities of desired outcomes, in particular with wild pokemon encounters and ditto/trainer-fly glitch encounter possibilities. I've already compiled a list of what each trainer in the game yields via the trainer-fly/ditto glitch and also determined the exact encounter rates for each species/level in each area, also the range of specials and probability of a certain special for each battle. The information I have thus far is presented in the following format:
(A scan of a sample route is shown here http://www.mariokart64.com/cgi-bin/yabb2/YaBB.pl?num=1387844516 )
There still remain a couple of mysteries which I am having trouble solving, and I figured that there are enough folks on here with such technical expertise that someone ought to be able to help out.

1. On sea route 20 and 21, where are the memory addresses stored representing the levels of the wild tentacool? In grass/caves, this information is stored between D888 and D89A. However I cannot seem to find the specific addresses which determine the levels of the wild tentacool, and even doing a known value search on the hex equivalents of the levels I know to exist (5-40/05-28) still brings up nothing.

2. What are the actual mechanics of the old/good/super rods? As in, where is the likelihood of a bite expressed in the ROM?

3. For more mathematically proficient minds - can someone come up with a formula to determine exactly the odds of catching a specific pokemon in the safari zone upon encounter - furthermore, how could one readily determine the mathematical probability of throwing a rock or bait and quickly factor that into a decision more statistically in favor of being viable? It's too much for me to break down myself at the moment but I have the formulas the game uses if anyone is up to try and tackle this problem.

Anyways I just thought I'd throw this out there to get opinions and hopefully advice from someone who is better versed in ROM-hacking and whatnot.

Re: A pokemon first gen undertaking, a little technical advice needed

Posted by: Bent`
Date: 2014-01-25 01:45:51
These can be answered with the Pokémon Red disassembly.


1. On sea route 20 and 21, where are the memory addresses stored representing the levels of the wild tentacool? In grass/caves, this information is stored between D888 and D89A. However I cannot seem to find the specific addresses which determine the levels of the wild tentacool, and even doing a known value search on the hex equivalents of the levels I know to exist (5-40/05-28) still brings up nothing.


In main.asm, WildDataPointers is a pointer table of wild data, one set per map. The wild data set used on the sea routes is labeled WaterMons. The format of a wild data set is: Land encounter rate, followed (if nonzero) by 7 level/species pairs for land mons; then sea encounter rate, followed (if nonzero) by 7 level/species pairs for sea mons.

To see where these are loaded into memory, look above the pointer table at the LoadWildData function. This loads grass data into the 21 bytes at $d887, and water data into the 21 bytes at $d8a4.


2. What are the actual mechanics of the old/good/super rods? As in, where is the likelihood of a bite expressed in the ROM?


Which mon appears is determined by OldRodCode, GoodRodCode, and SuperRodCode in main.asm. Whether theres a bite at all is checked at Func_707b6 (which should be documented bettercontributions appreciated!).

Re: A pokemon first gen undertaking, a little technical advice needed

Posted by: OwnageMuch
Date: 2014-01-25 16:32:25

3. For more mathematically proficient minds - can someone come up with a formula to determine exactly the odds of catching a specific pokemon in the safari zone upon encounter - furthermore, how could one readily determine the mathematical probability of throwing a rock or bait and quickly factor that into a decision more statistically in favor of being viable? It's too much for me to break down myself at the moment but I have the formulas the game uses if anyone is up to try and tackle this problem.


Ah, the guy from the Mario Kart MB, yes?

I could have a look and see! Please post your formulas at some point!

Re: A pokemon first gen undertaking, a little technical advice needed

Posted by: Jacob91
Date: 2014-01-30 12:54:52
Here's what I have so far. In order for me to actually apply these formulas to come up with the probability of catching a pokemon in the safari zone I'd have to apply the formula to each pokemon that can be found there, as well as each DV.. I'll probably get around to calculating all of that when I've finally finished the rest of the project, which is taking quite some time. Eventually I should be able to provide the basis for the fastest possible catch 'em all strategy as I initially hoped to accomplish through this. Anyways, the formulas are:

Catch % = (S+C+1)/B
Where B = Ball modifier (256 for poke ball, 201 for great ball, 151 for safari/ultra ball), S = Status modifier (25 for asleep or frozen, 12 for poison/burn/paralysis, 4 for no status condition), and C = defending pokemon catch rate (varies per pokemon, can range from 3 for Mewtwo and the legendary birds to 255 for the most common pokemon)

In the safari zone the mechanics can be found at the following page: http://www.dragonflycave.com/safarizone.aspx

Which, actually, the above link has a calculator which works perfectly for my purposes.

When I am finally done dissecting all the probabilities, I'll be sure to share the scans with everyone here. I've already collected all the data I need and now it's just the labor intensive matter of calculating DV spreads and the odds of encountering each possible special in each area. I'm about 1/10 of the way done with that part so it may take a while.

EDIT: I was able to determine the odds of a given encounter by plugging in the order which the pokemon are arranged when displayed in the ROM when entering an area with wild pokemon by correlating the positions with the FFD3 index values. The probabilities are expressed in fractional odds from 51/256 (most common) to 3/256 (most rare) in each area.

One question I'm still unsure how to figure out for myself. How can I determine the actual odds for a bite when fishing? I can't figure out exactly how that could be deduced from the info on that main.asm document (which, btw is an excellent resource).

Also, is there anywhere else in the game where pokemon can appear while surfing except for the sea routes surrounding cinnabar? I don't believe there are but if I'm overlooking any place it would be nice to know.

Re: A pokemon first gen undertaking, a little technical advice needed

Posted by: camper
Date: 2014-01-31 11:04:16

Also, is there anywhere else in the game where pokemon can appear while surfing except for the sea routes surrounding cinnabar? I don't believe there are but if I'm overlooking any place it would be nice to know.

Not that I know of, unless you count surfing in grass.