don't click here

Help understanding a Mario physics guide...

Discussion in 'Technical Discussion' started by Travelsonic, Jun 15, 2015.

  1. Travelsonic

    Travelsonic

    Member
    826
    20
    18
    So I wanted to try my hand at making a simple Mario clone. Being a stickler for accuracy physics-wise, I looked for information, until I saw a guide on the MFGG.
    Link to guide (a giant PNG)

    Right now, however, I am being somewhat thrown off by the way the data is presented. For example, skidding deceleration ... subtracts 0 blocks, 0 pixels, 1 subpixel, 10 subsub-pixels, and 0 subsubsubpixels from the appropriate values?

    Ugh, my head fucking hurts trying to understand this...
     
  2. Covarr

    Covarr

    Sentient Cash Register Member
    4,233
    3
    18
    Trapped in my own thoughts.
    Two stageplays, a screenplay, and an album
    I can't help be of much help, but I can warn you to keep in mind that rebounding off bricks is different between NES and SNES versions of SMB1 due to a bug in Super Mario All-Stars. I didn't notice any mention of this in the guide you linked.
     
  3. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,338
    412
    63
    Lincs, UK
    TurBoa, S1RL
    Where did you even get those numbers? Next to "Skid Deceleration (normal)" I see "0020", which is 2 subpixels (or 0x20 = 32 subsubpixels (or Sonic-style subpixels)).

    For a start, it's in hex; as such, each is 16 times smaller than the previous element. So there are 16 pixels to a block, 16 subpixels to a pixel, 16 subsubpixels to a subpixel; this means 256 subsubpixels to a pixel.

    In other words, 1 subpixel = 1/16 pixel = 0.0625 pixels; 1 subsubpixel = 1/256 pixel = 0.00390625 pixels. "0020" is therefore 2 subpixels = 0.125 pixels. "0280" is 2 pixels and 8 subpixels, or 0x28 = 40 subpixels. Either way, it's 2.5 pixels.

    Here, let me translate the bulk of it into pure pixels:

    Code (Text):
    1. GROUND PHYSICS
    2.  
    3. Flat Ground Physics
    4.  
    5.                                 px/f
    6. Max velocity (walking)        - 1.5
    7. Max velocity (running)        - 2.5
    8. Max velocity (sprinting)      - 3.5
    9. End-of-level walk speed       - 1.25
    10. Airship cutscene walk speed   - 2
    11.  
    12.                                 px/f^2
    13. Walk/run/sprint acceleration  - 0.0546875
    14. Stop Deceleration (normal)    - 0.0546875
    15. Stop Deceleration (ice)       - 0.01171875
    16. Skid Deceleration (normal)    - 0.125
    17. Skid Deceleration (ice)       - 0.046875
    18.  
    19. Sloped Ground Physics
    20.  
    21.                                 px/f
    22. Uphill maximum walk speed     - 0.8125
    23. Uphill maximum run speed      - 1.375
    24. Sliding max speed             - 3.9375
    25.  
    26.                                 px/f^2
    27. Added downhill speed (26 deg) - 0.125
    28. Added downhill speed (45 deg) - 0.1875
    29. Sliding accel/decel (26 deg)  - 0.0625
    30. Sliding accel/decel (45 deg)  - 0.125
    31.  
    32. MIDAIR PHYSICS
    33.  
    34. If Small, Big, Fiery or Hammer Mario:
    35. - Releasing B and/or Left/Right has no effect on your speed.
    36. - Holding the direction of motion accelerates you at a rate of 0.0546875 px/f^2 (up to 1.5, 2.5, or 3.5 px/f)
    37. - Holding the direction opposite motion decelerates you at a rate of 0.125 px/f^2
    38.  
    39. If Raccoon or Tanooki Mario and NOT in flight mode,
    40. - Releasing Left/Right decelerates you at a rate of about 0.0625 px/f^2 until you reach a speed of 1.4375 px/f
    41. - Holding the direction of motion accelerates you at a rate of 0.0546875 px/f^2 (up to 1.5 or 2.5 px/f)
    42. - Holding the direction opposite motion decelerates you at a rate of 0.1875 px/f^2
    43.  
    44. If Raccoon or Tanooki Mario and in flight mode,
    45. - Even when holding B and the direction of flight, you will decelerate at a rate of 0.015625 px/f^2 until you reach a speed of 1.4375 px/f
    46. - Releasing Left/Right decelerates you at a rate of 0.0625 px/f^2 until you reach a speed of 1.4375 px/f
    47. - Holding the direction of motion accelerates you at a rate of 0.0546875 px/f^2 (up to 1.4375 px/f)
    48. - Holding the direction opposite motion decelerates you at a rate of 0.1875 px/f^2
    49.  
    50. JUMP PHYSICS
    51.  
    52.                                 px/f
    53. Jump, X Velocity < 1 px/f (-Y)  3.4375
    54. Jump, X Velocity > 1 px/f (-Y)  3.5625
    55. Jump, X Velocity > 2 px/f (-Y)  3.6875
    56. Jump, X Velocity > 3 px/f (-Y)  3.9375
    57. Enemy Stomp Speed (-Y)          4
    58. Weak Enemy Stomp (-Y)           3
    59. Maximum Downward Speed (+Y)     4.3125
    60. Raccoon Flying (-Y)             1.5
    61. Raccoon Slowed Descent (+Y)     1
    62.  
    63.                                 px/f^2
    64. Jump Gravity
    65.   (A held, Y Vel < -2 px/f)     0.0625
    66.   (Y Vel > -2 px/f)             0.3125
    67.  
    68. SWIMMING PHYSICS
    69.  
    70.                                 px/f
    71. Underwater max walk speed       1
    72. Maximum underwater Y-speed (+Y) 2
    73. Max swimming speed              3
    74. Jump out of water init vel (-Y) 3.1875
    75.  
    76.                                 px/f^2
    77. Y Acceleration (moving up)      0.0625
    78. Y Acceleration (moving down)    0.03125
    79. Y Acceleration (at surface, +Y) 0.046875
    80. X Acceleration (get to speed)   0.0234375
    81. X Acceleration (no direction)   0.0078125
    82. X Acceleration (turning around) 0.03125
    That's not everything, but it's most of it. You should be able to work out how I got the values I did from the ones in the image.
     
  4. Travelsonic

    Travelsonic

    Member
    826
    20
    18
    From the fact that the information was not laid out in a manner that made it easy to understand to me. at least + massive sleep deprivation.

    EDIT: I mean, if the numbers are floating point, what each data type represents, etc, should be better defined, clarified, considering hexadecimal can represent while integer, and floating point, and as your numbers show, you can not assume (plus, THAT was never specified, a big mistake IMO when explaining it even to people with an understanding of counting in numerous integer bases. I kinda went through a similar point of clarification when it came to a guide I saw on Konami's Dance Dance Revolution series' stepchart format, but in that case, bytes, bits, nibbbles, elementary units, were being mixed up.
     
  5. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
    I imagine they're fixed-point, not floating-point. Similar end goal (decimals!), wildly different means of achieving it.
     
  6. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,338
    412
    63
    Lincs, UK
    TurBoa, S1RL
    They're fixed point. They're integer numbers of "subsubpixels", which is just their name for "1/256th of a pixel".

    In other words, divide those hex numbers by 0x100 and you have the number in pixels.
     
  7. Travelsonic

    Travelsonic

    Member
    826
    20
    18
    Thanks for that clarification. I wish the person who had made the guides originally clarified that, but hey, no big deal. :D

    EDIT: I might actually suggest a revision where the author puts in that it is fixed point, and suggest doing what you said, DigitalDuck, for getting the number in pixels. I mean, subpixels *arguably* could be an indication that it is fixed-point, but it seems like something that might not be intuitive.
     
  8. winterhell

    winterhell

    Member
    1,165
    7
    18
    The author might be writing "floating point" for layman's sake. As far as the general public is concerned, the notion of a fixed point is less known ( even though integer is techically fixed point as well). Thats why he might be using such terms.

    Its like calling the japanese Hiragana and Katakana alphabets. The proper term might be syllabary, and they have both vowels, a consonant and syllables, but people don't know that term and just saying its an alphabet gets the message through.

    That being said, are you making the clone with floats or are you insisting on emulating the original?
    With floats you'd be increasing the precision a tiny tiny bit, which might(a BIG might) throw off a TAS replay taken from the original game. But no human would be able to notice the difference.