Actions

Difference between revisions of "SPG:Rolling"

From Sonic Retro

(New page: Notes: Research applies to all four of the Genesis/Mega Drive games, and Sonic CD. The following only applies when Sonic is on flat, dry land with no special power-ups. Curves, water ph...)
 
m
 
(28 intermediate revisions by 12 users not shown)
Line 1: Line 1:
Notes:
+
{{SPGPages}}
 +
'''Notes:'''
 +
*''The research applies to all four of the [[Sega Mega Drive]] games and [[Sonic CD]].''
  
Research applies to all four of the Genesis/Mega Drive games, and Sonic CD.
+
==Constants==
 +
{| class="prettytable" style="width: auto;"
 +
!Constant
 +
!Value
 +
|-
 +
|'''roll_friction_speed'''
 +
|''0.0234375 (6 subpixels)''
 +
|-
 +
|'''roll_deceleration_speed'''
 +
|''0.125 (32 subpixels)''
 +
|}
  
The following only applies when Sonic is on flat, dry land with no special power-ups.  Curves, water physics, Supersonic, and Super Fast Shoes will be covered in separate guides.
+
==Friction==
  
===Friction===
+
When the Player rolls into a ball by pressing {{down}} on the directional pad, they can no longer accelerate. No matter how hard or how long you press in the direction of their motion, they'll behave as if you weren't doing a thing. The only thing that happens in this case is friction, which is '''roll_friction_speed''', half the Player's regular friction (in Sonic 3K, Super Sonic's roll friction is hard-coded to always be half of the regular friction).
  
When Sonic rolls up by pressing down on the directional pad, he can no longer accelerate.  No matter how hard or how long you press in the direction of his motion, he'll behave as if you weren't doing a thing.  The only thing that happens in this case is friction, here a value of 0.0234375, half of normal so that it feels like he's rolling smoothly like a wheel or a ball.  The Mega Drive actually calculates rolling friction by halving the normal friction value.  If you use the Game Genie to alter the friction value, rolling friction is always half.
+
==Deceleration==
  
===Deceleration===
+
However, the Player ''can'' decelerate while rolling.  If you hold in the opposite direction of their motion, '''''Ground Speed''''' will be slowed by '''roll_deceleration_speed''' each frame.  Additionally, unlike normal walking, friction is still in effect while decelerating. So in effect, while decelerating, '''''Ground Speed''''' slows by '''roll_deceleration_speed''' + '''roll_friction_speed''' (''0.1484375 (38 subpixels)'') every frame.
  
