Actions

Difference between revisions of "SPG:Underwater"

From Sonic Retro

m (Underwater Constants)
(Added information regarding the air/breathing mechanics underwater, and more information about drowning.)
Line 4: Line 4:
 
*''When [[Sonic]] is underwater he moves much more slowly, but otherwise his physics are largely the same.  This is achieved mostly by halving the pertinent variables, but some, like gravity and initial jump velocity, are not exactly half.''
 
*''When [[Sonic]] is underwater he moves much more slowly, but otherwise his physics are largely the same.  This is achieved mostly by halving the pertinent variables, but some, like gravity and initial jump velocity, are not exactly half.''
  
==Underwater Constants==
+
==Air==
 +
While underwater, the Player can last 30 seconds before drowning. The Player's air value (we'll call this '''remaining_air''') starts at a value of 30 upon entering the water. As you would imagine, once '''remaining_air''' reaches 0, the Player will drown.
 +
 
 +
This value represents the amount of seconds of air the Player has left. Meanwhile, a timer counts down from 60 each second. Each time this timer reaches 0, the "air event" occurs:
 +
 
 +
===Air Event===
 +
Each air event, the following happens:
 +
====Air Check====
 +
Firstly, '''remaining_air''' is checked. At certain air values, different actions will be performed:
 +
* ['''25, 20, 15'''] a warning chime is sounded.
 +
* ['''12'''] the drowning music begins.
 +
* ['''12, 10, 8, 6, 4, 2'''] a warning number bubble (the count down) will be emitted (these will be the numbers 5, 4, 3, 2, 1, or 0).
 +
* ['''0'''] Sonic drowns.
 +
 
 +
====Air Decrease====
 +
Secondly, 1 is subtracted from '''remaining_air'''.
 +
 
 +
====Breathing Bubbles====
 +
Thirdly, small bubbles are emitted from the Player's mouth. We'll call these "breathing bubbles".
 +
 
 +
Breathing bubbles spawn at the Player's X Position + 6 (or X Position - 6 when facing left) and at the Player's Y Position.
 +
 
 +
The number of breathing bubbles is either 1 or 2, chosen at random (the is an equal chance of either amount). If the number of breathing bubbles is 2, the second will spawn at a random interval between 1 to 16 frames later.
 +
 
 +
Notes:
 +
* ''The sine movement of the bubble is adjusted based on the way the Player is facing to ensure the bubble begins by moving away from the Player's mouth.''
 +
* ''When moving through a water tunnel like those in Labyrinth Zone, the breathing bubbles that spawn will move to the right by 4 pixels per frame.''
 +
 
 +
===Count Down Warning===
 +
If at the current ''air event'' a warning number bubble is to be emitted, this warning bubble will be spawned as of one of the breathing bubbles from the Player's mouth.
 +
 
 +
If only 1 breathing bubble is emitted, that must be the number bubble. If 2 breathing bubbles are to be emitted, there is a quarter chance that the first will be the warning bubble, otherwise the second breathing bubble must be the warning bubble.
 +
 
 +
==Underwater Physics==
 +
===Constants===
 
   acceleration_speed: 0.0234375 (half of 0.046875)
 
   acceleration_speed: 0.0234375 (half of 0.046875)
 
   deceleration_speed: 0.25 (half of 0.5)
 
   deceleration_speed: 0.25 (half of 0.5)
Line 19: Line 53:
 
   jump_release: -2 (instead of -4)
 
   jump_release: -2 (instead of -4)
  
==Getting Hit==
+
===Getting Hit===
 
When [[SPG:Getting_Hit|getting hit]] underwater, the Player will fly back with an X Speed of 1 (or -1) and a Y Speed of -2, half that of normal.
 
When [[SPG:Getting_Hit|getting hit]] underwater, the Player will fly back with an X Speed of 1 (or -1) and a Y Speed of -2, half that of normal.
  
==Bubbles==
+
===Bubbles===
  
 
When the Player gets a bubble underwater, their X Speed and Y Speed are both set to 0.
 
When the Player gets a bubble underwater, their X Speed and Y Speed are both set to 0.
  
==Entry & Exit==
+
===Entry & Exit===
  
 
When the Player enters the water, their X Speed is multiplied by 0.5 and their Y Speed is multiplied by 0.25 (this occurs after ''gravity_force'' is added to Y Speed).  
 
When the Player enters the water, their X Speed is multiplied by 0.5 and their Y Speed is multiplied by 0.25 (this occurs after ''gravity_force'' is added to Y Speed).  
 
Conversely, when the Player exits the water, their Y Speed is doubled (after water ''gravity_force'' has been added), (however, X Speed is ''not'' affected when leaving the water).
 
Conversely, when the Player exits the water, their Y Speed is doubled (after water ''gravity_force'' has been added), (however, X Speed is ''not'' affected when leaving the water).
 +
 +
===Speed Shoes===
 +
 +
When in possession of [[Speed Shoes]], but also underwater, the underwater variables take over, effectively nullifying the Speed Shoes altogether.  No calculations, such as multiplying by 0.5, take place.
  
 
==Drowning==
 
==Drowning==
Line 35: Line 73:
 
When the Player drowns, their X Speed and Y Speed are both set to 0, and the ''gravity_force'' remains set to the lower water gravity.
 
