1
\$\begingroup\$

I'm just wondering about the implementing of the collision response of bullets and the fours obstacles. https://www.youtube.com/watch?v=LCNTwG3MGEg

When a bullet hit, a one black pixel is overwritten. How would one implement it in modern games, because what I feel that they overwrite the framebuffer, but right now I will only swap the sprites or images of different hit-obstacles.

If we say we will draw it as a pixels of bitmap, should then I make then a pixel to pixel collision detection If I want to clone the same behavior?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I'd probably use a 1 bit texture (more if you want to store more states) and then draw it using a shader (or a second texture you only modify once some pixel is hit).

So yes, this would essentially mean you're working with a pixel perfect collision detection, but you wouldn't necessarily use a full bitmap/texture (1 bit per pixel vs. 32 bits per pixel).

Of course, for performance reasons you'd first check whether your shot is actually inside the bounding box of the obtsacle and then determine whether it actually collides.

As for drawing, there are many alternative possibilities, e.g. you could use voxels, a second texture with more details, or even some kind of 3D mesh (think of the different Worms games and how they're drawing their map).

\$\endgroup\$
2
  • \$\begingroup\$ What If I don't want to use a shader to process each pixel.. the other way is to access each pixel of that 1 bit texture and modify it ? \$\endgroup\$ Dec 19, 2014 at 9:38
  • \$\begingroup\$ You can use the one bit texture for faster lookups (since there's no obsolete data). Then update a second texture which is used for actual drawing. You could use the same (colored) texture for both things as well though. \$\endgroup\$
    – Mario
    Dec 19, 2014 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .