Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Supporting multiple device reolutions and aspect ratios?

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 3rd Nov 2012 15:44
Hello, I am currently trying to get my Obliterator game working on different resolutions. I did this with my Moon Snaker project reasonably well, but am finding it more difficult for this project.
I use this code in both projects at the start.

I then position my objects, text etc by altering the original pixel position to a percentage of the virtual resolution.
However although this method worked for Moon Snaker, it does not look like it will work for Obliterator. I have it working ok on the pc (with the bits I have altered so far), and on my android phone. I have temporary access to a android tablet at the moment, and it doesn't quite work properly with that. The game looks pushed to the left edge by about a centimeter. I can only think the aspect ration is giving me problems.

My question is what have you guys and gals done to get around this? Perhaps the percentage system would be better than a virtual resolution?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Nov 2012 17:12
What Player are you using on the Android? If it was from the Android Play Store, it is hopelessly out of date. If it is the beta one from the TGC 'My Products' page, that is known to be buggy. This post has a link to a page with working v1076 and v1082 Players.

Cheers,
Ancient Lady
AGK Community Tester
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 3rd Nov 2012 17:24
Hi Dvader!

I belive you want to get rid of the black borders?

Use agks overdraw function.

REM // Enables overdraw
SetScissor(0,0,0,0)

Now skip all of the calculations and always use your own virtual resolution on all devices.

But remember that this only works on sprites so you nead one to fill out the whole background with one.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 3rd Nov 2012 18:59 Edited at: 3rd Nov 2012 21:20
@Ancient lady, I am using the one you refer to in the post thanks. I think it is more my code than the player unfortunately.
@Cliff, I wish I had asked earlier as I have gone through a lot of code altering stuff! I will give it a go after Empire Strikes Back finishes

@Cliff, Had a look at it and it works better than before by quite a way. Thanks for that little tip!
The only problem I have now is the overlap part sometimes shows parts that are being updated, better than before as the screen is centered correctly now. The overlap looks fairly large on the tablet and I need a simple way to zoom in to a better fit , adjust all the graphics for the overlap (not a nice job), or use an overlay and have a border to hide it.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 3rd Nov 2012 23:28
Quote: "The only problem I have now is the overlap part sometimes shows parts that are being updated,"

I solved it by adding tiles in width to be updated on my platformer.
Uses slightly more resources buts gets alot more multi platform as some companys like apple wants full screen games with no borders.
I use agks zoom command on my game to get bigger sprites

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Nov 2012 14:18
I was hoping to use the zoom to make it easier and zoom the entire viewport in. It isn't as easy as first imagined though because of the aspect ratios. I am working on adjusting my scroll as I can't really see any other way besides a border, which I'd prefer not to use for now. A way to zoom the screen zoom width and height would have been useful possibly, so it would be easy to zoom to different aspect ratios.

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 4th Nov 2012 21:43
@Dvader,

I notice you set up variables for virtual resolution, but don't use these in the resolution code.

Including these variables, I managed to streamline it a bit;

Now virtual_width# & virtual_height# contain the virtual resolution - in your version they contained the physical resolution at this point.
But I suspect the problem is more to do with the positioning of the sprites.
Quote: "I then position my objects, text etc by altering the original pixel position to a percentage of the virtual resolution."

This is the area I would look at, especially how the scaling is calculated, it's easy to get this part wrong.

As with your version, my edit only uses the height value (768) in the scaling calculations and the sprite maths should too.

I have included a variable sprite_scaling# to help with this.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 7th Nov 2012 15:08
Cheers Marl, that looks good. I have recoded my game to work as Cliff suggested now, and have put all my positioning back to numbers (or most of it anyway). But I will give this a try and see how it works. I need a method to start using from the beginning of my projects rather than the end! So I will test it out and hopefully use in all future stuff. Thanks all for the help!

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 7th Nov 2012 18:58
They have these nice commands in the latest beta that is for when using overdraw.

-Added GetScreenBoundsLeft returns the edge of the screen in you chosen virtual resolution, this takes black borders into account to the left of the screen my be a negative value in your current virtual resolution
-Added GetScreenBoundsRight returns the edge of the screen taking black borders into account
-Added GetScreenBoundsTop returns the edge of the screen taking black borders into account
-Added GetScreenBoundsBottom returns the edge of the screen taking black borders into account

Perfect when placing gui elements

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th Nov 2012 15:08
Those sound like just the ticket as I am having to guess an edge at the moment although I have it working on 3 different devices ok now. I am thinking of releasing a demo pretty soon, so people can test it here and confirm it works on several more

Login to post a reply

Server time is: 2024-11-27 19:10:37
Your offset time is: 2024-11-27 19:10:37