LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: wolf_m on August 18, 2006, 00:17:16

Title: Tetrismus
Post by: wolf_m on August 18, 2006, 00:17:16
Hi!

I've programmed a simple Tetris clone called Tetrismus. There's no multiplayer support, but apart from that, it's pretty much a complete game.

You can get the game along with the source code here (http://sourceforge.net/project/showfiles.php?group_id=174810).

Comments welcome!

Thanks to the LWJGL programmers for making this possible :)
Title: Tetrismus
Post by: Matzon on August 18, 2006, 05:34:11
works as advertised :)
- quick comments:
- some boxing around some of the text, perhaps some texture offset issue
- too slow to play, should be faster and not as ... time-step like as it is now
- colored pieces (important)

thats it - off to work
Title: Tetrismus
Post by: wolf_m on August 18, 2006, 14:42:23
You can adjust the starting speed and the key recognition speed in the options menu. Besides, there's a death mode, try it :)
About the texture offset issue: I'm aware of that, I'll fix it.
Colored pieces: I'm considering it. It should be pretty simple.
Title: hmmmmmmmm...
Post by: Fool Running on August 18, 2006, 15:28:00
I'm getting a crash trying to run with the .bat file (for windows):
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69097300, pid=2624, tid=3732
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing)
# Problematic frame:
# C  [atioglxx.dll+0x97300]
#

---------------  T H R E A D  ---------------

Current thread (0x00036cc0):  JavaThread "main" [_thread_in_native, id=3732]

siginfo: ExceptionCode=0xc0000005, reading address 0x05d840aa

Registers:
EAX=0x000000c0, EBX=0x00000002, ECX=0x05d840a9, EDX=0x00000008
ESP=0x0007f0c8, EBP=0x00000000, ESI=0x05d840a9, EDI=0xffffffff
EIP=0x69097300, EFLAGS=0x00210287

Top of Stack: (sp=0x0007f0c8)
0x0007f0c8:   0000012c 00000002 0007f4a4 05d2b908
0x0007f0d8:   00000020 05d82489 000005a4 000004b0
0x0007f0e8:   05d82489 00000026 00000001 ffffffff
0x0007f0f8:   00000029 0000002a 0000002c 0000002d
0x0007f108:   0000002e 0000002d 0000002d 0000002b
0x0007f118:   00000024 00000026 00000027 00000028
0x0007f128:   00000029 00000024 00000021 0000001e
0x0007f138:   00000020 00000021 00000021 00000021

Instructions: (pc=0x69097300)
0x690972f0:   8b ce ba 08 00 00 00 eb 07 8d a4 24 00 00 00 00
0x69097300:   0f b6 6c 19 ff 89 ac 04 30 02 00 00 0f b6 29 89


Stack: [0x00040000,0x00080000),  sp=0x0007f0c8,  free space=252k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [atioglxx.dll+0x97300]

