You aren't going to need it

2014-06-30

This is a week with very few links. My hope was to compensate with lots of news about my upcoming game, but personal problems conspired to hold back my progress. All I have to show for now is this one screenshot:

attack vector missiles

I know, it doesn't exactly look glorious. It's much more interesting in motion, trust me. But before I'm ready to make a video, there's something I'd like to point out -- something you can't see in the image.

If you've made any game programming at all, you probably know that a game screen is composed of layers that have to be drawn in order from back to front: first the background, then all the moving stuff in front of it, and at last the HUD -- score, lives/energy or whatever else the game requires. This is true for 2D games, 3D games and everything in between. It's called the painter's algorithm, because oil paintings have to be made the same way. You do know that all of the principles we use in computer graphics, such as perspective, were discovered centuries ago, right?

(Okay, raytracing works differently. And scanline rendering can make use of something called a Z-buffer to deal with polygons in whatever order. We're talking basic principles here.)

And none of that has been necessary so far.

Oh, of course I'm rendering the background first, then the buildings, and the HUD only last; that's self-understood. I also make sure no two buildings or enemies ever overlap, so I don't have to do per-voxel Z-sorting. But you'd expect that enemies and missiles at least are being sorted and rendered in the correct order. Turns out even as much isn't really needed when any two enemies only ever align with the camera for maybe a fraction of a second at a time. So far, I've been noticing artifacts maybe once in several test runs.

Oh, I will have to do it right at one point. As I add more stuff to render, such as explosions and barricades, at one point it should become unavoidable. But until then, I can't help but marvel at the power of You Aren't Going To Need It.