1. by Tim on October 26, 2010


    Per-pixel collision detection

    The only method of handling collisions in SIEGE at the moment is via the “full-fledged” physics engine.

    Sometimes this is unnecessarry, and sometimes it is – quite simply – overcomplicated for an otherwise simple task. That is why I want to add per-pixel collision detection to SIEGE.

    There are three possible methods for handling collisions and collision masks:
    1) Use sprites directly
    Least efficient, but allows reuse of SGSprite for the collision detection – question is, however, whether that (reuse) is a good thing or not.

    2) Put the collision mask into individual bytes
    This uses a mask, full of boolean values (but promoted to full bytes) for the mask. A check would simply do “mask1[x][y] && mask2[x][y]”. However, this would require a separate object, SGMask, for the mask.

    3) Pack the mask into uint32_t or uint64_t or similar, then compare that
    While possibly (and I stress *possibly*) the most efficient way of detection, this is the most difficult to implement. Just like above, this too would require a new object, SGMask.

  2. Tim
    about 9 years ago

    1. milestone changed from to Alpha release
  3. Tim
    about 9 years ago

    Started working on this, using method 2) because it is more scalable than 1) and simpler than 3) (which I may do at a later date, or perhaps use run-length encoding instead — we’ll see).

    For this, a new branch has been created, “coldet”: http://gitorious.org/siege/siege/commits/coldet

    1. state changed from New to Open
  4. Tim
    about 9 years ago

    Completed as of 64b413d, though it may require some further testing.

    1. Status changed from Open to Resolved
  5. Tim
    about 9 years ago


    1. Tags changed from per-pixel collision to per-pixel,per-pixel collision detection,collision detection,collision
  6. Update “Per-pixel collision detection”

    Ticket Properties

    Attach a File