However, Sonic ''can'' decelerate while rolling. If you hold in the opposite direction of his motion, X speed will be slowed by 0.125.  Additionally, unlike normal walking, friction is still in effect while rolling, even if you press in a direction.  So, in effect, while decelerating, X speed slows by 0.125+0.0234375, or 0.1484375, every step.
+
Similar to the anomaly explained in [[SPG:Running#Deceleration|Running]], if absolute '''''Ground Speed''''' is less than that value (''0.1484375 (38 subpixels)''), when this value is subtracted, instead of just setting '''''Ground Speed''''' to ''0'', '''''Ground Speed''''' is set to ''0.5 (128 subpixels)'' in the opposite direction. This means the Player can turn around while rolling, even though they can't accelerate.
  
Strangely, the same deceleration anomaly happens while rolling as while running.  If absolute X speed is less than 0.1484375, when this value is subtracted, instead of just setting X speed to zero, X speed is set to .5 in the opposite direction.  Thus, bizarrely, Sonic can turn around while rolling, even though he can't accelerate!  This is fixed in Sonic 3 and Knuckles, so apparently the programmers themselves found this undesirable.
+
==Top Speed==
  
===Criteria===
+
Just because the Player cannot roll faster on their own, doesn't mean that a nice hill wouldn't give them some momentum (gaining speed on slopes is covered in [[SPG:Slope_Physics#Moving_Along_Slopes|Slope Physics]]). These hills and slopes can be used to roll at a very high speed. Just as with running though, the Player has a top speed cap when rolling as well, though this one is much higher than the former, reaching a top speed of ''16''. Unlike running however, the Player cannot surpass this speed cap by any means. If their '''''X Speed''''' reaches a point where it reaches ''16'', and tries to go higher, it will automatically be set to ''16'' instead. Notice how I said '''''X Speed''''' instead of '''''Ground Speed''''', that's right, it caps the Player's global horizontal velocity, rather than their '''''Ground Speed'''''. This can cause the angle they are moving at to be incorrect compared to the angle they are supposed to be moving (though, floor collision will correct this for the Y axis, so the Player is never misaligned).
  
In Sonic 1 and 2, Sonic can't roll up unless his absolute X speed is greater than 0.53125.
+
The result of all this is that the Player will be able to outrun the camera while in [[SPG:Slope_Physics#The_Four_Modes|wall modes]], but otherwise won't.  
  
In Sonic 3 and Knuckles, this value is increased to 1.03125. This is very convenient, because you have to hold down to Spindash.  If Sonic had to be perfectly still before he could duck, you'd have trouble performing the Spindash quickly and easily.
+
For a more fair limit, you can just cap the '''''Ground Speed''''' instead (before '''''X Speed''''' and '''''Y Speed''''' are set. You can also cap '''''X Speed''''' and '''''Y Speed''''' after to ensure it is enforced). That is, if you want the cap at all.
  
In Sonic 3 and Knuckles, probably as a way to combat the anomaly associated with turning around while rolling in the previous games, Sonic unrolls if absolute X speed falls below .5.
+
==Criteria==
  
===Rolling Jump===
+
In Sonic 1, 2, and 3, the Player can't begin to roll unless absolute '''''Ground Speed''''' is greater than or equal to ''0.5 (128 subpixels)''.
  
In Sonic 1, 2, 3, and Knuckles, you can't control Sonic's trajectory through the air with the directional buttons if you jump while rolling. This makes it kind of hard to Spindash to gain speed, and then make a precise jump.
+
In Sonic and Knuckles (and Sonic 3 and Knuckles), this value is increased to ''1''. This is because the Player is allowed to crouch while their absolute '''''Ground Speed''''' is below ''1'', so they can perform moves such as the Spindash without needing to come to a full stop.
  
However, in Sonic CD, you can control a jump made while rolling, as if it were a totally normal jump.  This is probably more fair to the player.
+
Also in Sonic and Knuckles, probably as a way to combat the anomaly associated with turning around while rolling in the previous games, the Player unrolls if absolute '''''Ground Speed''''' falls below ''0.5 (128 subpixels)''.
+
 
[[Category:Game Information]]
+
If the Player's '''''Ground Speed''''' happens to be ''0'' when they try to initiate a roll (usually impossible, but happens in some cases, for example slowing to a stop in an S Tunnel, and being forced to keep rolling), their '''''Ground Speed''''' will be set to ''2''.
 +
 
 +
==Rolling Jump==
 +
 
 +
In Sonic 1, 2, 3, and Knuckles, you can't control the Player's trajectory through the air with the {{left}}{{right}} buttons if you jump while rolling. Though, in Sonic 3 and in Sonic & Knuckles, you can regain control of the directional keys if you perform a [[Insta-Shield]], or any other jump ability.
 +
 
 +
However, in Sonic CD and Mania, you can control a jump made while rolling, as if it were a totally normal jump.  
 +
 
 +
[[Category:Sonic Physics Guide|Rolling]]

Latest revision as of 06:35, 6 June 2023

Sonic Physics Guide
Collision
Physics
Gameplay
Presentation
Special

Notes:

Constants

Constant Value
roll_friction_speed 0.0234375 (6 subpixels)
roll_deceleration_speed 0.125 (32 subpixels)

Friction

When the Player rolls into a ball by pressing Down on the directional pad, they can no longer accelerate. No matter how hard or how long you press in the direction of their motion, they'll behave as if you weren't doing a thing. The only thing that happens in this case is friction, which is roll_friction_speed, half the Player's regular friction (in Sonic 3K, Super Sonic's roll friction is hard-coded to always be half of the regular friction).

Deceleration

However, the Player can decelerate while rolling. If you hold in the opposite direction of their motion, Ground Speed will be slowed by roll_deceleration_speed each frame. Additionally, unlike normal walking, friction is still in effect while decelerating. So in effect, while decelerating, Ground Speed slows by roll_deceleration_speed + roll_friction_speed (0.1484375 (38 subpixels)) every frame.

Similar to the anomaly explained in Running, if absolute Ground Speed is less than that value (0.1484375 (38 subpixels)), when this value is subtracted, instead of just setting Ground Speed to 0, Ground Speed is set to 0.5 (128 subpixels) in the opposite direction. This means the Player can turn around while rolling, even though they can't accelerate.

Top Speed

Just because the Player cannot roll faster on their own, doesn't mean that a nice hill wouldn't give them some momentum (gaining speed on slopes is covered in Slope Physics). These hills and slopes can be used to roll at a very high speed. Just as with running though, the Player has a top speed cap when rolling as well, though this one is much higher than the former, reaching a top speed of 16. Unlike running however, the Player cannot surpass this speed cap by any means. If their X Speed reaches a point where it reaches 16, and tries to go higher, it will automatically be set to 16 instead. Notice how I said X Speed instead of Ground Speed, that's right, it caps the Player's global horizontal velocity, rather than their Ground Speed. This can cause the angle they are moving at to be incorrect compared to the angle they are supposed to be moving (though, floor collision will correct this for the Y axis, so the Player is never misaligned).

The result of all this is that the Player will be able to outrun the camera while in wall modes, but otherwise won't.

For a more fair limit, you can just cap the Ground Speed instead (before X Speed and Y Speed are set. You can also cap X Speed and Y Speed after to ensure it is enforced). That is, if you want the cap at all.

Criteria

In Sonic 1, 2, and 3, the Player can't begin to roll unless absolute Ground Speed is greater than or equal to 0.5 (128 subpixels).

In Sonic and Knuckles (and Sonic 3 and Knuckles), this value is increased to 1. This is because the Player is allowed to crouch while their absolute Ground Speed is below 1, so they can perform moves such as the Spindash without needing to come to a full stop.

Also in Sonic and Knuckles, probably as a way to combat the anomaly associated with turning around while rolling in the previous games, the Player unrolls if absolute Ground Speed falls below 0.5 (128 subpixels).

If the Player's Ground Speed happens to be 0 when they try to initiate a roll (usually impossible, but happens in some cases, for example slowing to a stop in an S Tunnel, and being forced to keep rolling), their Ground Speed will be set to 2.

Rolling Jump

In Sonic 1, 2, 3, and Knuckles, you can't control the Player's trajectory through the air with the LeftRight buttons if you jump while rolling. Though, in Sonic 3 and in Sonic & Knuckles, you can regain control of the directional keys if you perform a Insta-Shield, or any other jump ability.

However, in Sonic CD and Mania, you can control a jump made while rolling, as if it were a totally normal jump.