Sabbatical Log: November 6th

This blog series is running about a week behind my actual work, giving me time to clean things up.  The date the actual work was done is in the title, horizontal lines indicate when I stopped writing and started coding.

Voting day!

Also “get collision actually working”-day. At the moment all the collision-y bits appear to working fine, I just don’t have a great story for what happens when things do collide. Simply reversing the colliding objects velocity works, but looks janky.

I’m going to look into assigning the collision to a sector of the unit circle and reflecting accordingly.

Status update, bouncing sort of works! But it doesn’t resolve edge cases correctly, namely what happens when two vertices collide and what happens when an object gets “pushed” into another one. You’d think vertex-on-vertex collisions were kind of rare, but I’m intentionally snapping things onto grid (each “pixel” is actually a 16×16 grid, but things are only rendered on pixel boundries) and that makes it pretty common.

It is kind of fun to watch fall apart though.

(it immediately crashes after this)


After some more digging, I discovered an error in my translation from cartesian coordinates to screen coordinates (and vice versa) which was causing some extreme weirdness. After fixing that, things are mostly working – collision detection appears reliable, and the only weirdness is around “what do do you do afterwards”-logic which isn’t meant to be universal anyway (I’m just trying to “bounce” to demonstrate things are working).

In the following picture I’ve added a dot centered on where ever the last collision happened, so it’s easier to see.

I’ve introduced a “push things out of collision”-pass, and I suspect it will stay around. There’s still some wonkiness (you’ll see some below), but given this “small area, large hit boxes, pointy shapes, smooth bounces”-logic is kind of worst case (I expect most uses in the actual game to be at 45 degree angles and not continuous) I think I can put a pin in collision for now.

Next up will be proper maps.

Continue onto November 7th