Game Development Community

design resolution

by rennie moffat · in Torque Game Builder · 02/25/2010 (7:06 am) · 4 replies

I have made a demo background in Illustrator that is 480 x 320 pixels. I have adjusted the camera width and height in TGB to those same dimensions, however when i pull the image bkg in, it is much smaller. When I stretch it up to size, holding shift, it is disproportionate to the camera view. I am wondering, what is this about? and how do I best insure my images are the size and proportion they are supposed to be?

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
02/25/2010 (12:04 pm)
We ran into this problem with our game as well. We had to rework several aspects of the engine to handle "pixel perfect" rendering and scaling issues... especially with t2dTextObject.

A static sprite's render size is based on it's size in the datablock in ratio to the camera size. If I recall properly, the size stored in the datablock is set based on the camera size of your scene when you import the image.

So, be sure your sizes in the datablock are in pixels... not in the bizarre camera space. That should solve your problems.

steve
#2
02/25/2010 (2:40 pm)
Hi rennie,
Stephen is right
Quote:A static sprite's render size is based on it's size in the datablock in ratio to the camera size. If I recall properly, the size stored in the datablock is set based on the camera size of your scene when you import the image.
If you need to work with editor, you could simply set a proper design resolution accordingly with you camera values, so putting images into the stage will automatically set their size correctly. You can find more info about how TGB calculate default image dimensions inside the official documentation.

If I understand your case, you want to make a camera with an aspect ratio of 1.5 and in a way that, when you grab images of 480x320 pixel into the stage, they take all the camera view. You should then use these values:

- camera 48.0 x 32.0 (or anything with an 1.5 aspect ratio will be good anyway, but I usually prefer low values)

- design resolution 480 x 320

TGB editor does not allow to set design resolution values under 640x480 by default. This is becase of these two functions you can find inside tgb/tools/levelEditor/scripts/options.ed.cs:

function t2dSceneGraph::setDesignResolutionX( %this, %resX )
{
   if( %resX $= "" || %resX < 640 )
      %resX = 640;
      
   $levelEditor::DesignResolutionX = mFloatLength( %resX, 0 );
   applyLevelEdOptions();
}

function t2dSceneGraph::setDesignResolutionY( %this, %resY )
{
   // Small Sanity
   if( %resY $= "" || %resY < 480 )
      %resY = 480;
      
   $levelEditor::DesignResolutionY = mFloatLength( %resY, 0 );
   applyLevelEdOptions();
}

Remove the parameter limit checks to set design resolution as you prefer.

Happy TGB editor customization to all.
#3
02/26/2010 (9:06 pm)
@stephen
so a simple change of units in the datablock should do it?


and thanks guiseppe!
#4
03/08/2010 (6:20 am)
Hi Guys,
I looked up this info last week and I passed since I could not exactly figure it out (if it is an issue, or the only solution I will come back) but even today, working in the editor, I have the camera set to iPhone landscape proportions but when i run the game the screen view is square, not rectangular.





I am not sure what to do. I would like it to appear like that since it will be easier to test my games movement, flow etc.