Game Development Reference
In-Depth Information
Tips and Tricks for Working with Artwork on Windows 8
Working with images on Windows 8 is similar to how you would on the Web. The best ad-
vantage, however, is that you don't have to worry about loading files from a server. Instead,
you will need to focus on optimizing your files so they don't take up a lot of memory and
also limit your draw calls so you can increase performance on larger monitors. Here are
some tips to do just that.
Use Sprite Sheets or Texture Atlases
Try to combine images as much as possible into a single graphic. Not only will this cut down
on the number of images you need to manage in memory, it also helps speed up drawing to
the Canvas by removing the overhead of having to manage multiple images.
There are generally two different ways to combine images: sprite sheets and texture atlases.
Sprite sheets are usually used for images that are the same size and can easily be divisible by
their width. A player may be 16×16 pixels wide, so you can line up all the player animations
horizontally, vertically, or in a grid. By using the fixed width of the sprite, you can find each
frame in the image.
Likewise, if you have lots of graphics that are not perfectly square, or you want to combine
all of your game's artwork into larger files, you can use a texture atlas. This is common when
working in 3D and allows you to package up all of your textures into a single image and use
an atlas file, which defines the coordinates of each image and where to find it on the texture.
These atlas files can be in .xml, .json, or .txt. There are lots of free and paid texture pack-
agers out there that can help you optimize your sprites.
Render for Native Resolution
Some JavaScript frameworks, such as ImpactJS, can automatically upscale your graphics
when the game starts. While this works well on some devices, I have noticed considerable
slowdown on lower-powered Windows 8 devices trying to do the resizing. Instead, you
should have all of your artwork pre-rendered at the correct scale factor.
You can also supply multiple scale images to choose from at runtime or, if you must have
your game generate images at runtime, cache them and save them to the hard drive to use
later. I've seen many games use this so that you only have one long load time the first time
you run the game and then it resizes everything so consecutive loads are faster.
Search WWH ::




Custom Search