Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
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 [2]
  ignore  |  Print  
  Fully utilising Multi cores/Multi cpus?  (Read 10267 times)
0 Members and 1 Guest are viewing this topic.
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #30 - Posted 2007-11-16 21:19:09 »

Server VM pretty much lives up to expectations then eh?

Cas Smiley

Offline DzzD
« Reply #31 - Posted 2007-11-16 21:20:55 »

12.5 fps for exe
9.5 fps for jar (client jvm)

yup about 30% faster

jvm 1.6.03
cpu XP2000 1.6ghz
gpu ati x800
ram 768MO


Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #32 - Posted 2007-11-16 22:06:22 »

Thanks for all your testing!

That is a surprising difference between the server and client jvms. Did i read some where that sun was thinking of making a jvm in which effectively the client jvm will be as good as the server jvm and thus just the one jvm?

Hmm, 175% is not bad... still better than the previous version. There are still parts of the program which are not parallerised some of which can not ever be but some which can however it does not make sense to do so until i implement a bounding volume heirachy.

So I am aiming to achive 190% utilisation.

About the FPS per run on version 10, i have changed the fps counter to use a smoothing average. For the first 3 seconds it uses the instant fps. However after 3 seconds it uses the following formula:

avgFPS= (prevAvgFPS*2+currentFPS)/3

perhaps this is causing the difference between versions? I am not sure why it would... all it will do is be less responsive to reflect change in fps.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #33 - Posted 2007-11-19 20:11:19 »

Version8:

Client-jvm:
30fps - ~170% load

Server-jvm:
46fps - ~170% load

You should check for thread problems in your code, starting your app with -Xint gives me sometimes a wrong window-size.
Are you doing all modifications to Swing/AWT-Components on the EDT?

Core2Duo T7200 laptop, 2ghz
jdk1.7.0 build22
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #34 - Posted 2007-11-20 01:15:37 »

The JFrame and components are created and setup in the constructor of sub class of JFrame. The frame and its components are never modified at any other point in the program.

A buffered image is drawn onto a back buffer of a BufferStrategy and then flipped to be viewable.

The flipping does not occur on the EDT.  but i thought that it was not necessary with BufferStrategy you are determining when to "paint"... is this not the case?
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #35 - Posted 2007-11-20 19:57:57 »

Quote
The JFrame and components are created and setup in the constructor of sub class of JFrame. The frame and its components are never modified at any other point in the program.
This could be the problem, and I guess it maybe is the root of the problem on my machine.

You create the JFrame and your components on the main-thread, not on the EDT. This is a violation of Swing's threading rules, and it is best-practise to even do component setup in the EDT.

The rendering itself can be done by any thread, because as far as I know all Java2D-related stuff is thread-safe.

lg Clemens
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #36 - Posted 2007-11-20 23:58:21 »

Really?!  All these years I have been doing it incorrectly... Can you point me to an approriate example/tutorial? All the examples i have seen on the Swing Tutorial have the components set up in the main thread... e.g. http://java.sun.com/docs/books/tutorial/extra/fullscreen/example-1dot4/DisplayModeTest.java
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #37 - Posted 2007-11-21 00:47:15 »

It should be completely possible to construct and assemble Swing components in any thread. What you can't do then is diddle with them or act on events in any thread.

Cas Smiley

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #38 - Posted 2007-11-21 01:26:16 »

Ah, I think i know what the problem is...

In order to get the frame's inset information, the frame has to be be set visible. I then re-size the frame based on these inset information. Is there a way of obtaining the frame's decoration dimensions before making it visible? Failing that I will put the re-size code in a swing worker to be performed by the EDT
Offline tom
« Reply #39 - Posted 2007-11-21 02:28:15 »

I think you can get the decoration dimensions after you call addNofity() on the frame.

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

Senior Member


Medals: 1


Java games rock!


« Reply #40 - Posted 2007-11-21 14:17:54 »

Quote
All Graphical User Interfaces require some kind of main application frame in which to display. In Swing, this is an instance of javax.swing.JFrame. Therefore, our first step is to instantiate this class and make sure that everything works as expected. Note that when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock. The following code listing shows how this is done.

http://java.sun.com/docs/books/tutorial/uiswing/painting/step1.html

lg Clemens
Online princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #41 - Posted 2007-11-21 14:55:39 »

I believe that restriction was relaxed some time ago. You can construct away and fiddle all you like until the components are actually realised on the screen.

Cas Smiley

Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #42 - Posted 2007-11-21 17:25:30 »

Quote
I believe that restriction was relaxed some time ago. You can construct away and fiddle all you like until the components are actually realised on the screen.
I found quite different results - it seems like they said some time ago that that its ok until you realize the component, but now the consensus seems to be to do everything on the EDT.

Its no problem after all, so what is the downside of doing it like recommended and beeing on the safe side?

lg Clemens
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #43 - Posted 2007-11-22 04:42:39 »

I think you can get the decoration dimensions after you call addNofity() on the frame.

Thanks! didnt know about that. It seems to have done the trick.
Offline bitshit

Junior Member




Java games rock!!


« Reply #44 - Posted 2007-12-17 11:17:44 »

Hmm, 175% is not bad... still better than the previous version. There are still parts of the program which are not parallerised some of which can not ever be but some which can however it does not make sense to do so until i implement a bounding volume heirachy.

So I am aiming to achive 190% utilisation.

Did you made any progress on this? Is spawning code in a new thread enough to have it executed on different cores?
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #45 - Posted 2007-12-17 11:38:08 »

yes and no... i am achieving about 175%-180% utilisation. however without removing a barrier wait. i have been focusing on other aspects of the engine lately.
Pages: 1 [2]
  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.

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

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

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

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

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

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

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

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

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (38 views)
2014-09-04 23:08:59
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!