Different Devices with different Screen sizes but the same os.

Previous topic - Next topic

Marmor

Whats your solution to running your app on these situation ?
Will you scale your gfx ?

Is it possible to eunumerate the supportet screen resolutions on a mobile devices for the use of setscreen ?


If you write an app with maybe 800x600 setting in project /option   but the device will have only 640x480 or maybe 1024x768 or something bigger (ipad3)  , so how to detect this ?

Crivens

Setup the res in project options to 9998x9999 (or 9999x9998 depending on orientation) and then handle all the resizing code yourself. If you look in the code snippets forum I wrote some code a while back to resize a load of images (inc. alpha channel) and then use them at any resolution. Ampos has also posted code to resize the whole screen (a fair bit slower and uses more memory but much easier to code for especially if you have a project already finished or almost finished and want a quick fix especially if it's not a fast updating type of game), and is now (I believe) working on new routines for resizing on the fly with things like rotation, zoom, and print support.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Wampus

Quote from: Marmor on 2012-Jan-10
If you write an app with maybe 800x600 setting in project /option   but the device will have only 640x480 or maybe 1024x768 or something bigger (ipad3)  , so how to detect this ?

Setting the project resolution to max (e.g. 9999x9998) like Crivens suggested then detecting the actual resolution the app starts in with GETDESKTOPSIZE should work well enough.

If you compile for Android you'll need to set android:anyDensity="true" in the <supports-screens> element. Setting this to false causes some devices to try to resize your screen to fit while others won't. That creates problems so to make sure you start in the native resolution of the device make sure anyDensity is always true.

Since scaling is GPU intensive there will inevitably be some devices that can't keep up 100%. Because of this adding frame-skipping to your main loop is kind of vital.

Marmor


Thx a lot !


Getdesktopsize and some scaling ,include the 9998,9999 thingy  will work if you will play with the standardscreensize ok .
Also understand the anydensity :true on Android .

But whats the solution to change resolution ?
If i remember right ,so  the using of Setscreen isnt safe on some Devices .


matchy

Quote from: Ocean on 2012-Jan-10
do EVERYTHING in 3D and gone are your scaling issues  :nana:

That's a good point. Rather than drawing to the screen, 2D could be drawn to a "camera" view, where the origin is in the center.

Crivens

QuoteBut whats the solution to change resolution ?
You can't on a mobile device. You either use the project settings resolution or use the 9998x9999 trick to get it to use it's max resolution and then use scaling code accordingly.

Quotedo EVERYTHING in 3D and gone are your scaling issues
Yep. My current WIP is Pseudo2D (ie. looks 2D but is actually 3D). Only thing is that the menu system isn't and uses my scaling code. I would like it all in 3D as all scaling issues go away but I can't get Gernot's 3DES static object code (for the menus) to work in my project (haven't tried latest version mind), and I'm too near completion (ie. beyond caring any more) to change it at this point.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

spacefractal

I do direct scaling using poly vector and I have 3 texture sizes to draw tiles from. I don't use offscreen buffer since its was too slow (I use intens use of tiles, so it's was not possible). I just use desktop size to detect resolution, like other posts due.

But for font and icons I only use one size, so they might up scaling in some resolutions, but still look nice. But only use few of them.

This was a compromise for size and still look very clear, so we diddent need to use 3 sizes for anything.

But don't do low resolutions (like 480x320) and upscaling to tables. it's look too blocky (except by design). Yes I did little up scaling too (but limited that), but only none in game graphics.

Ps. For speed I use 25fps on android (with 3 graphics details), and 30fps on iOS (4s and iPad2 got 50fps). So make sure to support various framerate (mine is a tile puzzler, so 25fps still fell nice).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Crivens

With the main use of 3D for pseudo 2D I'm now getting 60FPS on a iPod4 (not S) at full retina. Good stuff is 3D...

QuoteBut for font and icons I only use one size, so they might up scaling in some resolutions, but still look nice. But only use few of them
Most of my text I have drawn the words then used them as rescaled sprites (including scores). However where I need dynamic text (my shop function for example) then I used a routine where it uses createscreen for only the width and height of the text I want to use and I work out all text on the first loop so I'm not doing this every showscreen loop. Then I resize the createscreen sprites for scaling purposes. Works pretty well.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Wampus

Crivens, it surprises me that pseudo 2D could be faster than POLYVECTOR 2D. Interesting. Might have to look into that.

spacefractal, limiting the FPS by a set amount works OK but wouldn't frame-skipping be better? That way you know your games will scale up the FPS for faster devices while maintaining an overall game speed that is the same on all devices.

spacefractal

I limit by limitfps, and off course I have frameSkipping too, i just wanted to do stable constant framerate, so frameskipping is rare. Elsewise I would get too much varied fps on many levels, depend on content (tiles count from from 150 to around 900 onscreen).

Gameplay speed is same, fell same and just multiplied in update() for each regular paint(), except frameskipping.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

Would it be cool to have a global offset/scale setting?
That way one could scale all 2D operations (OpenGL/ES only) with no performance impact.

Ian Price

Quote from: Kitty Hello on 2012-Jan-12
Would it be cool to have a global offset/scale setting?
That way one could scale all 2D operations (OpenGL/ES only) with no performance impact.
YES PLEASE! =D  :good:  :booze:  :enc:
I came. I saw. I played.

Kitty Hello

I "think" it's possible with glTranslatef and glScalef right after a showscreen.
Can someone test this?

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Marmor