2.23.2012

Designing a 2D graphics engine

I've started a simple recursive display list system for drawing scenes with SDL surfaces and have to say that I should really take more advantage of palettes and alpha blending. I'll probably never do a 3D mode for it but apply the same concept with 3D some day, for a different game of course. Anyway, SDL isn't the most comftable library but the stuff it provides does usually work in a stable manner. The concept of display lists in display lists is something I've taken from Actionscript - though some minor modifications for whether to z-sort sprites or not will expand the system to something more usefull. And the more I'm trying to incorporate all of SDL's features per sprite which get re-applied every time we're rendering one (to enable a single surface be part of multiple sprites), the more I wonder what graphics effects I may be able to utilize, the more palettized graphics come to my mind. See, I'm already using 8bit sprites for coloring the font characters - so why don't do some more palett magic? One thing I'd definitely like to have is some sort of bump mapping. How to do bump mapping on flat fonts you ask? Well, pixelate the whole thing with different palette colors for different angles and directions! The most basic setup would have a surface directed to the camera and one 45° angle for each cardinal point. this can be expanded to 22,5°, 67,5° and so on for more steep or flat angles. I guess it's even possible to take normal bumpmaps, palettize it, analyze the used color components and generate a vector for each palette index. Yeah, that sounds totally possible and probably not hard to integrate due to all vectors and values present in the renderer. I start to like the palette concept. One only needs to alter a few values and a great 2D was born. Fabulous!

No comments: