Pi Jump

I have been repeatedly having failed attempts at projects that were too large in scope for me, so today I decided to narrow my scope. I wrote up a small game similar to Fruit Ninja, but with Pi symbols for the upcoming Pi Day!

Engine: I used pure LWJGL with a neat wrapper I wrote that allows me to encapsulate 99% of the OpenGL commands :slight_smile:

I know the game isn’t much, but I was happy to actually see a small project get completed :slight_smile:

(The background was pulled from opengameart.org)

http://s2.postimg.org/qgqnhsdw9/Pi_Jump_screenshot.png

(The background was pulled from opengameart.org)

Links:
Windows 32 bit: https://www.dropbox.com/s/d2ankdzsla8eawu/Pi%20Jump%20-%20Windows%2032bit.zip?dl=0
Windows 64 bit: https://www.dropbox.com/s/lufztqu64dk04tn/Pi%20Jump%20-%20Windows%2064bit.zip?dl=0

I will happily post Linux and Mac builds if there is interest (I just need to change one line in the build.xml file)

Negative Zero: Hmm, I don’t know what could be causing a GL_INVALID_OPERATION… (I’m assuming you do but) does your graphics card support OpenGL 3.0?

My GPU and drivers support GL4.4 (Radeon R9 280X).

This reference is great for finding out when you’re making GL errors.
https://www.opengl.org/wiki/Category:Core_API_Reference
Each page for each command shows why each command would spew up each error.

What confuses me is the fact that every time I run it it doesn’t encounter a single OpenGL error.

The rendering is pretty standard, I just put everything into a mapped buffer and then just render chunks of that buffer with glDrawArrays, binding the proper textures to the shader as I go.

I got the same error as NegativeZero.


D:\Pi Jump - Windows 64bit>java -jar "Pi Jump.jar"
[Sun Mar 08 09:03:05 IST 2015] [DEBUG] Console: Sound System not initialized. Do not load sounds.
Exception in thread "main" com.digiturtle.engine.util.GPUError$OpenGLException: OpenGL encountered an error (code: 1282)
        at com.digiturtle.engine.util.GPUError.checkError(GPUError.java:53)
        at com.digiturtle.engine.graphics.opengl.GLGraphics.flush(GLGraphics.java:226)
        at com.digiturtle.engine.graphics.opengl.GLWindow.launch(GLWindow.java:128)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:56)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:23)

D:\Pi Jump - Windows 64bit>

I’m running this on Windows 8.1 Single Language x64 with NVIDIA GTX 750 Ti GPU and driver version 347.52. I have support for OpenGL 4.5. Hope this helps to identify the issue.

Well… this is certainly confusing. I tested it on both Windows 8 64bit computers that I have access to, and neither had a problem. I wish that it was the other way around (me with the issue, other people without), because then I could print out glGetError() each line and see what line caused the problem.

Here is a debug jar, that goes through the lines that I suspect are causing the issue and prints out about 10 glGetError() calls.

SHC or NegativeZero, if you don’t mind I would appreciate one of you running this debug jar and sending me a printout.

Okay, I did the test run with the debug JAR, and here is the output.



D:\Pi Jump - Windows 64bit>java -jar "Pi Jump.jar"
[Sun Mar 08 10:00:42 IST 2015] [DEBUG] Console: Sound System not initialized. Do
 not load sounds.
Start create:
1282
0
0
0
0
0
0
0
0
End create:
Exception in thread "main" com.digiturtle.engine.util.GPUError$OpenGLException: OpenGL encountered an error (code: 1282)
        at com.digiturtle.engine.util.GPUError.checkError(GPUError.java:53)
        at com.digiturtle.engine.graphics.opengl.GLGraphics.flush(GLGraphics.java:226)
        at com.digiturtle.engine.graphics.opengl.GLWindow.launch(GLWindow.java:128)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:58)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)

D:\Pi Jump - Windows 64bit>

However I don’t see much information in this build than in the previous thing, except for the glGetError values.

I am attempting to find which line is causing the GL error. However, this process becomes more difficult as I am unable to reproduce the issue on my own computer. Your first printout was actually quite helpful :slight_smile: I now know that two places are causing the error code, and I have traced the first error back a few method calls.

When you have a sec, here’s another debug jar that traces back a dozen more lines to see where the error begins.

Okay, I ran again with the new JAR you provided, and the output is almost identical to the before, except that the “start create” moved below the error.


