kelthar

Multi platform scaling issues

Posted in Uncategorized by kelthar on January 24, 2011

Well, I’m still waiting for the approval of my game @ app store. I submitted it 5 days ago, but alas, it takes about 6 workdays before it’s reviewed. So, we’ll see what happens. I really hope it gets accepted so I can take some time to move to my new framework for iPhone and get going on some new games.

The scaling issue

There are different resolutions on the phones. I could use the screenwidth as ratio to scale all graphical object, therefore I don’t the graphics in different resolutions, I can just use bitmaps for the highest resolution and scale them down for those with lesser. The platforms I’m targetting have 320, 480 and 640 in width. This approach works, but it’s not optimal when doing pixel graphics. I use the width since my game is in portrait mode, but I think I’ll stick with the width for calculating ratios since this is the common ground in my point of view. So things get updated at the same rate on all platforms. One problem with my approach is that I calculate the scale for objects every time I’m drawing an item on the screen. That leads to alot more floating point operations than needed. And that’s not anything you want to do on the iPhone. I could just as easily just scale them once at creation. My bad šŸ™‚

I do alot of other scaling calculations in the code over and over again. I should be able to calculate all those constans in the current scene when creating it.

Rewriting it

I’m saving all my textures now with the screendimensions appended at the end. They get merged based on their resolution so I don’t load anything that I don’t need. All merged textures are grouped by the scene they belong to and I also have a “shared” library with fonts, etc, which are used by most scenes. So common names for the textures are “merged-main1.480×800.png” and “merged-game4.320×480”, etc.

I have found that my framework works on WP7, it was pretty well written from the start. I even have a control-library for Panels, Scrollings Panels, Buttons, TextBlock, TextureButtons, Images, etc. So, it’s working out pretty good.

Leave a comment