
This isn’t really a complete game, it’s more of a tech demo for platformer basics. A couple of things I learned:
If you want to step forward by some time step , doing 2 to 4 substeps instead with can make collision resolution more stable. I remember hearing somewhere that this is how Super Mario 64 and Super Mario Sunshine work.
It’s possible to reduce visual jank by rendering things by keeping a separate logical position (used for collisions, physics, etc) and rendering position that smoothly approaches the logical position. This makes it so that, for example if the underlying physics has something snapping 20 pixels back and forth every frame, the object will simply appear to sit in the middle.
To stably detect if things are grounded, instead of setting their velocity to 0 on a “stopping” type collision, set it to a very small amount pushing into the object. This way it will be easily overcome by other physics interactions, but the player will stay colliding with the ground every frame in absence of other forces.
To create moving platforms that the player can stand on/jump off of/etc, simply resolve the collisions the same way you would as with any other block, but whenever the player is colliding with the moving platform, add the platform’s velocity directly to the player’s position. This method had results that felt natural and correct to me.