When the Player drowns, their X Speed and Y Speed are both set to 0, and the ''gravity_force'' remains set to the lower water gravity.
  
==Speed Shoes==
+
===Drowning Bubbles===
  
When in possession of [[Speed Shoes]], but also underwater, the underwater variables take over, effectively nullifying the Speed Shoes altogether. No calculations, such as multiplying by 0.5, take place.
+
When drowning, 11 bubbles are created from the Player's mouth as they fall offscreen.
 +
The first bubble can spawn from 0 to 15 frames after drowning, chosen at random. Subsequent bubbles spawn 1 to 8 frames apart, also chosen at random.
 +
 
 +
Each of the 11 bubbles has a quarter chance of being a medium bubble, otherwise it will be a small bubble.
  
 
==Animation Speeds==
 
==Animation Speeds==

Revision as of 07:07, 21 February 2023

Sonic Physics Guide
Collision
Physics
Gameplay
Presentation
Special

Notes:

  • The research applies to all four of the Sega Mega Drive games and Sonic CD.
  • When Sonic is underwater he moves much more slowly, but otherwise his physics are largely the same. This is achieved mostly by halving the pertinent variables, but some, like gravity and initial jump velocity, are not exactly half.

Air

While underwater, the Player can last 30 seconds before drowning. The Player's air value (we'll call this remaining_air) starts at a value of 30 upon entering the water. As you would imagine, once remaining_air reaches 0, the Player will drown.

This value represents the amount of seconds of air the Player has left. Meanwhile, a timer counts down from 60 each second. Each time this timer reaches 0, the "air event" occurs:

Air Event

Each air event, the following happens:

Air Check

Firstly, remaining_air is checked. At certain air values, different actions will be performed:

  • [25, 20, 15] a warning chime is sounded.
  • [12] the drowning music begins.
  • [12, 10, 8, 6, 4, 2] a warning number bubble (the count down) will be emitted (these will be the numbers 5, 4, 3, 2, 1, or 0).
  • [0] Sonic drowns.

Air Decrease

Secondly, 1 is subtracted from remaining_air.

Breathing Bubbles

Thirdly, small bubbles are emitted from the Player's mouth. We'll call these "breathing bubbles".

Breathing bubbles spawn at the Player's X Position + 6 (or X Position - 6 when facing left) and at the Player's Y Position.

The number of breathing bubbles is either 1 or 2, chosen at random (the is an equal chance of either amount). If the number of breathing bubbles is 2, the second will spawn at a random interval between 1 to 16 frames later.

Notes:

  • The sine movement of the bubble is adjusted based on the way the Player is facing to ensure the bubble begins by moving away from the Player's mouth.
  • When moving through a water tunnel like those in Labyrinth Zone, the breathing bubbles that spawn will move to the right by 4 pixels per frame.

Count Down Warning

If at the current air event a warning number bubble is to be emitted, this warning bubble will be spawned as of one of the breathing bubbles from the Player's mouth.

If only 1 breathing bubble is emitted, that must be the number bubble. If 2 breathing bubbles are to be emitted, there is a quarter chance that the first will be the warning bubble, otherwise the second breathing bubble must be the warning bubble.

Underwater Physics

Constants

 acceleration_speed: 0.0234375 (half of 0.046875)
 deceleration_speed: 0.25 (half of 0.5)
 friction_speed:  0.0234375 (half of 0.046875)
 top_speed: 3 (half of 6)
 
 air_acceleration_speed:  0.046875 (half of 0.09375)
 
 roll_friction_speed: 0.01171875 (half of 0.0234375)
 roll_deceleration_speed: 0.125 (unchanged)
 
 gravity_force: 0.0625 (instead of 0.21875)
 jump_force: 3.5  (3 for knuckles) (instead of 6.5  (6 for knuckles))
 jump_release: -2 (instead of -4)

Getting Hit

When getting hit underwater, the Player will fly back with an X Speed of 1 (or -1) and a Y Speed of -2, half that of normal.

Bubbles

When the Player gets a bubble underwater, their X Speed and Y Speed are both set to 0.

Entry & Exit

When the Player enters the water, their X Speed is multiplied by 0.5 and their Y Speed is multiplied by 0.25 (this occurs after gravity_force is added to Y Speed). Conversely, when the Player exits the water, their Y Speed is doubled (after water gravity_force has been added), (however, X Speed is not affected when leaving the water).

Speed Shoes

When in possession of Speed Shoes, but also underwater, the underwater variables take over, effectively nullifying the Speed Shoes altogether. No calculations, such as multiplying by 0.5, take place.

Drowning

When the Player drowns, their X Speed and Y Speed are both set to 0, and the gravity_force remains set to the lower water gravity.

Drowning Bubbles

When drowning, 11 bubbles are created from the Player's mouth as they fall offscreen. The first bubble can spawn from 0 to 15 frames after drowning, chosen at random. Subsequent bubbles spawn 1 to 8 frames apart, also chosen at random.

Each of the 11 bubbles has a quarter chance of being a medium bubble, otherwise it will be a small bubble.

Animation Speeds

Being submerged doesn't affect the speed of the Player's animations at all. Variable Speed Animations will be attenuated by the same proportion automatically.