Multi-Resolution Game Development With GameBuilder Studio Check it out!
NEW Version 0.9.7 has arrived! New Blazing Fast Particle Engine & More Game Actions. Check it out
Best way to treat different resolutions?
  • Hello,

    I was wondering hows the best way to treat different resolutions? I can produce sprites in different resolutions so don't really need to scale i can put in different sized sprites. But is there a way in gamebuilder to recognize if it is a iphone 4 vs 5s? How are you guys and girls doing it?

    Tried to look for some tutorial about this but couldn't find any is there som documentation about this? 

    Can i for example just start to build an game for iphone 4 for example and then later insert rules and actions so that it checks for different sizes and insert the correct sprites?

    Kind regards

    Isak 
  • 11 Comments sorted by
  • @Isak currently in short you currently have 2 options doable options and 1 on the way:

    1. Use swf vector assets and scale assets up and down.
    2. Use larger assets for the largest target platform and scale down for smaller devices. (requires more memory on smaller devices)
    3. Coming Soon... Just add images in the resource folder at different scales and let GBs handle loading the correct image at the correct scale at runtime for you. This is on the way.
  • @Lavon thanks for the quick answer, i would really want to go with the last option. But is this going to come soon? Or are we talking months away?

    Second if i make an game for say iphone 4 can i just add other sizes of sprites later with the new option?

  • @Isak yes the release will come later but I will need testers to give an early release a try in a week or two. Also yes if you build for iPhone 4 now you will be able to scale up later with the new multi-resolution support. 

    It is a good idea to dynamically position and place your objects based on the screen size now if you know you will be porting to larger screen sizes later. @BenFromOregon is doing this now on his project.
  • @Lavon okey how do i do this? is it a guide?
  • @Isak this is how I am going about this:

    In GameBuilder studio I have my original game built at 1920X1080 under the publish settings.
    Then I have a device I am testing with(Moto G phone) which is 1280X720.

    So on each element in the game(background image, UI elements like pause button/play button etc, or characters like the main player) when I deploy it to my testing device I can get an idea of how much I need to scale down each object and re-position it for the smaller device.
    Lots and lots of testing.

    So say I wanted to adjust for a device that is 1280X720 

    For example with something like a background image on your menu screen you would have that selected in the GBs editor then add a new Rules Component. Have it check for: 
    When
    Game.Screen.resolutionX < 1281 
    Game.Screen.resolutionY < 721
    Game.Screen.resolutionX > 800
    Game.Screen.resolutionY > 480

    Trigger a ChangeProperty action 
    @Renderer.scale = Type Point X .65 Y .65

    *You'll have to play with this of course.
    Kind of like building a website now days, in many cases you are actually building multiple versions of that website because the code you have checks for a condition and adjusts what the view sees.


    OR say you need to scale down a character and re-position it, lets say this character originally started at a specific startingXPosition and startingYPosition  which you set up with a Data/Properties container on that character.(maybe you did/maybe you didn't). On that character create a new Rules Component Have it check for: 
    When
    Game.Screen.resolutionX < 1281 
    Game.Screen.resolutionY < 721
    Game.Screen.resolutionX > 800
    Game.Screen.resolutionY > 480

    Trigger a ChangeProperty action 
    @Renderer.scale = Type Point X .65 Y .65
    Trigger a ChangeProperty action
    @Properties.startingPositionX = 600
    Trigger a ChangeProperty action
    @Properties.startingPositionY = 465


    The when you deploy your game after saving first, you will notice your adjustment on the device.


    Here is the challenge I am facing :) If one does not have many devices to test on, how do you know what it will look like on the device, say you want it to scale/re-position to the devices of 800X480. The only way I can figure is to create a copy of your complete game project folder, rename it test or something. Then under the Publish settings change the size to 800X480, make your adjustments for correct scaling and repositioning of everything, then for each thing either write it down or remember and then go back to the original game and add another Rules Component to each element for the next device like this:

    When
    Game.Screen.resolutionX < 801 
    Game.Screen.resolutionY < 481

    Trigger a ChangeProperty action 
    @Renderer.scale = Type Point X .45 Y .45


    Time consuming, but I don't know how else to go about it. Good luck!
  • @Isak An UPDATE on all this.
     As I said before, I built the game in the GBs editor at 1920X1080, and also added logic using Rules Map components on almost everything(characters, UI elements, backgrounds, etc.)to check for when the screen resolution was 1280X720 and then used in many cases, the Change Property action to re-position and/or scale to appear right with the smaller screen resolution.

    What I am noticing, is if I also repeat this process for yet another screen resolution (800X480), the performance of the game seems to significantly be affected and lags a great deal. Not good.

    I imagine this is due to the device having to check for so many possibilities every second.


  • @BenFromOregon anything in excess will result in a performance hit. What are you using to check the resolution? Expressions? 

    This will be made a bit easier when you can position objects relatively but in the meantime you may want to just evaluate the screen size once and set a flag/property indicating a scale level or something 1/2/3, etc. Then just check that property. Property References are way faster than expressions. Expressions are performance intensive if you use to many of them so try not to do that.
  • @Lavon I am using the Rules Map on everything that checks for a Property of resolution, I do this when checking for a smaller resolution and then again for resolutions smaller than that.

    image

    Here is what is inside the 4 conditions in this image:
    When Property
    Game.Screen.resolutionX < 1281 
    Game.Screen.resolutionY < 721
    Game.Screen.resolutionX > 800
    Game.Screen.resolutionY > 480


    If I understand you right, and If I am checking for 3 different screen resolutions I can set up 3 separate Global properties i.e. ScreenSize_1, ScreenSize_2, ScreenSize_3 and set them at 0.

    Then to check for screen size once when the game starts, set up a Rules Map that Checks for

    When Property
    #GlobalGameState.GameStateMachine.currentState=GAME_STARTED
    Game.Screen.resolutionX < 1281 
    Game.Screen.resolutionY < 721
    Game.Screen.resolutionX > 800
    Game.Screen.resolutionY > 480
    Trigger a Change Property action
    Globals.Data.ScreenSize_2 = 1

    And on each entity in the game(characters, UI elements, etc.) that needs scaling/positioning for smaller resolutions, have a Rules Map that checks for a Global Property called ScreenSize_2 = 1  or ScreenSize_1 or ScreenSize_3

    When
    Globals.Data.ScreenSize_1 = 1

    Trigger all the Change Properties and interpolate actions

    When
    Globals.Data.ScreenSize_2 = 1

    Trigger all the Change Properties and interpolate actions 

    When
    Globals.Data.ScreenSize_3 = 1

    Trigger all the Change Properties and interpolate actions


    Is this what you meant?



  • @BenFromOregon, no actually I was wondering if you were using the property reference to check the resolution or if you were using the expression property rule to check the value of the resolution. Property References are faster and it should not really slow down your game. So that is a cause for concern. If you want to zip up your project and send it in we can profile your game using the great Adobe Scout performance profiling tool and try to dig into the performance and see what may be causing a slow down.

    Pertaining to checking the resolution once, I was suggesting to just use one global property "ScreenSize" and check the resolution once on level load and set that global property to 1, 2, or 3 based on screen size and then check in your game ui elements and other objects if ScreenSize = 1 then do something, if it = 2 then do something else. It would reduce the amount of property checks needed from like 4 per object to maybe just one per object.
  • @Lavon Yeah I was using all Property references to check for resolution. I zipped up my project and sent it to you. I will probably try the above mentioned 'use one global property "ScreenSize" and check the resolution once on level load and set that global property to 1, 2, or 3 based on screen size . . . ' to see if that helps performance . Thank you.
  • @Lavon UPDATE  By doing this approach (having check for a global screen size) on the three scrolling backgrounds, the performance seems to have improved already. I will refigure my entire game this way for the three different screen size detections and report back.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tagged