[error occurred during error reporting, step 120, id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL11.nglTexImage2D(IIIIIIIILjava/nio/Buffer;IJ)V+0
j  org.lwjgl.opengl.GL11.glTexImage2D(IIIIIIIILjava/nio/ByteBuffer;)V+70
j  game.output.GraphicsProcessor.loadTexture(Ljava/lang/String;)I+182
j  game.output.GraphicsProcessor.loadTextures()V+138
j  game.Tetrismus.initVideo()V+46
j  game.Tetrismus.initMenu(Z)V+84
j  game.Tetrismus.run(Z)V+2
j  game.Tetrismus.main([Ljava/lang/String;)V+30
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------
...


I have Windows XP Pro - ATI Radeon X600

I looked at the source code. The only thing I found is the scratch buffer is not Flip()ed (I'm pretty sure it has to be in this case). Why no one else is seeing this, I don't know... So maybe that's not the problem  :D
Title: Tetrismus
Post by: wolf_m on August 18, 2006, 21:33:24
You're actually not the only one having this problem. Another ATI guy has precisely the same issue with this game. I'd love to fix this issue, unfortunately, I don't have a configuration in which the game crashes that way.

QuoteThe only thing I found is the scratch buffer is not Flip()ed (I'm pretty sure it has to be in this case).
Could you elaborate on that? I don't have a clue what you're trying to say. If it's some necessary OpenGL operation and I let it out because of my silliness, it could be the problem, I guess.

Another thing: Some people report issues with OpenAL.
1. The native library for linux seems to crash under Gentoo. It crashes when the ogg-files are buffered into pcm buffers for OpenAL. Any input?
2. OpenAL error: Invalid Value (40963) -- as far as I have understood, this error occurs when someone's sound card doesn't support the number of sources I adjusted. How should I deal with that? I don't have any idea that doesn't force me to reload the data into buffers -_-
Title: Tetrismus
Post by: wolf_m on August 19, 2006, 17:09:10
I have fixed the OpenAL error 40963 issues; I did it the way I described before.
And I fixed the background pic size to a power of 2, that seems to be necessary for some graphics card drivers' OpenGL implementations.
Numerous people complained about the font not being readable in the main menu, so I made a new font.

All of this is in release 0.54 and above, so everybody who has had problems running Tetrismus should consider downloading the newest release :)

Thanks for your input!
Title: Tetrismus
Post by: wolf_m on August 19, 2006, 18:34:38
Yay, triple post! Sorry for that.

I've fixed some bugs again.

Unfortunately, some ATI users report that the application is just black on their setup. Example: (http://img115.imageshack.us/img115/7412/post481156009163ii2.th.jpg) (http://img115.imageshack.us/my.php?image=post481156009163ii2.jpg)

It works fine on just about any other graphics card type. Some Dell users with integrated Intel chipset report the same problem though. Can anyone help me with that?
Title: Tetrismus
Post by: darkprophet on August 20, 2006, 01:32:34
your not cleaing depth, but instead, clearing stencil which you dont use.

in GraphicsProcessor.java#pointBg() replace GL11.GL_STENCIL_BUFFER_BIT with GL11.GL_DEPTH_BUFFER_BIT

DP
Title: Tetrismus
Post by: wolf_m on August 20, 2006, 07:26:19
Thanks darkprophet! I hope this is fixed once and for all now :)

Release 0.6 is on the sourceforge servers with coloured pieces and new backgrounds, check it out!

Release 0.61 fixes the annoyances with the keys, but you have to press enter in the menu to confirm choices now because space doesn't work anymore.
Title: Tetrismus
Post by: wolf_m on August 21, 2006, 04:54:02
Linux users with ALSA reported that Tetrismus crashes on their system with a log like this:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0x0000000a, pid=9024, tid=3085522624
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing)
# Problematic frame:
# C  0x0000000a
#

---------------  T H R E A D  ---------------

Current thread (0x0805c9b8):  JavaThread "main" [_thread_in_native, id=9024]

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x0000000a

Registers:
EAX=0x00008010, EBX=0xb1b884b4, ECX=0x00000000, EDX=0x0000000a
ESP=0xbfffcdb8, EBP=0xbfffcde4, ESI=0x00000001, EDI=0x00008010
EIP=0x0000000a, CR2=0x0000000a, EFLAGS=0x00010282

Top of Stack: (sp=0xbfffcdb8)
0xbfffcdb8:   b1b7e431 bfffcfec 00008010 00000001
0xbfffcdc8:   00000056 00000010 90e28010 91ec7a64
0xbfffcdd8:   00000000 0852b2e4 0852b2da bfffce14
0xbfffcde8:   b1b7e431 bfffcfec 00008010 8caf5b10
0xbfffcdf8:   bfffce6c 00000010 bfff8010 b7736b14
0xbfffce08:   00000000 0852b2fc 0852b2e6 bfffce44
0xbfffce18:   b1b7e431 bfffcfec 00008010 b7736b14
0xbfffce28:   bfffce88 00000010 bfff8010 b7737b60

Instructions: (pc=0x0000000a)
0xfffffffa:  

Stack: [0xbfe00000,0xc0000000),  sp=0xbfffcdb8,  free space=2035k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x0000000a
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b431]  acFreqDIV2+0x10d
C  [libopenal.so+0x3b7c3]  acConvert16LSB+0xc3
C  [libopenal.so+0x3c127]  acConvertSign+0xe3
C  [libopenal.so+0x3c73b]  acConvertAudio+0x5d
C  [libopenal.so+0xa919]
C  [libopenal.so+0x9ed3]  _alBufferCanonizeData+0x32
C  [libopenal.so+0x9924]  alBufferData+0x2f3
C  [liblwjgl.so+0x1b07f]
j  org.lwjgl.openal.AL10.nalBufferData(IILjava/nio/Buffer;III)V+0
j  org.lwjgl.openal.AL10.alBufferData(IILjava/nio/ByteBuffer;I)V+16
j  game.output.SoundProcessor.loadALData(Ljava/lang/String;)I+61
j  game.output.SoundProcessor.play(Ljava/lang/String;)V+59
j  game.input.MenuInputProcessor.mapInput()V+200
j  game.Tetrismus.menu(Z)V+47
j  game.Tetrismus.run(Z)V+15
j  game.Tetrismus.main([Ljava/lang/String;)V+39
v  ~StubRoutines::call_stub
V  [libjvm.so+0x174fec]
V  [libjvm.so+0x2821f8]
V  [libjvm.so+0x174e1f]
V  [libjvm.so+0x19f5c2]
V  [libjvm.so+0x1907d2]
C  [java+0x1803]
C  [libc.so.6+0x14e4b]  __libc_start_main+0xcb

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.openal.AL10.nalBufferData(IILjava/nio/Buffer;III)V+0
j  org.lwjgl.openal.AL10.alBufferData(IILjava/nio/ByteBuffer;I)V+16
j  game.output.SoundProcessor.loadALData(Ljava/lang/String;)I+61
j  game.output.SoundProcessor.play(Ljava/lang/String;)V+59
j  game.input.MenuInputProcessor.mapInput()V+200
j  game.Tetrismus.menu(Z)V+47
j  game.Tetrismus.run(Z)V+15
j  game.Tetrismus.main([Ljava/lang/String;)V+39
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

[...]

They had to load the modules snd-pcm-oss and snd-mixer-oss because OpenAL wanted /dev/dsp before.

I've set up ALSA on my system and the same error occurs. What's going on there? Doesn't OpenAL work with ALSA? How should I deal with that?

I've tried to compile the newest libopenal.so from OpenAL's subversion server, but the problem remained. I've also tried to replace libopenal.so with the one from Tribal Trouble, without an effect.

I'm using lwjgl 1.0beta2, upgrading to beta3 resulted in other strange errors :/
Title: hmmmmmmm....
Post by: Fool Running on August 21, 2006, 14:34:16
Well, whatever you did, the game is working now for me :D
All the graphics work fine (no back screen or anything).
Title: Tetrismus
Post by: darkprophet on August 21, 2006, 17:35:56
should I add to the "techSupport" counter? :P

Meh, techSupport++;

DP
Title: Tetrismus
Post by: wolf_m on August 21, 2006, 18:35:43
QuoteWell, whatever you did, the game is working now for me
Great! Happy to hear that!

QuotetechSupport++;
Oh man, I hate it when I'm screwed.. I don't have the slightest clue how to solve this ALSA+libopenal.so problem (if that's the cause, after all).
Title: Tetrismus
Post by: darkprophet on August 21, 2006, 19:53:07
try downloading Tribal Trouble and using their openal.dll/so, i think it uses OSS too...

DP
Title: Tetrismus
Post by: wolf_m on August 21, 2006, 19:55:19
I've already done that, same error.
Title: Tetrismus
Post by: wolf_m on August 24, 2006, 00:11:22
I've upgraded to LWJGL 1.0beta3 now. It works fine on WinXP, but on Linux, I get

Quote
Exception in thread "main" java.lang.UnsatisfiedLinkError: getJNIVersion
   at org.lwjgl.DefaultSysImplementation.getJNIVersion(Native Method)
   at org.lwjgl.Sys.<clinit>(Sys.java:103)
   at org.lwjgl.openal.AL.<clinit>(AL.java:59)
   at game.output.SoundProcessor.initAL(SoundProcessor.java:219)
   at game.Tetrismus.initSoundProcessor(Tetrismus.java:411)
   at game.Tetrismus.initMenu(Tetrismus.java:293)
   at game.Tetrismus.run(Tetrismus.java:471)
   at game.Tetrismus.main(Tetrismus.java:136)
The line says    if(!AL.isCreated())
I've checked the OS string and disabled sound for Linux, but then the same UnsatisfiedLinkError for Display.<clinit>() appeared when I do this:

     if(Display.isCreated())


I did a Google search for "getJNIVersion" and landed in the chatlog of #lwjgl, where Mazon says basically the same for WinXP on 08/01/2006, check it out:

http://new.lwjgl.org/irclog_browse.php?date=1154408150

So... Is this a bug in the beta release? Is it my fault? I've got the newest libs and all, am obviously doing the usual stuff...

I definitely need support :)

Edit: If it's a bug in the release, is it fixed on the svn trunk?
Title: Tetrismus
Post by: Matzon on August 24, 2006, 05:23:07
are you sure you dont have some old jar/dlls in jre/ext ?
Title: Tetrismus
Post by: wolf_m on August 25, 2006, 01:06:30
:oops: I had an old .so in my PATH. Deleting it did the trick for display operations. Thanks!

However, libopenal.so still segfaults on Linux as described here (http://lwjgl.org/forum/viewtopic.php?p=10852#10852). What's up with that?

Edit: And there's definitely only the newest libopenal.so on my system. 'Newest' meaning the one from trunk, but the same thing happens with the one from 1.0beta3 release (if they are different after all...).
Title: Tetrismus
Post by: wolf_m on August 26, 2006, 01:15:50
I still don't have any clue why OpenAL segfaulted, but I fixed the bug by calling AL#create() instead of AL#create(String, int, int, boolean).

Thus, I have a new release :) The game should now run fine on Linux.
Title: Tetrismus
Post by: wolf_m on September 10, 2006, 20:36:16
For release 0.7, I've implemented Ogg streaming with classes I found in this forum. I used tomb's implementation (http://home.halden.net/tombr/ogg/ogg.html). Thanks, tomb!