Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tips for multiple screen support in 2D opengl game?

The question of supporting multiple screens has been asked to death, but I haven't seen much discussion in regards to game development (with hitboxes, collision checking, etc).

Currently, my game is running in "compatibility mode" producing very poor visuals on higher end devices due to upscaling. I'm looking for tips and recommendations for what others have done to make their games graphics look good across all screen sizes.

Do developers include 2 copies of each resource (medium and high densities) or are high density resources simply scaled down for lower density devices?

Are density-independent pixels used in your calculations?

like image 594
Andy Rey Avatar asked Nov 05 '22 23:11

Andy Rey


1 Answers

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:

  1. Include bitmaps for each resolution you want to support
  2. 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.
  3. 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:

  1. Parse necessary game asset for a level
  2. Load related .svg asset from disk
  3. Draw the .svg contents into a bitmap
  4. Throw away the loaded .svg
  5. Repeat for all assets
  6. Start Level

Are density-independent pixels used in your calculations?

Yes, I use it as follows:

sprite.x = new_x_position * screen_density;
like image 120
ajdiperna Avatar answered Nov 15 '22 13:11

ajdiperna