Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Full Screen or Windowed?  (Read 3780 times)
0 Members and 1 Guest are viewing this topic.
Offline zappsweden

Junior Member




Java games rock!


« Posted 2005-12-06 14:06:22 »

I am currently working on a hexagon turn based strategy game. I use Swing and compile in Java 1.42_01b06. I use windowed mode. My problem is that I get low frame rates (5-10 frames per second). I have 1.4 GHz Processor.

I am now considering using Full Screen API. Also, under consideration is switching to Java 1.5. Is Does 1.5 provide any significant improvment to the paintComponent() performance or do I need to switch to Full Screen?
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2005-12-06 15:57:50 »

1.5 is faster than 1.4, on Windows. Fullscreen will get you more performance however I'm not sure why you want an increase in FPS for a turnbased game...?

Cas Smiley

Offline zappsweden

Junior Member




Java games rock!


« Reply #2 - Posted 2005-12-06 16:31:48 »

Reasons:
Scrolling the map smoothly. Also animations like when moving a unit on the map.  Smiley

What increase is there between 1.4 and 1.5 roughly? 50%? more?
Keeping the version constant, what difference is there between Windowed and Full-Screen 100%? 500%?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zappsweden

Junior Member




Java games rock!


« Reply #3 - Posted 2005-12-06 17:02:32 »

Another interesting thing is. If I implement Full-Screen, should I make the game support both and being able to manually switch inside the game? why or why not?
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #4 - Posted 2005-12-06 17:22:28 »

Reasons:
Scrolling the map smoothly. Also animations like when moving a unit on the map.  Smiley

What increase is there between 1.4 and 1.5 roughly? 50%? more?
Keeping the version constant, what difference is there between Windowed and Full-Screen 100%? 500%?

Optimist Wink

You know there are hw-limitations too, not everything is java's magic Wink
I think its very unlikely to archive 50% juct by upgrading your java-version.

lg Clemens
Offline zappsweden

Junior Member




Java games rock!


« Reply #5 - Posted 2005-12-06 17:31:27 »

Reasons:
Scrolling the map smoothly. Also animations like when moving a unit on the map.  Smiley

What increase is there between 1.4 and 1.5 roughly? 50%? more?
Keeping the version constant, what difference is there between Windowed and Full-Screen 100%? 500%?

Optimist Wink

You know there are hw-limitations too, not everything is java's magic Wink
I think its very unlikely to archive 50% juct by upgrading your java-version.

lg Clemens

Well, at leist I got your attention.  Grin
Seriously. Does this mean I must use full-screen mode to get good frame rates and would not that mean I gotta overhaul everything that has to do with when jPanels receive updates?
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2005-12-06 19:24:14 »

