Dynamic content scaling

Using a config.lua file I am targeting the iPhone4 screen size (960x640) and have image sets for those dimensions. I have the scaling set to ‘zoomEven’. My problem is that when running on the iPhone 3 simulation, the images are either scaled incorrectly (.25 of the screen size) or scaled correctly but not placed central on the screen (I have a background image which is normally directly in the centre of the screen, as it fills the screen.)

What’s going on?

Thanks,

Matt. [import]uid: 8271 topic_id: 4196 reply_id: 304196[/import]

I just finished a full day of hashing out a “zoomEven” scaling setup for my game (fortunately with complete success for all device configurations).

My best guess is that something is wrong with your coordinate setup. Depending on the type of images you’re displaying, check very carefully what their “reference points” are. Sometimes 0,0 will be in the center. Sometimes 0,0 will be upper-left.

But for the odd alignment, did you try setting these in your config.lua file? Place them directly after the “zoomEven” line.

xAlign = "left",  
yAlign = "top"  

Without seeing your actual simulation, I’m not sure what’s going on. I just know that in my case, it was absolutely essential that I set these values to “left, top” (versus “center, center” which is default). Give it a try and just tinker around!

Brent
[import]uid: 9747 topic_id: 4196 reply_id: 13297[/import]

I think it was related to the simulator I was using. I’m still not entirely sure, but once I started targeting the right device and using that simulator things seemed a lot better. I’m going to use dynamic image resolution. Matt [import]uid: 8271 topic_id: 4196 reply_id: 13308[/import]

I’m having complete GRIEF trying to get my game to look correct in ALL the different devices.

Ignis could you please post an example how you managed to get it to work with various screen sizes? It would be MUCH appreciated!!! [import]uid: 9371 topic_id: 4196 reply_id: 13328[/import]

dweezil,

I should modify my last statement slightly: I now have my game looking good in all devices from iPhone3/4 to iPad to GalaxyTab… but not perfect. As you’ve discovered, it’s nearly impossible to get a game to appear the same on all devices. Android’s screen, in upright portrait orientation, is annoyingly “tall” in my opinion, while some people complain that the iPad screen is annoyingly “wide”.

If you haven’t read this blog post, do so first… it explains the issue in great detail:

http://blog.anscamobile.com/2010/11/content-scaling-made-easy/

For my game, I opted for the “zoomEven” scaling because I don’t like letterboxing with black bars (or, as the blog suggests, filling the black bar region with redundant images or something). However, it totally depends on the type of game. For some games, “letterbox” is the superior solution, and there are no black bars because the game has been designed to make them appear as part of the background. For a scrolling background game, as mine is, letterboxing simply is not a good solution.

Basically though, I decided to use a 2:3 screen ratio as in iPhone3/4. 320x480 or 640x960. This 2:3 ratio is an acceptable median between the taller and wider screens of Android and iPad, respectively. I then used the built-in functions that read the device screen size (i.e. display.viewableContentWidth) to determine the center of the screen, then I placed my overall content centered around that axis. As a result, and with the use of “zoomEven” scaling, some content gets clipped off the top/bottom on iPad, and some content gets clipped off the left/right on Android/Galaxy (assuming portrait configuration). It’s a minor sacrifice in both cases, and totally acceptable considering the game will look perfect on all 2:3 ratio screens.

Anyway, read the blog post and hopefully that helps… just remember, there is no perfect solution! Even Ansca’s “magic recipe” isn’t a perfect solution for all games, although it certainly works perfectly for many people.

Brent
[import]uid: 9747 topic_id: 4196 reply_id: 13379[/import]