Atlasing and More on Composition
Seeing as I've been talking a lot about 2d character composition, I thought I should mention.
If you're writing a 2D game, you should probably be atlasing as it is kind of a no-brainer.
I'll assume some people here don't know what image atlasing is - in a nutshell, the idea is you take all of your 2d source images, and stick them into one large image.
Now in practice this usually ends up being several large images, due to the art asset needs for non-trivial games.
How large should the images be? 2048x2048 is a good number that should cover just about any modern hardware out there.
There are really no downsides to atlasing beyond the need for a bit of forethought; here are some of the benefits.
- it reduces the number of times you switch textures in 3D rendering hardware, which is generally expensive.
- atlasing means storing a lookup rectangle, and if you're going through that trouble already, why not clip all the whitespace from your images.
- you can design your graphics with ample whitespace for alignment/registration; making your life easier, but knowing it gets clipped for deployment.
- you deploy fewer files, this means fewer file opens and that can mean faster load times, especially if we're talking thousands of frames.
If you're going to atlas use an atlasing tool; I can recommend Texture Packer it is a great tool to get you started.
Texture Packer is what we used when we started Revel Immortal, but be aware we outgrew it pretty quick; as of the time of this writing Texture Packer doesn't support a concept of packing into multiple pages (not that we found at least); so if you need multiple atlas pages for your game, it might not be ideal.
After Texture Packer, we moved on to an off-line command-line tool written by the very talented Tom Novelli, who has had a very influential hand in Revel since its HTML5 switch.
Tom saw fit to open source this code, so you can use or re-purpose his powerful atlaser free of charge
After that bit of toil you should end up with nice compact atlases such as this:
Oh right, more on Character Composition...
Per my explanation in a previous post, I decided to make a little visual aid to show how composition works: