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 / No screen scaling

Author
Message
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 27th Aug 2013 12:50
Stupid question but I could not find the answer. I would like to make a platform game always centered on a sprite moving around (except when you reach the sides of a level). Each level is rather large and probably larger than most screens, about 3000*3000 pixels. I do not want any scaling on any platform and the visible part should be larger on a large screen than on a small. How would you do this on AppGameKit and does I have to do any adjustments on any special target platform?

Sincerely,
Max Tillberg
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Aug 2013 12:59
with or without virtualresolution.
SetViewZoomMode( mode ) 1=centered
+ limit the coords for SetViewOffset( x, y )
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 27th Aug 2013 16:17
Keep in mind, due to platform limitations (not AGK), you should not use images larger than 1024x1024. Most people seem to go with multiple images for platformers/tiled apps.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Aug 2013 17:23
If it makes it easier, you could use an atlas image. Like, a big 4096x4096 image, but cut into 16 smaller 1024x1024 images. That way you don't have the headache of managing 16 image files, it can all be left as is, you just make a subimages file that splits the image up.

I am the one who knocks...
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 27th Aug 2013 20:36 Edited at: 27th Aug 2013 20:37
Thanks a lot. Large images will not be a problem since most of game will be rather emty except the platforms. I am thinking of reading the screen size initially to determine when to scroll the game but I am still not sure how to make sure that AppGameKit does not tries to scale the sprites in any way.

Sincerely,
Max Tillberg
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 27th Aug 2013 21:29
Aside from commands that you use yourself to scale the sprites, whatever the image size is is what will be used.

Assuming you use virtual resolution, the ratio of width to height for your images/sprites will not be messed with. The entire app will be sized to fill as much of the device as possible while maintaining the height/width ratio you set with the SetVirtualResolution command. It is possible that there may be black bars above/below or right/left if the device the app is on has a different ratio. This page has some information about the black borders.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 27th Aug 2013 22:26
I use virtual resolution right now but since the game field is so large I would like to avoid black borders on all devices no matter the ratio.

Sincerely,
Max Tillberg
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 27th Aug 2013 23:10
You can actually avoid the black borders using the SetScissor command and having an image large enough to fill all the boarders on either side, then center it.

If you are working with tiles, just do an extra row, column all around and it will fill the spaces.

There are commands for determining if there are black bars above/below or right/left (there will never be bars on all sides).

I actually use that extra space in my stats display pages, once it has been detected. For my game play, I have an oversized animation to show the area that the player should NOT go into. And then my main background image is oversized enough to fill the black bars. It works fairly well.

If you use the non-virtual display system, you run the risk of all your images being squished one way or the other.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 29th Aug 2013 00:03 Edited at: 29th Aug 2013 00:12
I tried the following method to avoid any scaling and use the entire screen.
1. fullscreen=1 in setup.agc
2. SetVirtualResolution( GetDeviceWidth(), GetDeviceHeight() )
This worked fine in portrait mode but when I use SetOrientationAllowed(0,0,1,1) (before SetVirtualResolution) the program scales down the portrait mode to landscape. The strange thing is that GetDeviceWidth()and GetDeviceHeight() gives correct values. If I set the SetVirtualResolution manually it workes fine. I also tried to use

but it did not help. Any ideas, I am thinking wrong or is this a bug? By the way I use Tier 1, Build 108 and the AppGameKit Player for Android.

Sincerely,
Max Tillberg
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2013 00:24
This is not a bug. It is down to the way the different platforms handle things.

Part of the problem is getting Android to force a landscape orientation from the very start.

This can be done by modifying the AndroidManifest.xml file. This post talks about what to change.

If you are testing with a Player and you want to test a landscape app, hold your device in landscape orientation before you start the Player. Then the Player will be in landscape mode (filling the whole screen) and your app might behave properly when broadcast.

By the way, things in setup.agc only apply when the app is being run in Windows. They are ignored by the Player and everything else.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 29th Aug 2013 00:31
You are the best. Now it works fine. I tried to use the One click deploy to Android but do not know where to put the manifest file. Should it be in the media folder?

Sincerely,
Max Tillberg
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th Aug 2013 03:02
Quote: "I use virtual resolution right now but since the game field is so large I would like to avoid black borders on all devices no matter the ratio."

SetScissor? Android Manifest? This all seems like a lot of work to address such a basic feature (unless I'm missing something obvious)
What is wrong with;

It will set the working resolution to match the device it's running on, you will get a pixel for pixel coordinate mapping with no black borders.
Seems pretty straight forward to me.

(so what did I miss ? )
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2013 05:29
Marl, there are two issues. One is getting the app to be in the desired landscape mode and the other is dealing with black bars if you set a width/height ratio different than the device displaying the app.

Max, I'm glad to be of help.


Marl, if you want to have your app be in only one orientation, there are several steps to take for iOS and Android (and probably Blackberry, but I haven't worked with that, yet). And in both cases, it involves both code within the AppGameKit app and files/project setup specific to platform.

The SetScissor command is useful for dealing with the black bars for different ratios. If you simply set your app to use the maximum width/height, then your images may end up squished or stretched to accommodate a different width/height ratio. And, the width/height may not be values that work well with an app. For instance, one that needs to have specific sizes for different levels and sprites.

Since my current WIP is a fixed width/height and I know that the ratio is not the same across all devices/platforms, I use the SetScissor command and over sized background images to fill the space.

It isn't straight forward. But it is simple, if you know the right steps for the platform you want to be on.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th Aug 2013 12:13
It seems to me that you are making the job harder than it needs to be.
Quote: " One is getting the app to be in the desired landscape mode and the other is dealing with black bars if you set a width/height ratio different than the device displaying the app."

Then don't set the ratio different to the device - why would you even do this?.
In fact don't set a ratio at all.
Quote: "And in both cases, it involves both code within the AppGameKit app and files/project setup specific to platform."

I don't see why this is necessary.

Quote: "The SetScissor command is useful for dealing with the black bars for different ratios"

Ratios are irrelevant if you set virtual res to the device hardware.

Granted, I've not tested this on every piece of hardware (so will defer to your experience in this), but on the variety of devices I do have access to, the orientation and screen size are always correct using SetVirtualResolution( GetDeviceWidth(), GetDeviceHeight() )
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Aug 2013 12:55
Set Scissor is a good way to get an existing project to fill the screen with no real work. You just have to make sure the sprites you use for the back drop are oversized.
I always use a method like Marl's, set the virtual resolution to the device width and height. If the game has to be locked in portrait or landscape I use the setorientation command at the start. Then to make sure things are positioned in the same place I use percentages to place sprites and such. Not the percentage system employed by AppGameKit when not specifying a resolution, just manually worked out. That way everything tends to be positioned correctly on each device.
You may want to check out my parallax scrolling tutorials, or my tile scrolling one, as they will possibly help with the left right scrolling part of your question.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2013 16:29
Quote: "In fact don't set a ratio at all."

I'm not talking about setting a ratio. There is a natural ratio of the device itself. And there is the ratio of my desired app size. For my app, and many others, the size must be constant.

Quote: "I don't see why this is necessary."

Forcing a single orientation that you want the device to start up in is not done only in the AppGameKit code. Both iOS and Android have settings in project files that dictate how it starts up and how it responds to orientation changes. If you haven't tried to do this, you haven't run into the issue. My WIP must run in exactly one orientation because of the way it is played and it took a lot of work figuring out all the things needed to accomplish this. For Android, the basic app was okay, but there was a problem if I wanted to minimize the black screen on startup (there is one no matter how quickly you set your own splash screen in code) with an AGKSplash.png file. When I added that I discovered that, even if my device was in landscape, Android assumed portrait to start. Unless I made the right changes in AndroidManifest.xml.

Quote: "Ratios are irrelevant if you set virtual res to the device hardware."

That is not correct at all. If an app is created for iPhone resolution, using virtual resolution as I do, then the height to width ratio is different when run on an iPad and there are black bars. And the variety of ratios on Android devices is rather wide.

And using SetVirtualResolution(GetDeviceWidth(),GetDeviceHeight()) is not an option if the app, like mine, needs to have a constant and known resolution. Even using a DVader's suggestion of percentages doesn't work for me because it still changes the distances and my WIP is a time based thing and, if the distances are different, the times are different.

Sometimes you need to use a specific size, period. That is when SetScissor allows you to fill the extra space (which becomes out of limits during game play, as indicated by other effects).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 20:31:36
Your offset time is: 2024-11-24 20:31:36