Collision (Almost) Fixed?
I think I finally know what went wrong in the collision code. After fixing the rendering problem from yesterday I got back to collision. Only this time I first wrote down the exact steps I had to take. Thinking through what would happen if certain things didn’t line up. Or if there is overlap but the entity doesn’t move in that direction.

This gave me some steps I had to take and I saw these were different than what I had. However some could be reinterpreted into the code I actually had. So in the end I was actually doing all the correct things. What was causing the issue then? Turns out the overlap checking wasn’t actually correct. The first if-statement which determines if we even do the rest of the steps failed in cases where it definitely shouldn’t.

Rethinking this if-statement brought the issue back to something I have seen before. The issue where the entity actually moves too much and therefore on the next frame there is overlap. So I’m back at only one problem now, which I hope to fix before the Monday. That would be a relief.

UPDATE:
This morning I forgot to mention I had probably the solution already in my head. I thought maybe it was just very slightly overlapping. There was no epsilon anymore so maybe that could actually fix it, since floating points are just far from perfect. And what do you know? It was indeed the missing puzzle piece. I can finally say that the collision code is working!

Tomorrow I can finally progress further and get those diagonals working. Probably need to test rotations after that. There is finally light at the end of the tunnel again.

What I also forgot to mention is that I am using SmileBASIC on the 3DS to try create the ending scene. It’s mostly for fun. I enjoy using the application and it has everything I need to experiment a bit for the game. Maybe if this game engine development takes long enough I will have a complete demo ready in SmileBASIC before actual gameplay development starts haha Time to go to sleep now though. Definitely feels good to know this was the day I finally fixed the collision code issues. (And it was all hiding in plain sight as usual hehe…)

Last modified: October 27, 2022