Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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  
  My Game's Framerate (Am I paranoid?)  (Read 2365 times)
0 Members and 1 Guest are viewing this topic.
Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Posted 2012-05-30 21:20:35 »

I just created an account at java-gaming, and just need confirmation on something.  While I am new to Java, I do have experience as an ActionScript 3.0 programmer, so creating game logic is not the issue.

I am making a platformer using java2D with my own engine for displaying the content.  I have a fairly decent game loop that keeps the game logic consistent while preventing tearing.  The game runs at 60fps, but occasionally hiccups on some machines.  I am using a bufferStrategy to do the rendering while allowing the openGL pipeline to do it's job.

I'm here to ask if someone could check to see if my game runs at a good fps on their machine.  While I can get the game to run perfectly smooth on my laptop, the framerate is a bit sluggish on other machines.  I don't know if I'm simply being paranoid about the framerate, or if there is a problem that I need to address.  I want to see how the game performs on other machines, so that is why I am asking for your opinion.

If this is not the right place to be asking this question, I do apologize.  I'm new here, so I may not know the correct way to go about asking this question.  The link to download game is below.  It's only about 2mb now, as I haven't gotten too far.  Still building the game logic!  I do appreciate any potential help!

Link: http://www.mediafire.com/?4no8dyldj0h8vrm

P.S.  I created a configuration file in the stuff folder that can be opened in notepad or wordpad which allows the user to set properties such as sun.java2d.opengl.  If ya wanna fiddle around with the graphicsConfig.figgy file, be my guest!

Did you know that 90% of statistics are wrong?
Offline aazimon
« Reply #1 - Posted 2012-05-30 21:44:41 »

It's highly likely that your game loop will perform differently on different machines. Check out this article on game loops.
http://www.java-gaming.org/topics/game-loops/24220/view.html
Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #2 - Posted 2012-05-30 22:02:16 »

 Undecided  It seems I was already using a game loop with concepts introduced by variable timestep game loops.  As I said before, I am able to have the game logic remain consistent with the desired framerate.  I am really just asking if someone could test my demo to see how the performance is on their machine.  If it's too much trouble, then I understand.

Did you know that 90% of statistics are wrong?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2012-05-30 22:06:11 »

Tried it.

Quote
UnsupportedClassVersionError

Guess you compiled it for Java 7

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #4 - Posted 2012-05-30 22:11:29 »

I appreciate the quick response and the fact that someone tried it!  You are correct.  The game is compiled for Java 7.  I'm guessing this could harbor compatibility issues?

Did you know that 90% of statistics are wrong?
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #5 - Posted 2012-05-30 22:13:49 »

I appreciate the quick response and the fact that someone tried it!  You are correct.  The game is compiled for Java 7.  I'm guessing this could harbor compatibility issues?

Thats true. I haven't installed java 7 yet, I'm currently afraid of bugs and incompatibilitys with Linux, so I use java 6. I got excactly the same error.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Cero
« Reply #6 - Posted 2012-05-30 22:14:06 »

I appreciate the quick response and the fact that someone tried it!  You are correct.  The game is compiled for Java 7.  I'm guessing this could harbor compatibility issues?

Well on Linux and Mac 6 is still standard and most of Windows too, in reality I guess.
Everyone could and should have 7, but its just not yet realistic I think

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #7 - Posted 2012-05-30 22:28:29 »

Hrrm... I was hoping for a different answer, but this is another important issue that I need to address.  Regardless, I appreciate the help!   Grin

Did you know that 90% of statistics are wrong?
Offline 65K
« Reply #8 - Posted 2012-05-30 22:30:56 »

After disabling the OpenGL switch, it runs fine on my machine (that switch never works for me).
Q6600 and GTX460.
Seems quite smooth. Would probably run at a much higher rate that 60 fps.
But to find bad hotspots, leaks and the like you would probably need a profiler anyway.

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #9 - Posted 2012-05-30 22:40:07 »

Good to hear!

Did you know that 90% of statistics are wrong?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Danny02
« Reply #10 - Posted 2012-05-30 22:42:53 »

don't use backslahes "\" because they will only work on windows.
Use "/" instead which will work everywhere
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #11 - Posted 2012-05-31 00:28:04 »

Your original post sounds like typical Java2D. You can never get good constant behavior. I suggest you finally ditch AWT completely and go for raw OpenGL through LWJGL. If you don't want to learn OpenGL, you can use Slick2D, which has a Java2D-like API yet uses LWJGL underneath. You can also use LibGDX, which is an excellent library on top of LWJGL or JOGL, while allowing you to compile to Android and HTML5 too.

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #12 - Posted 2012-05-31 03:28:39 »

Would it be in any way possible to keep the current engine I've built?  I've spent months on building it, and would really be peeved to have to start all over.  I guess my question is would it be possible to, lets say, replace every item that uses a BufferedImage with whatever image class LWJGL uses?  That way, I could retain the functionality of the classes I've created that encapsulate the the image data.

Did you know that 90% of statistics are wrong?
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #13 - Posted 2012-05-31 03:31:27 »

OpenGL doesn't have an image construct. To draw an image onto the screen, you upload the raw image data onto a texture, bind it, and map it onto a quad.

If any of that didn't make any sense, you should ditch Java2D (and yes your engine too Tongue) and get to learning OpenGL.

I had to ditch my super extensive Java2D engine too, it's ok. Think of it as a learning experience. Smiley

Otherwise, use Slick2D, which does have an Image class and a Graphics class that mimick the Java2D API.

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #14 - Posted 2012-05-31 03:39:29 »

