Slick Forums

Discuss the Slick 2D Library
It is currently Thu Oct 23, 2014 3:44 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Jan 05, 2010 2:43 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
I have a few questions about full screen mode. What happens if you have dual monitors? What happens if you have a wide-screen monitor and you try to switch to 640x480 or 800x600 resolution (4/3 ratio)? Can an applet switch to full screen mode and back?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 05, 2010 3:19 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 582
1) dual monitors

I can't really answer this as I don't have dual monitors but from what I understand fullscreen will use the first monitor.

2) if your running slick as an application the game window will stretch to fill the screen so the aspect ratio will be off if it doesn't match that of the monitor. Use Slicks ScalableGame class to work round this. As for applets see next point.

3) yes applets can switch to fullscreen and back, e.g. see my game final kapster :)
Applets use a special fullscreen mode for really fast switching to fullscreen and back. Aspect ratio is always maintained with fullscreen applets, there will be black borders on monitors with different aspect ratio, for example if the game is not widescreen (like the game linked above) you'll get black borders on the sides.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 05, 2010 3:27 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
Thanks your help.

Is ScalableGame an efficient way to display the game in full screen mode? Does it actually snap into a lower resolution or does it just stretch the window? Do applets run efficiently in full screen mode?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 05, 2010 3:33 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 582
zeroone wrote:
Thanks your help.

Is ScalableGame an efficient way to display the game in full screen mode? Does it actually snap into a lower resolution or does it just stretch the window? Do applets run efficiently in full screen mode?


1) it just stretches the game to fit, while keeping the resolution you wanted.
2) yes they run pretty well in fullscreen mode.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 05, 2010 3:35 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
Quote:
1) it just stretches the game to fit, while keeping the resolution you wanted.


Let's say my game runs in a 400x400 window. Will it be smart enough to detect that 640x480 mode is available and it should switch to that resolution and then scale/offset accordingly.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 05, 2010 4:00 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 582
yes, just see the javadoc for it.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 10, 2010 1:41 am 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
ScalableGame is producing really poor results. When using Images extracted from PackedSpriteSheets, sometimes it pulls colors around the border of the Image from neighboring images in the sprite sheet. I noticed the same bug when you rotate Images extracted from PackedSpriteSheets even without ScalableGame. In general, the rendering looks really poor when scaled. Image tiles in my game no longer line up properly. The pixels are not scaled uniformly across the screen. It looks like some pixels are scaled 2x and others 2.25x, etc. I wish there were a way to configure ScalableGame to uniformly scale all pixels by an integer multiplier even if that means black borders on all 4 sides. For example, if I created a game that is 640x480, then let it switch to 960x540 mode (wide screen monitor) and center the 640x480 window. I would prefer black borders over this bad rendering. Is there a way to use nearest neighbor scaling instead of some kind of interpolation. It may actually look better if there is. Also, clipping does not work correctly with ScalableGame.

Is there some way I can simulate the properties of ScalableGame without using that class? Perhaps I can rig up an alternative scaling method.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 10, 2010 12:37 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
There's the Image constructor
new Image("image.png", false, Image.FILTER_NEAREST); which should keep your scaling pixelly.

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 10, 2010 3:54 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
Thanks. I noticed that the constructor of PackedSpriteSheet also accepts image filters. I'm not sure if this will help, but I'll experiment with it.

Is there a way to contain a list of all available display modes? How does ScalableGame actually work? Is it possible to for me to make my own version?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 11, 2010 2:30 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
I think I am starting to understand what is going on here. ScalableGame scales all sprite drawing operations. Meaning, when you draw a sprite, it scales the upper-left position coordinate and the size of the sprite. Unfortunately, in my tile-based game, it is leaving gaps between some tiles. Also, when sprites are backed by a PackedSpriteSheet, scaled sprites tend to pull pixels around the borders from neighboring images in the sheet (a bug caused by interpolation that also occurs with sprite rotation as well, even without scaling). Many graphical operations are not scaled correctly, such as clipping, which is causing other problems.

There should be a version/configuration of ScalableGame that draws everything to a hidden buffer without scaling and then displays the buffer scaled to the full screen. I don't know what the performance implications of that would be, but I would much rather have something that displays the graphics as intended and run a little slower than for it to render full of graphical artifacts.

Does any kind of scaling occur if you use full screen mode without ScalableGame? Is anyone else having these problems with full screen mode? Are there any work arounds?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 11, 2010 7:42 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
I am trying to make sense of monitor sizes and resolutions. I have a normal (non-wide-screen) monitor with a native resolution of 1280 x 1024 (5:4 = 1.25). But, it can also display 640x480 (4:3 = 1.3333). Does that mean scaling is occuring in 4:3 mode? If so, will the canvas ratio be different in windowed mode vs. full screen 640x480 mode? Are the LCD pixels squares or rectangles?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 11, 2010 8:50 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
I have been playing around with this a bit further. As I mentioned, my LCD's native display resolution is 1280x1024, but my game canvas size is 640x480. I found that this works really well:

Code:
    AppGameContainer app = new AppGameContainer(
        new ScalableGame(new Main(), 640, 480, true));
    app.setDisplayMode(1280, 1024, true);


I could add code that plugs in your current resolution setting. Is that a good idea in general though? Is this wasting video memory? Will it have performance problems on wide-screen monitors if I plugin their current desktop resolution? It seems to be running just as quickly as when I had it switch to 640x480 mode. In fact, the image looks a lot clearer and I think there was a slight bit of distortion in 640x480 mode.

I guess I'm down to: What are the best practices to using ScalableGame?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 17, 2010 3:17 am 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
Is there any way to do all my rendering to a temporary buffer and then scale that buffer to full-screen size instead of using ScalableGame? When using ScalableGame, I am still getting a lot of rendering artifacts such as thin black edges between tiles.

No one else is having similar problems?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 17, 2010 12:30 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
zeroone wrote:
When using ScalableGame, I am still getting a lot of rendering artifacts such as thin black edges between tiles.

No one else is having similar problems?


I have this issue, I work around it by only scaling in the particular aspect ratio. i.e. I won't scale from a 4:3 resolution such as 320x240, 640x480 to a 16:9 widescreen resolution. Going into fullscreen with a 4:3 resolution should put black lines down the side of the screen as not to go out of aspect ratio.

A general side-node: I store the default container dimensions in variables which my logic uses instead of container.getWidth(). I guess if I wanted to support widescreen I would have to mess around with those variables.

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 17, 2010 4:50 pm 
Offline
Regular

Joined: Wed Dec 09, 2009 6:56 pm
Posts: 135
Thanks Gwinnell.

I tried the same, but I found that I still get occasional artifacts. It's really depressing that you can work on a game and it looks great in window mode and then when you flip it to full screen, it's all messed up. I don't understand why it can't scale after drawing everything.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group