Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

android game screen size  [SOLVED]

You feel lost? You don't understand how to use ShiVa?

android game screen size

Postby siml » 18 Aug 2012, 06:59

Hi, I want to create an Android game.
there is 2 sizes in display size for android: 480*800 and 800*480

what happens if target phone resoulation is something else? e.g 320×480 or 960×540
is there any way to make game fullscreen on any resoulation? does it make programming difficult?
thanksin advance.
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 55

Re: android game screen size

Postby DoctorPepper » 18 Aug 2012, 15:11

I guess that ur app is automatically up and downscaled to fit the screen. I believe that UAT allows you set set a limit for the upscaling factor.
User avatar
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Location: Belgium

Re: android game screen size

Postby error454 » 19 Aug 2012, 00:03

ShiVa will always run full screen regardless of your screen resolution. There's nothing special you need to do to make this happen.

There are hundreds of Android devices and each has a different screen aspect ratio. You should abandon ideas of pixel perfect accuracy and instead design things to be good enough on all screens.

This doesn't mean you cannot be precise, just that you need to think in terms of screen boundaries rather than pixel count. I can't be more specific because I don't know what you are thinking.

The most you will need to do is set the rotation option in ShiVa based on whether you want landscape or portrait. For instance in your onInit:
Code: Select all
if(system.getOSType ( ) == system.kOSTypeAndroid)
then
    application.setOption ( application.kOptionViewportRotation, 3 )
end
error454
Platinum Boarder
Platinum Boarder
 
Posts: 671
Location: Portland, OR USA

Re: android game screen size

Postby DoctorPepper » 19 Aug 2012, 00:24

Now i am wondering, i have a scene with a camera place in 2.5D view, Z times away from the player. When i preview the game with iPad resolution, it works perfectly. But when i switch to android tablet resolution, i can suddenly see ouside of playable scene bounds, which is a problem as the walls are a one sided plane with nothing behind it. It totally breaks the feeling of being in a building.
So is there a way to lock screen ratio or something, without actually stretching anything on different devices. (i am guessing not)
How can one account for every possible android resolution
Last edited by DoctorPepper on 19 Aug 2012, 00:52, edited 1 time in total.
User avatar
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Location: Belgium

Re: android game screen size  [SOLVED]

Postby error454 » 19 Aug 2012, 00:44

You simply have to design your scene with the idea that multiple aspect ratios will be used. I regularly switch between a square aspect ratio and a widescreen ratio while designing, especially for HUDs.

You can't lock the screen ratio. You will have to move the camera, change the camera focal length or move elements in your scene.

You might try parenting your walls to the camera and position them so that they line up with the edges of the screen.

Alternatively you could take the approach that responsive web design has used where they make 3 separate layouts for different screen widths. I haven't had a ShiVa project where I felt this was necessary yet.
error454
Platinum Boarder
Platinum Boarder
 
Posts: 671
Location: Portland, OR USA


Return to Getting Started