yarrow
Member
EDIT: Solved my problem and wrote a tutorial explaining the solution. The TLDR is that I needed to store the fractional amount of my movement speed in a container, rather than simply re-adding the fractional amount to movement speed at the end of the collision check (or at the beginning of the next collision check). Once the container reaches a whole number, the extra pixel gets added to the move speed for that step's collision check, then the extra pixel is subtracted from move speed after movement. It's a little more complicated but the tutorial explains everything.
***
Hi all,
I'm having quite the time trying to wrap my little head around how NES games handled player movement and would be eternally indebted to anyone who could clarify a few things for me!
A bit of background: I'm working on a game with a resolution of 240 x 180, composed of 16-pixel tiles, with a player sprite of 16 x 32 pixels. It's running at 60 fps, with a tile-based collision system that's currently working perfectly. In order to handle subpixel remainders and move/check collisions at whole pixels, I'm storing the fractional portion of speed in a variable and re-adding it after movement has occurred.
I'm currently trying to approximate the physics of SMB for NES, and found an incredibly detailed breakdown online that I converted from hexadecimal into standard decimal (rounding to the thousandths place). But here's my question:
According to this guide, the player's minimum walk speed is .074, their acceleration is .037, and their max walk speed is 1.563. If the player can only move at increments of one pixel, and we're adding acceleration to the minimum walk speed at every step, then the player would not begin to move until the 28th frame (which is indeed what's happening to me currently). But the original game's physics are incredibly smooth, and even tapping the control pad shifts the player a little to the left or right. So is my math wrong? Or are the numbers off? Something else?
I normally like figuring things out on my own but am feeling completely out of my depth here. When I comment out the code that's storing/re-adding the fractional portions of the horizontal movement speed, the motion is incredibly smooth and looks like what I'd expect, but of course the collisions don't work anymore and I'm not sure how pixel integrity would be affected by scaling. Can anyone can help me understand what I'm missing here? Thank you in advance!
***
Hi all,
I'm having quite the time trying to wrap my little head around how NES games handled player movement and would be eternally indebted to anyone who could clarify a few things for me!
A bit of background: I'm working on a game with a resolution of 240 x 180, composed of 16-pixel tiles, with a player sprite of 16 x 32 pixels. It's running at 60 fps, with a tile-based collision system that's currently working perfectly. In order to handle subpixel remainders and move/check collisions at whole pixels, I'm storing the fractional portion of speed in a variable and re-adding it after movement has occurred.
I'm currently trying to approximate the physics of SMB for NES, and found an incredibly detailed breakdown online that I converted from hexadecimal into standard decimal (rounding to the thousandths place). But here's my question:
According to this guide, the player's minimum walk speed is .074, their acceleration is .037, and their max walk speed is 1.563. If the player can only move at increments of one pixel, and we're adding acceleration to the minimum walk speed at every step, then the player would not begin to move until the 28th frame (which is indeed what's happening to me currently). But the original game's physics are incredibly smooth, and even tapping the control pad shifts the player a little to the left or right. So is my math wrong? Or are the numbers off? Something else?
I normally like figuring things out on my own but am feeling completely out of my depth here. When I comment out the code that's storing/re-adding the fractional portions of the horizontal movement speed, the motion is incredibly smooth and looks like what I'd expect, but of course the collisions don't work anymore and I'm not sure how pixel integrity would be affected by scaling. Can anyone can help me understand what I'm missing here? Thank you in advance!
Last edited: