Do developers include 2 copies of each resource (medium and high densities) or are high density resources simply scaled down for lower density devices?
This is one way to handle things, I have seen the following done:
- Include bitmaps for each resolution you want to support
- Include bitmaps for the highest resolution you want to support, and scale down for other resolutions.
- If you use a tilesheet (i.e. multiple small bitmaps in a larger bitmap) you need to be careful of bi-linear filtering, that is, blending of the edge pixels with adjacent assets. If this occurs you will get lines/artifacts in your assets. There is a discussion here: http://developer.anscamobile.com/forum/2011/06/03/lines-between-my-tiles regarding this issue.
- Use vector graphics for the highest resolution you want to support.
When using method 2. or 3. this is the way I handle it:
- Create Assets targeting 960 x 1600 screen size.
- 480 x 800 - scale by half
- 320 x 400 - scale by one third
This gives me the screen density value I need for future calculations.
I prefer method 3.
I'm currently working on a isometric 2d game engine that loads .svg assets from disk then "draws them to a bitmap" during the "loading" portion of the stage. Doing this I get the benefits of small size on disk (.svg) and faster performance (bitmaps) while running my game.
The workflow is as follows:
- Parse necessary game asset for a level
- Load related .svg asset from disk
- Draw the .svg contents into a bitmap
- Throw away the loaded .svg
- Repeat for all assets
- Start Level
Are density-independent pixels used in your calculations?
Yes, I use it as follows:
sprite.x = new_x_position * screen_density;