Yikes!  That's really upsetting!   Cry  Well, apparently I've gotten decent results on another user's computer, so for this one game I'm building I'll stick with Java2D.  It's just occasionally a tad jittery.  When I start another project, I'll definitely investigate LWJGL.

Did you know that 90% of statistics are wrong?
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #15 - Posted 2012-05-31 03:54:42 »

Here read this. Your situation starts at paragraph 3 Smiley

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #16 - Posted 2012-05-31 04:09:08 »

Let me rephrase.  I have a couple of classes that make displaying things easy.  I borrowed a couple of names from ActionScript, so there is some overlap in functionality.  The DisplayObject class I created contains a user specified BufferedImage, and getters and setters for width, height, scaleX, scaleY, and rotation.  The DisplayObject container can contain multiple DisplayObjects or even other containers.  It is useful for nesting images.

Could I make make my objects essentially function in the same way, but rewrite a large portion of my engine to accommodate for the change from a BufferedImage to a LWJGL texture?  Slick2D sounds nice, but I don't always know what's going on under the hood.

Did you know that 90% of statistics are wrong?
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #17 - Posted 2012-05-31 05:09:02 »

Yes, it is possible to rewrite your engine using OpenGL.

Offline ReBirth
« Reply #18 - Posted 2012-05-31 05:54:29 »

With Slick2d you can skip about binding, texture, mesh or whatever.

Offline davedes
« Reply #19 - Posted 2012-05-31 06:38:23 »

Although Slick's API is similar to Java2D in some ways, trying to port from one engine to another is definitely not going to be easy. I'm seeing JMF, JavaSound, and some other things that will not really flow well in an engine like Slick.

My advice is to shelf whatever Java2D project you've got now and start again from the ground up, this time learning Slick2D, LibGDX or another library. Smiley

Honestly, every time I see a thread like this I cringe. Java2D is simply not a good starting point for a beginner game developer.

Offline UprightPath
« Reply #20 - Posted 2012-05-31 06:56:34 »

I attempted to run your game, and unless I do it from Command Line, I get a WSOD (White Screen of Death?).

Slick's pretty easy to run with and it comes with a lot of stuff that can be helpful to you, like the various stuff for controlling the frame rate, etc. And it has an extension for the lovely TWL GUI system, which can make a lot of things easier.

LibGDX is a personal favorite right now, mainly because I recently got myself an Android phone and it makes writing/testing things for the Android easier than trying to dig through LogCat. However, learning its built in UI system can lead to some fun do to the dearth instructions and the like (Though, just reading the sparse Javadocs and the actual code can teach you a lot about it).

Offline 65K
« Reply #21 - Posted 2012-05-31 08:17:23 »

I started with Java2D as well and added/switched to OpenGL with LibGdx at some point. That was relatively easy and worth it.

But before doing so, it would make very much sense to identify your problems first, otherwise you could end up with the same problems after porting.
I never encountered hiccups with Java2d.
Could be that suspicious OpenGl-switch, wrong usage of sleep() calls, using unmanaged images, creating too much garbage, bad algorithms, testing on ancient machines, anything...

Offline 65K
« Reply #22 - Posted 2012-05-31 09:02:00 »

After running your game for about 1 minute there was a huge amount of garbage created:
~ 500MB for double[]
~ 100MB for java.awt.Dimension

That is way too much for a ball and a background. I didnt' even move the ball. I would first check that. Even the best garbage collectors reaches its limits at some point. And that's not Java's fault or that of the GC principle.

Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #23 - Posted 2012-05-31 20:43:22 »

Alright, I'm gonna just shelf what I have currently even tough it pains me to do so to no end...  For the time being, I'll pick up slick.  I'm used to developing games without focusing too much on what's going on under the hood, so I guess it's in my best interest to pick that up.  When I become more experienced with the topic, I definitely WILL invest more time into rendering graphics on my own.  Thanks again for the quick responses!  I was just looking for an opinion, but I got an entire diagnosis!

Did you know that 90% of statistics are wrong?
Offline roland
« Reply #24 - Posted 2012-06-01 05:53:41 »

Your original post sounds like typical Java2D. You can never get good constant behavior. I suggest you finally ditch AWT completely and go for raw OpenGL through LWJGL. If you don't want to learn OpenGL, you can use Slick2D, which has a Java2D-like API yet uses LWJGL underneath. You can also use LibGDX, which is an excellent library on top of LWJGL or JOGL, while allowing you to compile to Android and HTML5 too.

HTML5!? OMG!
 Smiley !!!

anyone tried this?
Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #25 - Posted 2012-06-01 06:35:54 »

Your original post sounds like typical Java2D. You can never get good constant behavior. I suggest you finally ditch AWT completely and go for raw OpenGL through LWJGL. If you don't want to learn OpenGL, you can use Slick2D, which has a Java2D-like API yet uses LWJGL underneath. You can also use LibGDX, which is an excellent library on top of LWJGL or JOGL, while allowing you to compile to Android and HTML5 too.

HTML5!? OMG!
 Smiley !!!

anyone tried this?
Yup, you can find their demos on their website.

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.

pw (11 views)
2014-07-24 01:59:36

Riven (10 views)
2014-07-23 21:16:32

Riven (11 views)
2014-07-23 21:07:15

Riven (12 views)
2014-07-23 20:56:16

ctomni231 (42 views)
2014-07-18 06:55:21

Zero Volt (38 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (34 views)
2014-07-16 23:30:00

Cero (50 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!