Well, what you actually want to be looking at is active rendering, and BufferStrategy. You don't necessarily need fullscreen rendering - FS rendering might get you a moderate increase in speed but it's fairly unreliable currently (in 1.6 it's apparently much better).

Smooth scrolling and such is only really possible with active rendering and a BufferStrategy - Swing was not designed for high speed animation. So that's your next port of call. I'm not sure if it's possible to mix buffer strategy rendering inside bits of GUI that are normally rendered though.

Cas Smiley

Offline zappsweden

Junior Member




Java games rock!


« Reply #7 - Posted 2005-12-06 19:36:55 »

This is interesting but abit confusing. Swing uses double buffering by default, how would I change it then?
Another thing is VolatileImage, which apparently Java 1.4 uses too, but it still does not use it fully.

Active rendering? Does not that imply Full Screen?
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2005-12-06 21:35:46 »

No, active rendering just implies rendering explicitly rather than waiting for paint events. I don't believe BufferStrategy requires fullscreen mode. And I think you'd want to keep it all double buffered or it'll look terrible!

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #9 - Posted 2005-12-06 22:23:49 »

If you want smooth animation in your game, maybe you should reconsider Swing altogether. It's not really made with smooth scrolling games in mind. Maybe it is possible with some clever hackery though, but I have never seen anything animate smoothly in a Swing game myself.
Unless your GUI is seriously complex (which is almost never the case in games), I would personally replace it with something custom made inside an active rendering loop.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #10 - Posted 2005-12-07 18:52:20 »

No, active rendering just implies rendering explicitly rather than waiting for paint events. I don't believe BufferStrategy requires fullscreen mode. And I think you'd want to keep it all double buffered or it'll look terrible!

Cas Smiley

Cas is correct. Its a bit confusing because the actrive rendering tutorial is aprt of the full screen tutorial.  This is historical because theyw ere implemnted as part of the same project inside Sun.  But they really are independant things.

If you aren't active rendering then thats the first thing you want to change.

BUT have you profiled your code yet?  You really have no idea where your speed problems really are until you profile.  Trust me.  Its absolutely step 1 in improving performance.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline zappsweden

Junior Member




Java games rock!


« Reply #11 - Posted 2005-12-08 18:38:43 »

Hmm, speaking of Full Screen mode. when I set the Displaymode, what refresh mode can I set and what happens if the refresh rate is too high?
Offline Jeff

JGO Coder




Got any cats?


« Reply #12 - Posted 2005-12-08 19:16:46 »

Hmm, speaking of Full Screen mode. when I set the Displaymode, what refresh mode can I set and what happens if the refresh rate is too high?

What screen settings you can set is dictated by the operating system.  If you look at the eample apps in Mike's tutorial you will see an example that fetches those and allows you to chnage the settings.

If you use an unsupported setting, the result of that too is dictated by the underlying OS.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline zappsweden

Junior Member




Java games rock!


« Reply #13 - Posted 2005-12-08 19:55:16 »

.
Offline zappsweden

Junior Member




Java games rock!


« Reply #14 - Posted 2005-12-16 20:34:06 »

I managed to solve all problems I had earlier. I now have an option inside the game to switch between full screen mode and windowed mode. However a new problem then emerged. The full screen drawing is flickering since it is not double buffered. I need double buffering. The BufferStrategy class can only be used on Window Class and Canvas Class. I use JPanels for everything so far. I read somewhere not to mix AWT and Swing components.

Should I use Canvases for the map and minimap or should full screen and windowed mode have one Map+Minimap EACH and switching between them? I might have miussed something here, is there any simple way to go around this?
Offline Jeff

JGO Coder




Got any cats?


« Reply #15 - Posted 2005-12-17 06:19:57 »

you do not want to buffer in panels.  That *will* be slow in comparison to proper page flipping, which is what BufferStrategy gives you.

If your goal is performance, ditch the panels.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline zappsweden

Junior Member




Java games rock!


« Reply #16 - Posted 2005-12-17 10:05:29 »

I dont need much speed, perhaps 20-25 frames/second. So, I cannot use any existing class to get buffering when using JPanel with active rendering in full screen, I must switch to Canvas?
Offline Jeff

JGO Coder




Got any cats?


« Reply #17 - Posted 2005-12-18 00:31:45 »

Full information on Bufferstrategy is here:

http://java.sun.com/docs/books/tutorial/extra/fullscreen/bufferstrategy.html

You can use BufferStrategy with any component that provided a createBufferStrategy call.

For best performance though you want to use it on a full screen exclusive window.  This allows the BufferStratgey to use video memory page-flipping.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (24 views)
2014-09-19 03:14:18

Dwinin (39 views)
2014-09-12 09:08:26

Norakomi (67 views)
2014-09-10 13:57:51

TehJavaDev (93 views)
2014-09-10 06:39:09

Tekkerue (47 views)
2014-09-09 02:24:56

mitcheeb (68 views)
2014-09-08 06:06:29

BurntPizza (51 views)
2014-09-07 01:13:42

Longarmx (38 views)
2014-09-07 01:12:14

Longarmx (44 views)
2014-09-07 01:11:22

Longarmx (40 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!