Hacker News new | past | comments | ask | show | jobs | submit login

That may have been the case for the original Lemmings — where the background is black so you can collision test directly against black pixels — but newer games have background textures.

If you want to have complex backgrounds and terrain textures with pixel-perfect collisions and terrain modification then you’ll likely want to keep separate buffers for foreground and background. Then your game engine would operate on a bitmask for collision and destruction of terrain, and you’d construct the framebuffer by blitting [1] the foreground and background using the mask to select between them.

[1] https://en.wikipedia.org/wiki/Blitter




For example Amiga and most 16-bit consoles could just have two (or more) playfields (like layers or screen size sprites) superimposed on each other. For the game code those pixels would still be "black", well, transparent, even with background graphics showing through.

No blitting required, playfields were drawn by the display hardware at scanout.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: