[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Best practices for creating multiple resolution 2D pixel-art games?



On Thu, Apr 5, 2012 at 12:24 PM, Santiago Romero <sromero@xxxxxxxxxxx> wrote:

- Game graphics (pixel-art, not vector or 3d graphics): What's the best way to create the graphics? Do them "high-res", try to ask always for the highest resolution and downscale if not (losing quality)? Do them "mid-res" and upscale / downscale depending on the resolution? Create them in 2 or 3 different sizes to minimize quality losing in scaling?

Depends on your exact art style. I always hand-draw my graphics at a very high resolution (5-10x how they appear in the game) and downsample when the graphics are loaded. My graphics actually look bad at full resolution but improve when downsampled, because I don't avoid aliasing because I know it'll be smoothed over when it's shrunk. This lets me change the game resolution pretty easily, and ideally I let the player zoom in and out and pick arbitrary resolutions. Basically if your graphics start at a large enough resolution, you can treat them like you would vector graphics. I think it works great.

This technique fails, however, if you're doing the distinctive retro art style commonly called "pixel art". In that case, you don't want to avoid aliasing - you want to control each pixel very exactly. I've never worked with that kind of art, but I know what I would do. I would draw my graphics assuming a certain resolution for the game, say 400x300, and allow people to scale to any integer multiple of this, such as 800x600 or 1200x900. In fact I'd draw the whole thing to a 400x300 Surface and then just scale it up. Should look good while maintaining that distinctive style.
 
- Game engine: when creating the scoreboard, menues, inventories, position items in the screen, define sprite-speeds ... should I use "percentages" instead of pixels? ( % ). Should I, instead, work in a "base resolution" (640x480) and scale all (pixel-speed for sprites, on-screen text and scoreboards positions, etc) according to the relation base-resolution / real-resolution? And what about the ratio (16:9 <-> 4:3) change (it's not just an "scaling" problem)?

This is a very nontrivial series of questions. If you allow arbitrary resolutions without doing something cheap like letterboxing, you're going to have to put in significant effort. But one question you asked has a clear answer: objects in the game world should definitely not know anything about pixels. All game mechanics should use world coordinates and world units, and only your drawing routines should translate these into actual pixels. Unless you're absolutely positive that you'll never want to change resolutions (eg developing for a game console), sprite positions should not be in terms of pixels.

-Christopher