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 / Full screen game that doesn't use the full resolution of the screen

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 13:36
I've developed my platform game to work at 1920 x 1080 - I don't want the resolution to go higher (or you can see too much of the map and the tiles become apparent with small gaps and they're also bluury!). I want the game to be "full screen" (ie not in a window) on higher resolution monitors and use black borders to fill in the remaining space. How can I do that? Currently when I use the full screen flag on SetWindowSize it stretches the game to fit the whole screen.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 22nd Aug 2017 13:55
Have you set the SetVirtualResolution? This normally works for resizing with black borders so it has the same ratio.

Eg,

The Amiga and Amos were great!
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 14:11
Just tried that but it still stretches the game to the full width of the screen (and fills in the top and bottom with black) and therefore is resizing the game (ie it's not pixel for pixel). I'd never noticed it because my other monitor is 1920 x 1200 so it couldn't actually do any strectching and seeing the borders top and bottom I assumed that it would do that all the way around if the monitor resolution was greater width wise too.


Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 22nd Aug 2017 14:26
The virtual resolution will scale the screen and use black borders to keep the correct ratio so the tiles won't be mis-shaped, you shouldn't get gaps between tiles but you may get blurred images depending on how much it is scaling, shouldn't be much though.
You could always use more than one set of Sprite Atlases for differing screen sizes but that would be a bit of effort to modify your tiles into 3 or 4 sizes of images.

Not sure if you can do it any other way?
The Amiga and Amos were great!
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 14:59
I could try and get around it by using the SetScissor command but that feels wrong - I'd be surprised if it weren't possible to have a fixed resolution of output irrespective of the display resolution?

Man, I'm hoping this isn't going to be a stumbling block 3 years in!
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Aug 2017 16:09 Edited at: 22nd Aug 2017 16:12
just glanced through

SetVirtualResolution
"1280, 800 "
1280x720 is hd same aspect ratio than 1920x1080 full hd.

see also SetWindowAllowResize( mode ) because you can switch from full into windows mode.
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 16:21
I can always check the device resolution and if it's greater than 1920 x 1080 (or at least a horiz/vert combi that creates the unwanted stretching) then make the game play in a window but there are two drawbacks - one, it appears that you are then limited to 59/60 cycles per second and it's nice to have the code running at max speed (to prevent slow-downs when things get heavier) and two, it just doesn't feel as immersive having a windowed game with the desktop visible in the background.

It would be super useful to be able to run games in full screen (at non constrained speeds) whilst simultaneously being able to force the resolution to use

@TGC.... is this something that can be done?
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 16:25 Edited at: 22nd Aug 2017 16:26
@Markus - I need to avoid that as it spoils 1:1 pixel which creates nice sharp graphics, and I get break up where my tiles seem to fit less well and leave small gaps/aberrations.

Edit: Currently the game looks really sharp/crisp because everything is 1:1 pixels
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Aug 2017 18:08 Edited at: 22nd Aug 2017 18:19
If I understand correctly you are trying to get agk fullscreen mode without a window

MaximizeWindow() Should maximize it on a PC

When the virtual resolution and the window size is set lower than your pc resolution AGK
will automatically place black borders around the edge

SetDisplayAspect( aspect ) If the aspect ratio given does not fit exactly on the current device,
black borders will be drawn around the rendering area to center it on screen.

Its got to do with the way, the AppGameKit engines resolution compatibility works

You may also want to check these commands
SetIntendedDeviceSize( width, height )
UpdateDeviceSize( w, h )

I believe if you wanted to resize the window you would then have to detect that the window
was resized and then update the device size as my trial without doing so seem to mess that up.

GOODLUCK
fubar
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Aug 2017 18:15 Edited at: 22nd Aug 2017 18:18
Quote: "l and leave small gaps/aberrations."

this problem was discussed here quite often but i can not remember at details.
you can also set aspect ratio
SetDisplayAspect ( aspect )

if you use sprite size x or y with -1 it will do a auto size that sprile looks 1:1 ratio
it looks square but it is intern rectangular.

if you use SetScissor(0,0,0,0)
it show the outer virtual size where normal black borders are if the virtual resolution is different from device aspect ratio.
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Aug 2017 18:43
In my example using the SetSpriteSize(spriteid,-1,-1) kept the ratio of all sprites resizing the window as
I felt fit. And placed a black border in other areas. That's using a window that's lower or equal to the PC
resolution.

Using SetWindowsize, SetvirtualResolution both lower than the PC resolution
SetWindowAllowResize(1) allowed me to test the different screen sizes
and SetSpriteSize(id,-1,-1) kept the aspect ratio of all sprites

Ide post the example I played with but it uses a shader and really overcomplicates a test code
fubar
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 19:32
Thanks guys for all the input - I'm not very techie so to make sure I'm being clear I've attached an image that shows what I'm after. Can it be done?
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Aug 2017 20:23 Edited at: 22nd Aug 2017 20:28
emmm, i believe you can set 2560 x 1600 as virtual resolution, this will fit screen and then you use scissors command to show the 1920x1080 area.
(the idea behind virtual resolution was to fill the screen and show at all the different screen sizes the same content.)

your game will also look fine at 2560 x 1600 if you are using hires art work.
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 22nd Aug 2017 21:12
OK, let me try that again tomorrow. I thought I'd tried that but was getting a forced 59/60 fps...but let me see what it does when I have access to the large monitor again.
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 22nd Aug 2017 21:28
I am running into this problem, too. The problem with SetScissors is that the UI is not lined up correctly. Please keep us posted.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 23rd Aug 2017 09:13
I wouldn't like to play a game that looked like that. I'd just use the setMinMagFilter commands to fix the filtering issue and run it fullscreen.
Click here for VR Legend of Zelda stuff
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 23rd Aug 2017 15:43
Do you mean set the mag filtre to zero (no antialiasing) to avoid the think lines appearing? I've had a quick play and it does solve the gaps appearing. Doesn't look as nice as the 1920 x 1080 unstretched look however...
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 23rd Aug 2017 18:01
It's definitely an option - I can offer players with large monitors the option of playing it in a window (1:1 pixel = crisp) or, using SetImageMagFilter(image,0), full screen, albeit with slightly less crisp/clean graphics. Ideally AppGameKit would provide a full screen centered display too as an option to use. The scissor method sounds like it would be processing a tonne of unnecessary info.

Would be good to hear what Paul thinks?
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 30th Aug 2017 18:47
Paul - any thoughts on this? Saw your response to the audio windows bug but this had dropped off the bottom...
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Xaron
10
Years of Service
User Offline
Joined: 3rd May 2014
Location: Germany
Posted: 30th Aug 2017 19:57 Edited at: 30th Aug 2017 19:59
So you want only players to play your game which use 1920x1080? That's easy, just ask for the device resolution and give an error message when the resolution differs from that.

Personally I see it more from the player's perspective where aspect ratios go from 16:9 (1920x1080) down to 4:3 (which would be effective 1440x1080). I use this for initialization:



Then in the main loop I use the center of the screen as offset:


You can also work with GetScreenBoundsLeft() and GetScreenBoundsRight() then to make the positioning correct.

That way it will look always correct for all aspect ratios and resolutions. Of course there will be resizing, so you probably have to forget about crisp images for all players. If you want this you have to create tile sets for different resolutions out there, but I really don't see the need for this nowadays.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Aug 2017 20:31 Edited at: 30th Aug 2017 20:33
Whats your intended platform?

I could write you a plugin that could achieve what you want but it would only work on windows

Edit: maybe a new function: SetMaxResolution(width, height, center_on_screen)
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Aug 2017 22:22
If I were trying to achieve this effect I'd try rendering everything to an image (which can be limited to 1920x1080) then draw the image to the center of the screen. You might want to make it optional so it only happens when the screen is larger than 1920x1080.
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 30th Aug 2017 22:36
First thanks guys for input and thanks PartTimeCoder for offer of plugin/function. The function you describe sounds like what I am after...but I'm starting to wonder if I've just got this wrong and it's too restricted? I love crisp sharp graphics and have designed my game on that basis - I figured most gamers would have a monitor of at least 1920 x 1080 so could run it as I see it at home but perhaps that is wishful thinking? I'm targeting PCs mainly (possibly macs too), certainly not mobile. I don't really want the aspect to change as it alters what can and can't be seen by players based on screen setup which doesn't feel right - everyone should see the same game.

I'm going to need to think this through some more - just hope my coding to date hasn't boxed me into a corner. I wish there was an easy media encrypting and single exe packing export in AppGameKit so I could pop up some demos for people to test and get feedback on options.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 30th Aug 2017 22:39
Ah, OK Paul, that is another option - hadn't thought of that. Does targeting 1920 x 1080 as a minimum spec sound nuts?
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 30th Aug 2017 22:43
http://store.steampowered.com/hwsurvey/
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Aug 2017 01:49
Quote: "Does targeting 1920 x 1080 as a minimum spec sound nuts?"

From the survey it looks like nearly half of users are below 1920x1080, so it might limit your market.
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 31st Aug 2017 08:38 Edited at: 31st Aug 2017 08:40
I have read this whole thread twice and still not 100% on what DavidAGK is wanting to achieve so here is the code I use to manage virtual resolution, I use a 1440p monitor and I haven't noticed any issues in full-screen, then again my display is 16:9 and my virtual res is 16:9 so I'll need to check none 16:9 aspects when I get home. In the rkDisplaySetMode() function (below) there are two scissor commands i'd experiments and see which one works as needed.

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 31st Aug 2017 08:38
Yes, these are real stats that they gather (super useful!) so it appears that 1366 x 768 is the lowest res you have to still allow for!

I have no idea where to begin with the rendering everything to an image (I'm really not a techie programmer!) but will take a flick through the manual/guide as I can see that would be a great solution (if performance is ok?) as it would enable me to render to the crisp 1:1 and then, if need be shrink or stretch that image (or center with black border borders, user optional) without any break-up or lines appearing in between my tiles AND with an anti-aliased stretch rather than setting the mag filter to 0 and having jaggies appear on stretch.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 31st Aug 2017 08:59
Supertino - Apologies if I've not made it clear. I think my goal posts are moving each time I get feedback! I originally intended wanted to force the game to be played across 1920 x 1080 pixels (so my graphics were displayed exactly as I had created them with no stretching whatsoever) irrespective of the monitor resolution. So lower res monitors just couldn't play the game and higher ones (higher than 1920 x 1080) would simply present the game with black borders to fill up the rest of the screen space - so all versions would play full screen rather than windowed whilst still presenting my graphics 1:1 without any stretching. I'm now starting to think that I will have to enable the game to be played by a wider range of display resolutions. Rather than totally abandon the lovely 1:1 crisp graphics, I'm thinking I should target that where the player's monitor allows it and when it's larger give them the choice of stretching to fill the screen (therefore slightly softer graphics) or have black borders (and maintain the crisp 1:1 graphics). And also enable shrinking to allow for lower res monitors. With thin feint and inconsistent lines appearing between my tiles when I use the virtual resolution thing and stretch to fill the screen, I've been left scratching my head with the best way to proceed. Paul's suggestion of rendering to a 1920x1080 image and then stretching or shrinking this feels like a possible solution as it would remove this issue.

I guess the other solution is to find out why I get think feint lines between my tiles when I'm not showing the graphics at exactly 1920 x 1080 and then use a more basic screen setup. That might be better? Thinking aloud now...
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 31st Aug 2017 10:40
I have yet to make a tile based game, but in previous languages I'd always extrude the edges of the tiles by 1px and when i grab the image (1px inwards) any floating point inaccuracies should go away. .. but thats a whole other issue and I dont know if AppGameKit does this internally or not as there doesn't seem to be any commands to facility this (or many I ain't look hard enough).

Back on topic virtual res looks like your solution to fix gaps in tiles if it looks correct at your native resolution then it should look good at any as the screen is being scaled and not each sprite, again thats my understanding but have yet to play with tiles.
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 31st Aug 2017 22:41
Supertino - I've had a play and at first glance it appears to work fine as you describe above - extrude 1 px out and then grab 1px in removed the feint lines. Results are encouraging. I'm wondering if that might also fix the stretching virtual resolution issue where lines appear. It will require some changes to my code and unfortunately I won't be able to use use the SetSpriteAnimation( iSpriteIndex, iFrameWidth, iFrameHeight, iFrameCount ) command.

It would be great to be able to have the additional inputs...
SetSpriteAnimation( iSpriteIndex, iFrameWidth, iFrameHeight, iFrameTotalWidth, iFrameTotalHeight, iFrameCount) so you could be grabbing say 64 pixel tiles BUT moving along 66 pixels before grabbing the next frame of the animation. It looks like I'll have to use atlas images with subimage text files....

Anyway, this is encouraging - if it kills both birds/bugs with one stone it'll be great! Only issue is it will take a tonne of work to truly find out if it does work!


Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 31st Aug 2017 23:28 Edited at: 31st Aug 2017 23:29
I use https://www.codeandweb.com/texturepacker to create image atlas's for all my AppGameKit projects and I noticed it has an extrude option to auto extrude sprites, i just tested it and the neat thing is the output text file that AppGameKit uses to load images from still refers the the pre-extructed x,y,width and height of each sprite. So you get a simple auto extrude option with no extra work and you can use the usual AppGameKit commands. neato
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 1st Sep 2017 09:01
Hey Supertino - That does sound neat! I was already figuring out a photoshop action that would extrude the edges but this sounds neat, especially given the extrude stuff. Thanks for the heads up!
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 1st Sep 2017 20:05
Dave, if you remember I was doing the Platypus game some time ago and I haven't had time to continue with it yet but I didn't seem to have the problem you mention with resolution and gaps etc.
Not sure how you are using tiles on your set up but have a look at the page below and go to the end page where you can download the code and last version for you to try and see if it does the same for you on your setup.

https://forum.thegamecreators.com/thread/215384?page=3

Hope it helps.
The Amiga and Amos were great!
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 1st Sep 2017 21:23
I seem to remember that your game was single screen? It occurs when you start moving tiles (or screen offset). The solution, suggested by Supertino, which I've just tested, is to extrude the tile edges. It does mean that I now have to go back and change all the tile sheets and use atlas images with subimage text files instead! Got to dig into that code now and re-do all the tile images!
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 1st Sep 2017 21:26
Oh, just taken another look - I take it back! So was the screen offset a Float?
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 2nd Sep 2017 02:21
I used this to control the camera for the scroll:

SetViewOffset(GetSpriteXByOffset(player.ID) - displayCentreX, GetSpriteYByOffset(player.ID) - displayCentreY*1.3)

Tried it in a few resolutions but always looked ok.
Have a look at the video clip on that forum page for version 1.1 and scrolls ok with no issues.
The Amiga and Amos were great!

Login to post a reply

Server time is: 2024-09-30 07:26:57
Your offset time is: 2024-09-30 07:26:57