Unnamed Platformer - Devlog 9
I was “busy” watching the World Cup bronze/final matches over the weekend. No way we got a 10 goal third place game while everyone started throwing hands at the end of the final😭
What I did: I finally got started on SAT collision like I said I would, and it’s actually working! Mostly. I built all the fundamentals so far: vertex extraction, edge normal calculation, projection ranges, minimum translation vector (MTV) calculation, etc etc. I hooked it into checkCollisions for ground tiles, and the MTV push resolution actually stops shapes from clipping through geometry now, and it’s also sign-corrected and whatnot so it always pushes the right direction. I also made a debug overlay that draws vertices and axis normals directly in the game window, which saved my sanity countless times and looks pretty cool too.
On top of collision math I had to go back and fix 3 out of my 5 characters’ movement code because switching to SAT caused bugs in features that worked just fine under the old AABB system, aside from all the general bugs I had to deal with. The hexagon’s double jump stopped working entirely, circle’s acceleration started randomly resetting mid-sprint, and octagon’s wall jump turned into an absolute mess (more on that below). The main thing was that my old flags for checking wall collisions were set with assumptions that crumble once you switch from checking 4 fixed direction to a bunch of axes.
Challenges: Oh boy… The wall jump bug was hella frustrating: after switching to SAT, the octagon would do exactly one wall jump and then just slide down the second, no matter how many times I hit jump. It took me forever to figure out it was a chain of three separate bugs stacked on top of each other: wall contact flags getting cleared before the function ever read them, my walljumped flag never resetting between wall touches so it permanently locked my horizontal movement, and then once THAT was fixed, SAT was re-zeroing my wall-jump velocity on the same frame it fired because the player was technically still overlapping the wall geometry. So I fixed those and immediately got a NEW bug where wall jumping turned into a pogo stick that spam-bounced me up the wall, because a vertical MTV was getting misread as “landed on the ground,” which reset the wall jump lock and let it refire every single frame.
Also spent quite a bit of time before realizing this one line I had, if (grounded) velocity.y = 0, worked fine with AABB but not so much with SAT’s own grounding logic, since my SAT function sets grounded = true when it sees downward velocity, and that line was zeroing velocity before SAT checked it. Removed it and a lot of my bugs disappeared.
AI used, if any: SAT math I mostly figured out myself, after reading through a ton of Stack Overflow threads, articles, watching a lot of YT videos, etc. on my own time. I did use AI to clarify/debug a couple of parts though. However, I ended up needing it a lot more for debugging the problems that stemmed from it, i.e. the octagon, hexagon and circle issues.
Plans for next time: SAT works for ground tiles but I’ve still got all my other entities on the old AABB system so I gotta port those over. Although, probably the biggest thing is trying to make my code more efficient because sometimes the game randomly slows down/freezes and makes random clips occur. If this isn’t lag (which it might not be, I could just be stupid) I’ll still have to look into whats happening. Then, once ground collision is 100% finished: rolling physics, aka the reason I made this change in the first place. Gonna have to look into the math/physics behind that, but it should be pretty easy since I already got this down. Once this is done, the shapes should be tipping and rolling around instead of just sliding around like ice cubes. We’ll see how that goes.
K bye guys