Skip to main content
18 events
when toggle format what by license comment
Oct 23, 2020 at 20:48 comment added dlatikay @supercat L6A87 and following: looks like they're doing just that here. delta, abs, and adding dx+dy are present in the code. also, they discard candidates for collision early based on when the upper byte of a coordinate is different.
Oct 22, 2020 at 16:22 vote accept DrSheldon
Oct 21, 2020 at 19:06 history edited Jean-François Fabre CC BY-SA 4.0
deleted 290 characters in body
Oct 21, 2020 at 19:01 history edited Jean-François Fabre CC BY-SA 4.0
deleted 290 characters in body
Oct 21, 2020 at 19:00 history rollback Jean-François Fabre
Rollback to Revision 1
Oct 21, 2020 at 18:59 history rollback Jean-François Fabre
Rollback to Revision 2
Oct 21, 2020 at 18:55 history edited Jean-François Fabre CC BY-SA 4.0
added 92 characters in body
Oct 21, 2020 at 17:24 history undeleted Jean-François Fabre
Oct 21, 2020 at 17:24 history edited Jean-François Fabre CC BY-SA 4.0
added 1038 characters in body
Oct 21, 2020 at 17:18 history edited Jean-François Fabre CC BY-SA 4.0
added 1038 characters in body
Oct 21, 2020 at 17:05 history deleted Jean-François Fabre via Vote
Oct 21, 2020 at 16:49 comment added supercat Another variation would be to compare |x|+|y| to one value, and |x|+|y|-||x|-|y||/2 to a different value, which would effectively yield a dodecagon-shaped collision region using two comparisons and the absolute-value operations.
Oct 21, 2020 at 16:42 comment added fadden @supercat: that's the BZ approach, though it uses 3/8ths rather than 1/2 to be closer to the original math. Might not have made a difference in MC given the coordinate range (256x231 pixels). Should be less expensive to compute that than performing bounding-box comparisons.
Oct 21, 2020 at 16:15 comment added supercat Rob Fullup, the creator of Atari 2600 Missle Command, computed distance by taking the absolute value of delta x and y, and the absolute value of the difference, and then subtracting half of the latter difference from the sum of |dx| and |dy|. This yields skewed octagonal collision regions rather than circular, but that would seem a fine approach for a game like asteroids. BTW, I don't recognize anything in the above code as a collision check.
Oct 21, 2020 at 14:56 comment added fadden You can compute distance with various approximations (see e.g. Battlezone's approach, explained near the bottom of this page), but distance fundamentally assumes a collision between circles, and most of the objects in Asteroids are more rounded-squarish. The player's ship is triangular and rotates, which isn't a good match for either shape, but if you move fast enough nobody will notice the approximation.
Oct 21, 2020 at 9:14 comment added Jean-François Fabre the game has lookup tables for angle / xspeed / yspeed, but not for distance apparently. pre-distance check is interesting when there are a lot of objects to check (which is the case in 3D games or scrollers) but a quick x or y distance check could eliminate far objects without having to compute squares, you're right
Oct 21, 2020 at 9:02 comment added Raffzahn For distance calculation with 8 bit values can easy be done with lookup tables, even faster than a bound check. I'd see the main point mentioned in the last paragraph. bounding box is simply good enough for the game. Classic KISS.
Oct 21, 2020 at 7:53 history answered Jean-François Fabre CC BY-SA 4.0