Advertisement
exodus122

OoT - Fishing Documentation

Feb 10th, 2019 (edited)
2,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.89 KB | None | 0 0
  1. I've been looking into the fishing code and here is what I know so far:
  2.  
  3. The fishing guy, the fish in tank, and the 15 other fish in the pond all use the same overlay, ovl_Fishing, so they are all actor 0xFE. There are 17 instances of that actor loaded, and they seem to be loaded in the same spot in memory every time you enter the pond. The hylian loach is also the same actor and will have additional instances when they are loaded.
  4.  
  5.  
  6.  
  7. ---Fish Statuses---
  8.  
  9. When you try to catch a fish, there is a short at instance + 0x148 which keeps track of the status of the fish. The statuses are as follows:
  10.  
  11. 0: Scared away, Can't be targeted
  12. 1: Scared away, Swims in circles
  13. 2: Following the lure (also includes looking at it if the lure isn't moving)
  14. 3: About to grab lure
  15. 4: Jumping up to grab the lure
  16. 5: Being reeled in
  17. 6: Caught
  18. 7: unknown
  19. 8: unknown
  20. 9: unknown
  21. 10: Fish lost interest in lure, swimming back to spot. Or in idle swimming animation
  22. 11: Idle (default)
  23. 100: Goes inside tank
  24.  
  25. When the fish has been scared away by either failing to catch it or moving too close to it, it goes to the center of the pond and swims in circles. It quickly swaps between status 0 and 1 during this phase.
  26.  
  27. The ovl_Fishing Update function (vrom: 80A3BDE8 / RAM: 801E9CE8) controls these statuses. Each status uses its own section of the function, and the beginning of the code for each case are the following:
  28.  
  29. 0: 801EA7D8
  30. 1: 801EA8F4
  31. 2: 801EAFA8
  32. 3: 801EB640
  33. 4: 801EB848
  34. 5: 801EBEE0
  35. 6: 801ECE18
  36. 7: 801ED568
  37. 8: 801ED7F0
  38. 9: 801ED7F0
  39. 10: 801EA5A8
  40. 11: 801EA678
  41.  
  42.  
  43.  
  44. ---Size of the Fish---
  45.  
  46. When you enter the pond, fish get assigned a random floating point number at its instance + 0x19C which determines its size. The sizes are affected by your age, but not affected by time of day.
  47.  
  48.  
  49. Fish Location Map: https://i.imgur.com/2MhchRK.png
  50. The numbers are in the order they are loaded into the scene, from 1 to 15. Numbers 16 and 17 are the Hylian Loach spawns. If you enter the pond as child after having paid for fishing 3 times, two Hylian Loaches will be loaded, 16 and 17. If you enter the pond as adult after having paid for fishing 3 times, only one Hylian Loach will be loaded, 16.
  51.  
  52.  
  53. Fish Size Ranges:
  54.  
  55. Use the map above to know which fish is which
  56.  
  57. Instance Number Min Size (Child) Max Size (Child) Min Size (Adult) Max Size (Adult)
  58. 80200F60 1 27.74 31.39 38 42.9
  59. 802015F0 2 26.28 29.93 36 40.9
  60. 80201C80 3 29.93 33.58 41 45.9
  61. 80202310 4 25.55 29.2 35 39.9
  62. 802029A0 5 28.47 32.12 39 43.9
  63. 80203030 6 32.12 35.77 44 48.9
  64. 802036C0 7 29.2 32.85 40 44.9
  65. 80203D50 8 24.82 28.47 34 38.9
  66. 802043E0 9 39.42 43.07 54 58.9
  67. 80204A70 10 34.31 37.96 47 51.9
  68. 80205100 11 30.66 34.31 42 46.9
  69. 80205790 12 24.09 27.74 33 37.9
  70. 80205E20 13 41.61 45.26 57 61.9
  71. 802064B0 14 45.99 55.48* 63 75.9*
  72. 80206B40 15 51.83 61.32* 71 83.9*
  73. 802071D0 16 32.85 36.5 45 49.9 (Loach 1)
  74. 80207840 17 31.39 35.04 43 47.9 (Loach 2)
  75.  
  76. * Fish 14 and 15 are special. They have a random "original weight' in the range of [63, 68) and [71, 76), respectively. This number is multiplied by 0.73 to get the "child weight". However, before that is done, the fish can randomly have bonus weight added. If their "original weight" is larger than 65, they have a 5% chance of getting a bonus weight added. The bonus weight is a random number in the range [0, 8). This makes the maximum possible weight just under 84. In the chart above, I included these bonus weights in the maximum weights for Fish 14 and 15.
  77.  
  78. The Loaches are also interesting. When you catch them, their "size" is doubled in the text box. For example, if you catch a size 36 loach, it is displayed as 72, or 19 pounds.
  79.  
  80.  
  81.  
  82. Weight Conversion Chart:
  83.  
  84. Pounds Size Range of sizes per pound
  85. 2 [24, 27) 3
  86. 3 [27, 32) 5
  87. 4 [32, 36) 4
  88. 5 [36, 40) 4
  89. 6 [40, 43) 3
  90. 7 [43, 46) 3
  91. 8 [46, 49) 3
  92. 9 [49, 52) 3
  93. 10 [52, 55) 3
  94. 11 [55, 57) 2
  95. 12 [57, 59) 2
  96. 13 [59, 62) 3
  97. 14 [62, 64) 2
  98. 15 [64, 66) 2
  99. 16 [66, 68) 2
  100. 17 [68, 70) 2
  101. 18 [70, 72) 2
  102. 19 [72, 74) 2
  103. 20 [74, 76) 2
  104. 21 [76, 78) 2
  105. 22 [78, 80) 2
  106. 23 [80, 82) 2
  107. 24 [82, 84) 2
  108.  
  109.  
  110. ---Minimum Fish Sizes for receiving rewards from the Fishing Guy---
  111.  
  112. Child:
  113. 41: Blue Rupee. This means most but not all 6 pound fish are large enough to get the reward
  114. 50: Heart Piece. This means most but not all 9 pound fish are large enough to get the reward
  115.  
  116. Adult:
  117. 46: Blue Rupee. All 8 pound fish are large enough
  118. 50: Red Rupee. This means most but not all 9 pound fish are large enough to get the reward
  119. 60: Gold Scale. This means most but not all 13 pound fish are large enough to get the reward
  120.  
  121.  
  122.  
  123. ---Largest and smallest possible fish by Age---
  124.  
  125. Time of day does not affect fish size.
  126.  
  127. Minimum fish size as child: 2 pounds or 24.09
  128. Maximum fish size as child: 13 pounds or 61.3
  129.  
  130. Minimum fish size as adult: 4 pounds or 33
  131. Maximum fish size as adult: 24 pounds or 83.9
  132.  
  133.  
  134. ---Time of Day Information---
  135.  
  136. At certain times of the day, right before dusk and dawn, the fish will start swimming around rapidly and jumping out of the water.
  137.  
  138. This lasts about 20 seconds and starts when time of day is 49200 (before night) or 15000 (before day).
  139.  
  140. Fish have a higher bite rate during certain time ranges:
  141. 1.5x from 5:00 to 7:00 (3556 - 4aaa)
  142. 1.75x from 17:00 to 19:00 (b555 - caab)
  143.  
  144. Time of day passes very slowly in the pond compared to outside. It goes at 1/10th of the normal speed
  145. Outside of the pond, time of day increases by 10 per frame at day, and 20 per frame at night.
  146. Inside the pond, Time of day increases by 1 per frame at day, and 2 per frame at night.
  147.  
  148.  
  149. ---The range at which a fish can grab the lure depends on its size---
  150.  
  151. To calculate if a fish is close enough to the lure to grab it, it checks the following equation:
  152.  
  153. xyz_distance_between_fish_and_lure < (size/2)
  154.  
  155. This means larger fish can grab the lure from further away.
  156.  
  157. There is a byte at instance + 0x14E which keeps track of whether or not the fish is close enough to grab the lure. If that equation is true, the fish is close enough to grab the lure this frame, and 0x14E is set to 1. If it's false, the fish cannot grab the lure this frame, and 0x14E is set to 0.
  158.  
  159.  
  160.  
  161. ---Status 2: How likely the fish is to grab the lure each frame it is in the "Following lure" status---
  162.  
  163. Every frame, the "Update" function gets called for each instance and it performs a different action depending on what the instance's status is on that frame. The two most interesting ones are 2, when the fish is following the lure and deciding whether or not to grab it, and 5, when the fish is being reeled in. I haven't looked into the reeling in section yet.
  164.  
  165. I've looked into Status 2 and the logic is pretty complicated.
  166.  
  167. Each frame, it checks if the fish is out of the range to grab the lure (0x14E == 0). If it is, a random number in the range [0, 10) is generated and saved to instance + 0x14A, a short. If 0x14E is 1, 0x14A counts down by 1 every frame until it reaches 0, where it stops.
  168.  
  169. Next, the logic in the Update function performs this each frame:
  170.  
  171. if(0x14A timer == 1) {
  172. generate a random float between 0 and 1
  173. if(that random number < 0.06)
  174. grab the lure this frame
  175. }
  176. else {
  177. generate a random float between 0 and 1
  178. if (that random number < 0.03) {
  179. generate another random number between 0 and 1
  180. if(that random number < 0.06)
  181. grab the lure this frame
  182. }
  183. }
  184.  
  185. So each frame, there is a 0.18% chance of the fish grabbing the lure when 0x14A != 1.
  186. When 0x14A == 1, there is a 6% chance of the fish grabbing the lure.
  187.  
  188. This means a fish is more likely to grab the lure shortly after it comes back into range of the lure.
  189.  
  190.  
  191.  
  192. ---Status 2: When fish loses interest in the lure and swims away---
  193.  
  194. When the fish starts following/looking at the lure (status changes to 2) a random number in the range [100, 200) is generated to decide how many frames it will follow the lure. Instance+0x16E is a short which stores this timer, which counts down by 1 every frame the fish is following the lure. When it reaches 0, the fish will swim away. This means a fish will follow the lure for a random amount between 5 and 10 seconds. If the lure is moving when the timed runs out, the timer gets restarted with a new random number.
  195.  
  196.  
  197.  
  198. ---How long it takes for a fish to return after it goes to the center of the pond---
  199.  
  200. -If you fail to catch the fish while reeling it in, it will stay in the center of the pond for 500 seconds, then go back to its original spot.
  201. -If you scare away a fish by getting to close to it, it will stay in the center of the pond for 50 seconds, then go back to its original spot.
  202.  
  203.  
  204.  
  205. Takeaways:
  206. -The size of each fish is randomly decided each time you enter the pond and determines how far away they can be from the lure and still grab it. The sizes are consistently larger as adult than as child.
  207. -The fish randomly decides whether or not to grab the lure each frame it is looking at the lure.
  208. -The amount of time the fish follows at the lure before losing interest is a random number between 5 and 10 seconds. If the lure is moving when the timed runs out, it restarts.
  209. -Fish get scared off for 500 seconds if they let go of the lure, but only 50 seconds if you walk or swim up to them
  210.  
  211.  
  212.  
  213. Fish instance documentation:
  214. https://wiki.cloudmodding.com/oot/Actors#Structure for offsets 0 through 0x13C
  215.  
  216. 0x148 (short) - Status
  217. 0x14C (short) - How many frames it's been loaded in the scene
  218. 0x14E (short) - Flag: (1 = close enough to the lure to grab it, 0 = not close enough)
  219. 0x16A (short) - Timer used to increase the chances of the fish to grab the lure, among other things
  220. 0x16E (short) - Follow Lure Timer (counts down to 0)
  221. 0x190 (short) - Timer for flop animation
  222. 0x194 (short) - Timer for how long the fish will stay in the center of the pond after it's scared away
  223. 0x19C (float) - Size of the fish
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement