RGB (Red Green Blue)

Hello JGO:

Today I will show you my game RGB. It is named so because of the color of the items within the game. Red is the player, green are the enemies, and blue is the target. This game is based off of “The World’s Hardest Game”, except for the fact that it’s all in about 16 KB. Here’s a fairly non-descriptive screenshot:

The enemies move forwards and backwards (not very well represented in the picture), and you (the red square) are trying to get to the target (the blue square). Please ignore the _MacOSX file that will probably occur when you extract the archive. There are 3 levels. Once you get to the end, it will say “You Win!” regardless of your score.

If you’d like to try the game, the link is here

  • DarkCart

Tried it (OS X). For me, the green squares are moving repeatedly right to left (wrapping at the left edge), and not back and forth. Also, they’re moving in noticeably discrete steps (looks like about 5 frames per second) rather than smoothly.

Does that sound right? Just wondering if maybe I’m seeing some bugs on my system.

Yeah, that is all supposed to be happening.

Oh, ok - just making sure :slight_smile:

Was it compiled with Java 8? Got the following error

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/darkcart/
game/hg/HardGame : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Yes, it is Java 8, I forgot to mention that

waggles fist :stuck_out_tongue:

Yeah… sorry…

Started up the game (Windows 7) by right clicking and opening with Java and got this:

However opening with command line (java -jar RGB.jar) worked.

It’s definitely very… choppy. I don’t mean that negatively, but it’s not exactly positive either. Maybe that’s the point of the game so you have to use reflexes and timing to win. If you had more levels with varying difficulty this would definitely be a lot more playable and fun.

Keep up the good work! ;D

I’m actually working on killing some of this choppiness as we speak, so it may not be choppy for (much) longer. I agree, it could use more levels. Thanks for your feedback

Very low FPS here, win7 64x, but the game is running properly (I realized that sometimes I do not even die in collision with green squares).

Why should it low FPS happen? it is on purpose?

I tried to debug this JAR to find the cause, he is using a swing Timer with a sleep time of 25 milliseconds, yielding 1000/25 = 40 FPS. And the movement because he is jumping 15 pixels per key press.

@DarkCart Why are you using a swing Timer, you really should consider trying out libgdx or even lwjgl. You wouldnt have these types of problems if you did use those. But anyways, best of luck :wink:

For better FPS syncing, check out https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/opengl/Sync.java

I’ll say it again. I am working on the lag and FPS. (Also coins.)

Are you using Java2D?

Yes. I know what you’re going to say (“You should use LWJGL or LibGDX!!”). I wish people would stop pushing me to use LWJGL or LibGDX.

Even if nobody said that to you, you will find yourself using one of those in the near future, when you get to make actual games. I don’t want to make any offence to Java2D, it is just not the right tool for game development.

No… i wasnt. I was just asking because since shc was talking about the swing timer, I thought you were using swing only. :-
But still, out of curiosity, why do you use Java2D?

Oh. I’m sorry for jumping to conclusions. I guess I still use Java2D because that’s the API I used to make “Mazer” with, and I guess I never looked back to see what other options there were.

To provide some insight on this, here’s what I can do with LWJGL at the moment.

That’s all direct rendering, no VBOs or anything. In Java2D, I can do things like RGB.