Blinking: Difference between revisions
(Revamped page. Mr. I and Eyerokc still need to be finished) |
SuperHamster (talk | contribs) m (→References: List syntax) |
||
(One intermediate revision by one other user not shown) | |||
Line 22: | Line 22: | ||
The Penguins (small and large) use the global timer to control their blinking. The Penguin's blinking timer is taken from the global timer modulo 50. When the timer is greater than 43, the Penguin starts to blink. The Penguin's eyes are partially closed for 2 frames, then closed for 2 frames, then partially closed for 3 frames, and then open again. Thus, the Penguins blink every 50 frames and the animation lasts 7 frames. Since the global timer increments while the game is paused, Penguins will blink even when the game is paused. | The Penguins (small and large) use the global timer to control their blinking. The Penguin's blinking timer is taken from the global timer modulo 50. When the timer is greater than 43, the Penguin starts to blink. The Penguin's eyes are partially closed for 2 frames, then closed for 2 frames, then partially closed for 3 frames, and then open again. Thus, the Penguins blink every 50 frames and the animation lasts 7 frames. Since the global timer increments while the game is paused, Penguins will blink even when the game is paused. | ||
=== | ===Common Enemy=== | ||
This system is used by Goombas, Pokeys, Lakitus, Koopas, and Koopa the Quick. This system uses a countdown timer with a randomly generated number. When the countdown timer is below a certain value, the object blinks, and then calls RNG to determine a new number to begin the countdown from. Goombas blink when the countdown is from 5 to 0, and the countdown is reset to a number between 30 and 79. Pokeys blink when the countdown is from 4 to 0, and the countdown is reset to a number between 30 and 89. Lakitus blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 59. Koopas blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 69. Koopa the Quick blinks when the countdown is from 3 to 0, and the countdown is reset to a number between 10 and 24. | This system is used by Goombas, Pokeys, Lakitus, Koopas, and Koopa the Quick. This system uses a countdown timer with a randomly generated number. When the countdown timer is below a certain value, the object blinks, and then calls RNG to determine a new number to begin the countdown from. Goombas blink when the countdown is from 5 to 0, and the countdown is reset to a number between 30 and 79. Pokeys blink when the countdown is from 4 to 0, and the countdown is reset to a number between 30 and 89. Lakitus blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 59. Koopas blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 69. Koopa the Quick blinks when the countdown is from 3 to 0, and the countdown is reset to a number between 10 and 24. | ||
=== | ===RNG=== | ||
This system is used by Bob-ombs and Yoshi. Bob-ombs call RNG every frame to determine if they should blink. Specifically, it calls for a random float between 0 and 1, which is then multiplied by 100 and cast to an integer. If the integer it is cast to is 0 (the random float is less than 1/100), the Bob-omb begins its blinking animation. The animation lasts 15 frames, after which the game calls for RNG again. Thus, Bob-ombs and Yoshi will blink about once every 100 frames on average. However, since this is completely based on RNG, in practice this can be made much shorter or longer with RNG manipulation. | This system is used by Bob-ombs and Yoshi. Bob-ombs call [[RNG]] every frame to determine if they should blink. Specifically, it calls for a random float between 0 and 1, which is then multiplied by 100 and cast to an integer. If the integer it is cast to is 0 (the random float is less than 1/100), the Bob-omb begins its blinking animation. The animation lasts 15 frames, after which the game calls for RNG again. Thus, Bob-ombs and Yoshi will blink about once every 100 frames on average. However, since this is completely based on RNG, in practice this can be made much shorter or longer with RNG manipulation. | ||
==References== | ==References== | ||
* [https://www.youtube.com/watch?v=yvxdLH1ejaA "Blinking" by Pannenkoek2012] | |||
[https://www.youtube.com/watch?v=yvxdLH1ejaA "Blinking" by Pannenkoek2012] | * [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/mario_misc.c#L360 Mario's blinking code] | ||
* [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/mario_actions_cutscene.c#L206 Peach's blinking code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/mario_misc.c#L360 Mario's blinking code] | * [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/bowser.inc.c#L1179 Bowser's Eye code] | ||
* [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/tuxie.inc.c#L286 Penguin blinking code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/mario_actions_cutscene.c#L206 Peach's blinking code] | * [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/obj_behaviors_2.c#L582 Common enemy blinking code] | ||
* [https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/bobomb.inc.c#L215 Bob-omb blinking code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/bowser.inc.c#L1179 Bowser's Eye code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/tuxie.inc.c#L286 Penguin blinking code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/obj_behaviors_2.c#L582 Common enemy blinking code] | |||
[https://github.com/n64decomp/sm64/blob/06ec56df7f951f88da05f468cdcacecba496145a/src/game/behaviors/bobomb.inc.c#L215 Bob-omb blinking code] | |||
[[Category:Mechanics]] | [[Category:Mechanics]] |
Latest revision as of 07:51, 8 May 2021
You may be looking for Hitstun blinking, the cause of Pause buffered hitstun.
Blinking is the phenomenon in which many objects appear to blink their eyes.
The only creatures that blink are Mario, Peach, Bowser, Eyerok, Pokeys, Koopas of all kinds (including Koopa the Quick), Goombas, Lakitu, Penguins of all kinds, Bob-ombs, Pink Bob-ombs, Mr. I, and Yoshi. Of these, Mr. I and Eyerok blink based on Mario's interactions with them. All other creatures blink idly.
Blinking Systems
There are several different blinking systems the game uses to determine when an object should blink.
Mario/Peach
The Mario/Peach blinking system uses the game's animation timer to determine when Mario and Peach should blink. Mario and Peach each have a blinking animation that lasts 14 frames, and the game performs bitwise calculations each frame to determine whether or not to play the animation. These calculations make it so that Mario will blink every 64 frames, and Peach will blink every 64 frames. However, Peach's blinking animation is offset from Mario's by 32, meaning that they will never blink at the same time.
Bowser
If the difference between Bowser's moving angle and his angle to Mario is greater than 45 degrees, Bowser looks to the side and does not blink unless his blinking animation has already started. If Bowser is not looking to the side, he will do his blinking animation every 64 frames. The blinking animation takes 16 frames to complete, 4 of which have Bowser's eyes partially closed, 4 of which have Bowser's eyes completely closed, and 8 of which have Bowser's eyes open. Because Bowser's blinking counter increments when the game is paused, Bowser will blink when the game is paused if he is not looking to the side.
Penguins
The Penguins (small and large) use the global timer to control their blinking. The Penguin's blinking timer is taken from the global timer modulo 50. When the timer is greater than 43, the Penguin starts to blink. The Penguin's eyes are partially closed for 2 frames, then closed for 2 frames, then partially closed for 3 frames, and then open again. Thus, the Penguins blink every 50 frames and the animation lasts 7 frames. Since the global timer increments while the game is paused, Penguins will blink even when the game is paused.
Common Enemy
This system is used by Goombas, Pokeys, Lakitus, Koopas, and Koopa the Quick. This system uses a countdown timer with a randomly generated number. When the countdown timer is below a certain value, the object blinks, and then calls RNG to determine a new number to begin the countdown from. Goombas blink when the countdown is from 5 to 0, and the countdown is reset to a number between 30 and 79. Pokeys blink when the countdown is from 4 to 0, and the countdown is reset to a number between 30 and 89. Lakitus blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 59. Koopas blink when the countdown is from 4 to 0, and the countdown is reset to a number between 20 and 69. Koopa the Quick blinks when the countdown is from 3 to 0, and the countdown is reset to a number between 10 and 24.
RNG
This system is used by Bob-ombs and Yoshi. Bob-ombs call RNG every frame to determine if they should blink. Specifically, it calls for a random float between 0 and 1, which is then multiplied by 100 and cast to an integer. If the integer it is cast to is 0 (the random float is less than 1/100), the Bob-omb begins its blinking animation. The animation lasts 15 frames, after which the game calls for RNG again. Thus, Bob-ombs and Yoshi will blink about once every 100 frames on average. However, since this is completely based on RNG, in practice this can be made much shorter or longer with RNG manipulation.