so i had a thought yesterday, on my collision detection and response pains.
wait, lemme fill you in a little on what that means exactly. you see that crappy breakout below? yeah, well i was doing that because i needed collision stuff for space fortress. i thought, i think i want the same response from running into stuff as breakout has. as you might expect, detecting collisions between two rectangles was fairly easy - the problem was what to do with the information i had found out. i couldn't seem to get good results from rebounds, even with something as simple as breakout.
after a while, someone in #ludumdare suggested i use a movex-check/respond, movey-check/respond method. i was golden. then i tried the exact same code (cut&paste!) in space fortress. for some reason when you pushed up against the map, you'd zip along the other axis until you were around a corner. it didn't happen all the time, just when you were below a certain velocity and trying to get yourself flat against a wall. and even then it wasn't happening all the time, only along certain x or y values, like all along the top or all along the edge between tiley=31 and tiley=32. stupid stuff like that.
i'm still not exactly sure what it was about, but i'm guessing that it's an issue with floating-point error. and so i got to thinking: if we're dealing with tilemaps and sprites, why am i stepping outside of pixelspace? as long as i plan on using a 1:1 pixelspace:d3dspace conversion, why am i using sub-pixel tests and positioning? why not just trunc all my floats and deal with ints again? wouldn't that solve my problems, and make it a whole lot easier to think about these things in the future?
i didn't get any time yesterday after work to start this. i will be today, though. i'm hoping this will work out as i expect it to. don't get me wrong though! i still think that i need to use floating point values to store position and velocity. imagine trying to accelerate using only integers! no no, i'm only suggesting that collision detection and draw positions be pixel-aligned.
when i succeed (or fail horribly) i'll post more about this.