D:\Pi Jump - Windows 64bit>java -jar "Pi Jump.jar"
[Sun Mar 08 10:36:58 IST 2015] [DEBUG] Console: Sound System not initialized. Do not load sounds.
1282
0
0
0
0
0
Start create:
0
End create:
Exception in thread "main" com.digiturtle.engine.util.GPUError$OpenGLException: OpenGL encountered an error (code: 1282)
        at com.digiturtle.engine.util.GPUError.checkError(GPUError.java:53)
        at com.digiturtle.engine.graphics.opengl.GLGraphics.flush(GLGraphics.java:226)
        at com.digiturtle.engine.graphics.opengl.GLWindow.launch(GLWindow.java:128)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:58)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)

D:\Pi Jump - Windows 64bit>

Hope this helps.

Welcome to the wonderful world of Indie Games.

Here’s another debug jar: https://www.dropbox.com/s/61igtz20jv6l8fd/Pi%20Jump.jar?dl=0

This one has a few more calls, but the first error is traced call-by-call back to glfwInit(). Then I can get to fixing the second error.

Still the error is not solved. Here is the complete log.


D:\Pi Jump - Windows 64bit>java -jar "Pi Jump.jar"
Pre-init: 0
doInit()
0
0
0
1282
0
0
0
0
0
0
0
0
0
0
0
0
0
0
doInit()
Post-init: 0
[Sun Mar 08 12:40:29 IST 2015] [DEBUG] Console: Sound System not initialized. Do not load sounds.
0
Start create:
0
End create:
Exception in thread "main" com.digiturtle.engine.util.GPUError$OpenGLException: OpenGL encountered an error (code: 1282)
        at com.digiturtle.engine.util.GPUError.checkError(GPUError.java:53)
        at com.digiturtle.engine.graphics.opengl.GLGraphics.flush(GLGraphics.java:226)
        at com.digiturtle.engine.graphics.opengl.GLWindow.launch(GLWindow.java:130)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:58)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)

D:\Pi Jump - Windows 64bit>


C:\Users\Austin\Downloads>java -jar "Pi Jump.jar"
java.io.FileNotFoundException: build.xml (The system cannot find the file specif
ied)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:41)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)
Exception in thread "main" java.lang.NullPointerException
        at com.digiturtle.engine.resources.ResourceManager.loadDependency(Resour
ceManager.java:80)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:45)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)

C:\Users\Austin\Downloads>

Now it’s just not starting.

Syszee: download the original build and just swap out the pi jump debug jar.

SHC: I have the issue narrowed down to the vertex/fragment shader that I use.

Edit: I think the issue was related to the linking of the vertex shaders and fragment shader. I removed all of the glGetError() call except one, and I added an if statement. If the shader isn’t linking correctly, which is what I think is happening, then a printout should appear with the logs for both shaders. I think that may help me fix the issue.

If you wouldn’t mind running another (hopefully the last) debug jar:

I know this is a painstaking way to have other people run a program to fix a bug in my code, but I can’t seem to replicate the error on either Windows machine that I have access to.


C:\Users\Austin\Downloads\Pi Jump - Windows 64bit\Pi Jump - Windows 64bit>java -
jar "Pi Jump.jar"
Shader failed to compile
Vertex Log:
0(8) : error C5060: out can't be used with non-varying pass_Tint
0(9) : error C5060: out can't be used with non-varying pass_TextureCoord

Fragment Log:
0(7) : warning C7532: global function texture requires "#version 130" or later

[Sun Mar 08 20:22:59 CDT 2015] [DEBUG] Console: Sound System not initialized. Do
 not load sounds.
0
Exception in thread "main" com.digiturtle.engine.util.GPUError$OpenGLException:
OpenGL encountered an error (code: 1282)
        at com.digiturtle.engine.util.GPUError.checkError(GPUError.java:53)
        at com.digiturtle.engine.graphics.opengl.GLGraphics.flush(GLGraphics.jav
a:226)
        at com.digiturtle.engine.graphics.opengl.GLWindow.launch(GLWindow.java:1
28)
        at com.digiturtle.pijump.PiJump.onCreate(PiJump.java:58)
        at com.digiturtle.engine.util.Launcher.create(Launcher.java:28)
        at com.digiturtle.pijump.PiJump.main(PiJump.java:25)

C:\Users\Austin\Downloads\Pi Jump - Windows 64bit\Pi Jump - Windows 64bit>

Still occurring, unfortunately. :-\

While the game still crashes, I know now exactly what needs to be fixed :slight_smile:

I updated the links in the OP to the fixed versions.

I also found out why I didn’t experience the same issue. I use the Intel graphics card that came with my computer, which doesn’t assume the GLSL version when it isn’t specified, while AMD and Nvidia graphics cards assume an unspecified GLSL version to be GLSL 1.0.

It works. :slight_smile:

I got to 5000! But then one spawned on the very edge and barely was on screen… rendering me unable to click. ;(
Alas, the great battle ended as it should.

How did you fix it, I’m curious?