Hello Guest

Author Topic: Aspect Ratios, Resolutions, and Scaling - Oh My!  (Read 17526 times)

streek

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Aspect Ratios, Resolutions, and Scaling - Oh My!
« on: July 19, 2012, 09:15:40 am »
Ok so here's the deal:  I have a game I wrote by hand with my own engine.  I'm porting it to Unity and 2DTK (with playmaker).  One of the main reasons was so that I could build the game and build to android and iOS.  However, I'm running into a few issues.  Firstly the game is a single screen 2d only game, my hope was to have one set of assets (sprites, etc.) that would work on all devices (scaled?).  It saves on me railing on the art lady to have her resize and format the art for different resolutions.  Here's what I've tried and done so far.

I used a normal ortho cam with a size and placed the sprites in there but the scaling was really off on an iPad (or my vizio android tablet).  So I read the forums and got the great idea of doing resolution overrides using the 2dTK camera.  So I did it but the issue I'm having is that my 1024x768 vizio tablet doesn't scale the sprites... at all.  this might just be a bug with the tablet or android because my iPhone 4s scales without issue. 

I've tried just about everything to do this and am looking for some feedback on what I should do.

Keypoints:
- Single screen game, no scrolling.
- Landscape
- All iOS devices
- Also, android support is desired.

My Questions:
- How do I handle the changing aspect ratio (I usually cut the edges and offset the main game camera -- can I do that with 2dTK)?
- How can I easily handle changing resolutions (on different devices)  -- I also wish to have a PC version someday.
- Lastly, I'd like to be able to do these with a single set of assets (or maybe the fewest assets possible).

Thanks for the feedback, I'm loving the workflow and added productivity.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Aspect Ratios, Resolutions, and Scaling - Oh My!
« Reply #1 on: July 19, 2012, 12:38:34 pm »
Hi streek,

This should be REALLY straighforward with the new tk2dCamera (1.76b2). Also keep an eye out for a "patch" I'm going to post in the private support forum shortly, it works around a Unity bug and gives you a camera preview with the tk2dCamera making it like a lot more useful.

So what you need to do is set it up the "native resolution", i.e. the one you're primarily developing on, and then delete all present overrides and add a new one - by default, the newly created override will be a "Wildcard Override" which matches all resolutions and will automatically fit the largest axis and center the game in the screen. It automatically handles multiple aspects.

Note: It doesn't automatically letterbox for you (i.e. if you had objects half outside the viewport, they would be visible. But you could always add a scaled border sprite to cope with the changing aspects)

The assets aren't an issue if you don't need to switch them on the fly. Support for switching assets automatically is coming in 1.80.

streek

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Aspect Ratios, Resolutions, and Scaling - Oh My!
« Reply #2 on: July 22, 2012, 02:46:58 am »
  Fantastic, this makes me a very happy developer. :D

Absolutely in love with 2DTK.