Jump to content

Scaling of assets in games (and hence in Phaser)


abhivaidya
 Share

Recommended Posts

Hey Guys,

I am working on a project that is to be used across devices i.e. desktop, mobile phones and tablets. So here is the approach that I am taking... Our base resolution is 1024 x 576. That is the resolution at which the game will launch. The player can fullscreen at any point and keeping that in mind, we are creating assets that are suitable 1920 x 1080 and are scaling them down. So in order to have it fit into a game with my base resolution, I downscale the assets (in this case to about 53%). So if I have an asset that was meant to be about 125 x 125 when the resolution was 1920 x 1080, it would now be about 66 x 66.

However, when I now fullscreen the game on 1920 x 1080 monitor (and hence upscale it), I output the dimensions of the sprite and they still happen to be 66 x 66. What is wrong with my approach?

My phaser scalemanager is set to SHOW_ALL. Is there a scaling factor function that can just tell me how much the size of my asset should be depending on the resolution?

Regards

Link to comment
Share on other sites

What you are looking for is 

game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;

http://phaser.io/examples/v2/display/fullscreen

When using Phaser.ScaleManager.SHOW_ALL if the client screen is smaller then the base screen then the scale will be reduced in order to show all. If the client screen is larger then the base then it will do nothing as the client already sees everything on screen.

EXACT_FIT does exactly as the name suggests, it takes ANY base screen and fits it EXACTLY to the client display, this in turn will cause severe transformations if for example the base screen is made for a wide display 16;9 of 1024x576 to 800x600 for instance as the width will be smaller by 224 px and the height will increase by 24px causing skewing for the whole screen.

As a side note. 1024 x 576 is a bad display to set your base at because of the 576 height.

My choice would be either 1280 x 720 or 960 x 540 as they will give a more crips look on modern devices.

https://en.wikipedia.org/wiki/Graphics_display_resolution

 

The 576 height is part of what is considered SD https://en.wikipedia.org/wiki/Standard-definition_television

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...