Swimming optimization: Difference between revisions
(Creating a page for tips and reminders regarding optimal swimming movement for TASers to reference.) |
m (improving some wording) |
||
Line 24: | Line 24: | ||
=== Neutral/Opposite Target Yaw === | === Neutral/Opposite Target Yaw === | ||
The absolute value of Mario's yaw velocity can only ever increase by 16 per frame. However, it can ''decrease'' (return to 0) at different rates. If Mario's desired target yaw velocity has the same sign as his current yaw velocity, it will change by 32 per frame. However, by holding neutral or in the opposite direction on the horizontal axis from Mario's current turning direction, it will change by 64 per frame. Interestingly, this means the input on the joystick's X axis for this in TAS Input will have the ''same'' sign | The absolute value of Mario's yaw velocity can only ever increase by 16 per frame. However, it can ''decrease'' (return to 0) at different rates. If Mario's desired target yaw velocity has the same sign as his current yaw velocity, it will change by 32 per frame. However, by holding neutral or in the opposite direction on the horizontal axis from Mario's current turning direction, it will change by 64 per frame. Interestingly, this means the input on the joystick's X axis for this in TAS Input will have the ''same'' sign as Mario's yaw velocity in the case that it is non-zero. | ||
=== Neutral Wall Diving === | === Neutral Wall Diving === |
Revision as of 06:36, 4 August 2020
This page serves mostly to document important considerations that should be kept in mind when attempting to optimize swimming movement. This page currently only deals with geometric concerns and does not yet address matters such as quickly reaching and maintaining high swimming speeds.
Quick Overview
Unless specified, "most useful swimming states" excludes water plunge, water punch ("water grab"), and water throw.
- Straight Lines: For any given route, it is usually optimal to maximize the time Mario spends moving in a straight line unless water currents are involved.
- Tess Turning: Avoid raw joystick positions with three digit coordinates near maximum pitch or yaw velocity.
- Neutral/Opposite Target Yaw: If a quick decrease in yaw velocity is required, TAS Input's joystick X should be 0 or have the same sign as Mario's yaw velocity.
- Neutral Wall Diving: In most swimming states, swimming against a wall with a non-positive pitch and a vertical joystick position of 0 allows turning downwards at twice normal speed.
- Floor Alignment: Hitting a floor will cap Mario's minimum pitch to be flush with the floor in most useful swimming states. B swimming can be used to circumvent this effect in order to efficiently gain height from sloped floors without sacrificing the ability to swim horizontally.
- Ceiling Pitch Boost: In most swimming states, swimming into a ceiling adds an extra 256 units of downwards turning at the end of the frame, down to a pitch of -12543.
- Zero Pitch Trick: If some frame would naturally have a pitch in the range of -255 to -1 while making Mario turn downwards, make that frame have pitch 0 instead for an extra frame of increased turning speed. This should NOT be used at the same time as Neutral Wall Diving.
- Ledge Clipping: Wall hitboxes are so high and wide that swimming downwards into the floor near a ledge can cause a sizable wall push away from the ledge.
- Ceiling Downwarps: Ceilings can be used to cut out periods of diving and allow that time to be spent covering horizontal distance instead.
Detailed Explanations
Straight Lines
It should not be surprising that between two points in the water with no obstacles or collision nearby, the fastest path between them will be approximately a straight line. Turning should thus be generally kept to individual segments separated by straight lines, unless forced by surrounding geometry and obstacles. For example, intervening whirlpools and other water currents can make moving in a straight line extremely undesirable, as Mario begins to either strain harder and harder to maintain such a line or gets pulled far off course from it.
Tess Turning
Excessive joystick magnitudes can cause floating point rounding errors in the values of the joystick axes, which can sap 1 angle unit from Mario's target yaw velocity or target pitch due to integer rounding.
- In the case of yaw velocity, Mario will turn 639 units per frame instead of 640, leading to increased deviation from an optimal turn on average every 16 frames.
- In the case of pitch, Mario's pitch will be ±16127 instead of ±16128, effectively swimming at an angle 16 units away. With 28 speed, this means:
- Vertical movement is reduced from ~27.99157 units to ~27.99048 units (~0.0038% reduction)
- Total horizontal speed is increased from ~0.68715 units to ~0.73009 units (~6.2486% increase)
Neutral/Opposite Target Yaw
The absolute value of Mario's yaw velocity can only ever increase by 16 per frame. However, it can decrease (return to 0) at different rates. If Mario's desired target yaw velocity has the same sign as his current yaw velocity, it will change by 32 per frame. However, by holding neutral or in the opposite direction on the horizontal axis from Mario's current turning direction, it will change by 64 per frame. Interestingly, this means the input on the joystick's X axis for this in TAS Input will have the same sign as Mario's yaw velocity in the case that it is non-zero.
Neutral Wall Diving
In most swimming actions (but not all - water punch/throw are notable exceptions), hitting a wall while joystick Y is 0 will cause Mario's pitch to move away from 0 by 512 units per frame, all the way to the maximum values. If Mario's pitch *is* 0, it will favor changing to face downwards. This is useful for quickly turning downwards, as normally when Mario is facing downwards, he can only change pitch by 256 units per frame. If this method is used to adjust Mario's pitch on a given frame, then it must be the only method used to do so. This is both due to the vertically neutral joystick requirement and the fact that the step results of 'hit wall'/'hit floor'/'hit ceiling' at the end of the frame are all mutually exclusive.
Floor Alignment
In most swimming actions (but not all - water punch/throw are notable exceptions), hitting a floor will cap Mario's pitch from below at the end of the frame, making him parallel to the ground if he was facing into it before. This can be annoying if a downwards angle is desired, but can also be used to very rapidly switch to upwards swimming. It is still possible to swim at an effective angle of up to 256 or 512 into the floor in these states, since Mario's joystick influence on pitch and subsequent actual movement occur earlier in the frame. Importantly, the fact that B swimming and water throws avoid this phenomenon means that B swimming can utilize sloped floors for efficient simultaneous horizontal and vertical movement, potentially avoiding the need to pitch upwards at all. When very steep slopes are available, it may even be preferable to B swim into them instead of A swimming up the normal way. If A swimming manages to travel less than 16 units horizontally up a slope, then B swimming up it may be preferable. Extremely tall and steep slopes may even make going out of the way to B swim up them desirable. It is also worth noting that if Mario hits a wall
Ceiling Pitch Boost
In most swimming actions (but not all - water punch/throw are notable exceptions), hitting a ceiling will cause Mario's pitch to be decreased by 256 at the end of each frame that Mario's moving pitch is above -12288. This can still be counteracted exactly when Mario's pitch is already negative, and can even be overpowered when his pitch is non-negative. Importantly, though, it can be used to turn downwards an extra 256 units every frame. Since the limit is checked before the 256 units are subtracted and is a non-inclusive limit, it may in some cases be optimal to hold back slightly by up to 256 units to land a pre-movement pitch just above -12288. This will then have 256 subtracted, allowing the end of frame pitch to reach as low as -12543. This strategy of getting an extra frame of bonus turning bears resemblance to the next trick in the list, the Zero Pitch Trick.
Zero Pitch Trick
The rate that Mario can change his pitch without external influences depends on whether or not his pitch is negative (facing downwards). His pitch changes by 256 per frame when it is negative, but by 512 when it is non-negative, including when Mario's pitch is 0. However, target pitch values are rarely actual multiples of 512, leading to the possibility that Mario may lose a frame of higher pitch change due to slightly overshooting past pitch 0. Because of this, if Mario's pitch would naturally land in the range of -255 to -1 while holding upwards on the joystick, it is preferable to instead sacrifice a bit of turning so that Mario's pitch hits 0 on that frame instead. (This is all provided that a more negative pitch is desired to begin with, and that Neutral Wall Diving is not being used)
Ledge Clipping
While swimming, Mario only has 1 single step of movement in the frame, and wall hitboxes are not only located much higher than normal (10 units down instead of 30), but they are also more than twice their usual width. However, floors have the same exact hitboxes as normal. This means it is possible to get a large push while swimming around a ledge, provided Mario has a suitable approach trajectory. By swimming steeply down into a ledge such that Mario's intended next position is at least 10 units below the floor (ignoring integer truncation) and within 110 units of the edge, Mario can be pushed up to 220 units by that single wall. If a wall overlap is available and utilized, that may be able to double the resulting distance Mario is pushed up to 440.
Ceiling Downwarps
While swimming, ceilings naturally downwarp Mario to their height if he tries to enter them (so long as doing so would not put him under the floor), which can be exploited to travel large distances downwards instantly for free. This can allow more of Mario's speed budget to be put into horizontal movement, allowing Mario to cover not only more vertical distance in a given time, but more horizontal distance as well.