I've been experimenting with small games to learn design concepts, LibGDX, and Box2D. I am wondering how you would implement "responsiveness," so to say. For example, this is the rendering part of my game and its just drawing to coordinates. https://github.com/Elsealabs/Stacker/blob/master/com/elsealabs/stacker/ScreenGame.java

For example I'd like it to look good on Android phones of different resolutions or if the user resizes it on desktop. I am asking about design patterns or practices that would make this possible. Any solutions I can think of seem like they wouldn't scale or would over-complicate the game.

If you know of any articles or design practices that cover this topic, or have any of your own knowledge, or example LibGDX/Java games, I'd love to see them.

  • \$\begingroup\$ I think your question is about patterns/practices, not necessarly libGDX specific. Is that right? Here are some links that may help you: one, two, and three \$\endgroup\$
    – ashes999
    Aug 10 '14 at 0:49
  • \$\begingroup\$ Yes it is more about design practices in general, though if anyone had any knowledge specific to the library that I use, it would be helpful. But as I said in the question, general design patterns are good. I will look over these links. \$\endgroup\$ Aug 10 '14 at 0:52
  • \$\begingroup\$ @ashes999 These links look like good sources of information. If you have any more general links/information like this, I would love to see it. Even if it overlaps the information you already gave. As much information as possible is appreciated. Thank you. I will look for stuff regarding these new-found topics myself as well. \$\endgroup\$ Aug 10 '14 at 0:55
  • \$\begingroup\$ Are these enough to answer your question? Should I request your question be closed as a duplicate of those other questions? \$\endgroup\$
    – ashes999
    Aug 10 '14 at 9:36
  • \$\begingroup\$ have you checked out the approach used in the super jumper demo on the libgdx wiki? It works well to adapt to different resolutions. \$\endgroup\$ Aug 12 '14 at 22:58

There's two things needed to solve this:

  1. Use a method called letterboxing. Build your game for one aspect ratio (16:9 works best for Android devices) and fill everything outside it with background image. Some developers just use black color, but background image is much nicer.

  2. Once you got that, find all the resolutions you want to support and draw specific sets of graphics for each. Of course, you can scale most of the images using your graphics tool (Photoshop, Gimp, Inkscape), and you should use different font sizes for fonts.

At run-time, set the game resolution to device native resolution and load appropriate sets of resources. Use some scaling factor variable to multiply any fixed coordinates you use in the code.

Here's an example how this all works on Android, with currently available devices: http://bigosaur.com/blog/31-android-resolutions-definite-answer


Not the answer you're looking for? Browse other questions tagged or ask your own question.