It's Groundhog Day! Also, Platformer tutorial v2022+! (Patreon)
Content
Here is the revised Platformer tutorial. I ultimately decided to abandon the very new collision method as after a lot of reflection I felt that its goals were flawed and even though it brings some very real advantages, needed some ugly and unintuitive fixes to make it work elegantly for most and especially newer developers, rendering it a poor option for a tutorial like this one.
So instead I have worked to refine my original approach to platformer collision, while not going quite as far as a true binary search which would be closer to truly "optimal" we've gone for a much more efficient while loop that takes floating point positions into account.
The main lesson I have learned through this process and want to pass on to the rest of you, is that true precision is not your goal when writing a collision system. We don't want to be truly flush with a wall especially now that our bounding boxes are inclusive in nature. At some point, the engine will not know what to do when your position contains too many decimal places and unpredictable results can arise. And given we're not in control of our engine, the problem is even worse for us.
So if you have a wall with a top edge at a y of 140.0000, do not aim to put your player's feet at 140.0000, aim to put it at roughly 139.95. That's the approach we take in this video and I think generally the safest and smartest way going forwards.
I may make a separate video exploring the journey I went on making this video as a few people have asked for an explanation of "what went wrong" with the first video. There's a lot to say! So more on that soon.
This releases to the public on Friday. Hopefully if I've made some other critical error one of you might spot it by then! Haha. I laugh so that I do not cry.
-S