My Game's Framerate (Am I paranoid?)

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!

It’s highly likely that your game loop will perform differently on different machines. Check out this article on game loops.

:-\ 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.

Tried it.

[quote]UnsupportedClassVersionError
[/quote]
Guess you compiled it for Java 7

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.

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

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

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.

Good to hear!

don’t use backslahes “” because they will only work on windows.
Use “/” instead which will work everywhere

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.

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.

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 :P) 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. :slight_smile:

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

Yikes! That’s really upsetting! :’( 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.

Here read this. Your situation starts at paragraph 3 :slight_smile:

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.

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

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

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. :slight_smile:

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