Squareheads

I finally got it to work. The game of ultimate death to textured rectangles! Whoohoo!

Keep it up.

Geforce2 and I get “hardware mouse cursor not supported” and it does several annoying things as a result.

  1. you have to alt-tab to get your mouse cursor back in x-windows. Grr.
  2. once you’ve got your mouse cursor back, the game comlpetely ignores the mouse.
  3. If you drage the window around, the game kills the mouse cursor again, but now at least it will recognize the existence of the mouse (as per swp’s comment, you have to navigate via highlighting).

Sorry about that. In the next version I will provide a software cursor if the hardware cursor is not support. It will still remove the native cursor, but you will have a visible cursor so that you can press the exit button.

I’ve updated the demo. I’ve replaced my wonderful home made box level with a quake 3 one. So check it out.

Some known issues:[]No collision detection against curved surfaces
[
]No collision detection against the transparent floor
[]When walking into the teleporter you will instead sometimes walk on top of the teleport.
[
]Filtering on some lightmaps is sometimes turned off
[]AI can’t navigate in q3 level so they are useless.
[
]Sometimes dies without reason

It’s now possible to fly by holden down space. This way it’s more difficult to get stuck.

Enjoy!

didn’t work for me:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x7A05021
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
      at org.lwjgl.opengl.CoreGL11.glDrawArrays(Native Method)
      at trb.q3.VertexArray.draw(VertexArray.java:284)
      at trb.q3.BasicRenderer.drawFace(BasicRenderer.java:666)
      at trb.q3.BasicRenderer.renderLists(BasicRenderer.java:544)
      at trb.q3.BasicRenderer.render(BasicRenderer.java:460)
      at sh.Q3Level.render(Q3Level.java:209)
      at sh.SquareHeads.render(SquareHeads.java:355)
      at sh.SquareHeads.runGame(SquareHeads.java:285)
      at sh.Menu.runMenu(Menu.java:267)
      at sh.SquareHeads.runMenu(SquareHeads.java:182)
      at sh.SquareHeads.main(SquareHeads.java:979)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

WinXP, GF4 Ti4200, 512Mb.
It also makes everything brighter and leaves it that way.

Another issue (which is not really your fault), but I recently moved away from IE and I now just use Opera. Webstart doesn’t seem to start automatically when it’s not a jnlp file but a php file like yours.

Erik

another log:


Java Web Start 1.4.2_03 Console, started Wed Feb 18 23:08:45 CET 2004
Java 2 Runtime Environment: Version 1.4.2_03 by Sun Microsystems Inc.
Logging to file: c:\webstart.log
Maximum native cursor size: 32, min size: 32
cursor size = 32,32
background: 307200 640,480
mousepressed 136.0 20.0 org.lwjgl.gui.Rectangle[x=50.0,y=95.0,width=210.0,height26.0]
Server.run()
growing vertex array 49152
mousepressed 154.0 17.0 org.lwjgl.gui.Rectangle[x=50.0,y=115.0,width=440.0,height26.0]
Using default shader models/weapons2/rocketl/rocketl.TGA
Using default shader models/weapons2/rocketl/rocketl2.tga
Using default shader models/weapons2/plasma/plasma.tga
Using default shader models/weapons2/grenadel/grenadel.tga
Using default shader models/weapons2/grenadel/grenadel.tga
Using default shader models/weapons2/lightning/lightning2.tga
Using default shader models/weapons2/shotgun/shotgun.tga
Using default shader models/weapons2/shotgun/shotgun.tga
growing vertex array 49152
FOG param
FOG 0.55 0.11 0.1 128.0
Texture 23 uses fog
Unknown Wave type: lightingSpecular
Shader with depthFunc: textures/base_wall/protobanner
FOG param
FOG 0.729 0.729 0.78 464.0
Texture 48 uses fog
Shader with depthFunc: textures/base_floor/pjgrate2
brush 175 is fog brush
brush 432 is fog brush
brush 468 is fog brush
brush 1020 is fog brush
growing vertex array 49152
growing vertex array 98304
Number of verices outputed to buffer: 35847
getStream(/data/flare2.tga)
getStream(/data/player.3ds)
0 cameras
3ds scene material 0 loaded with file /data/grass.jpg
3ds scene material 1 loaded with file /data/envmeri.tga
Server got MSG_CONNECT from -1 freeIdx=0 name=John Doe
Client.recieve() accept clientIdx=0 ping=0.006147569034611777 serverTime=9.109760039334608
New maximum packet size 44
Server.checkTimeouts() client 0 timed out: 10.00117417157767
Server removing client 0

Doesn’t work. This happens when i’m trying to start a server:


Java Web Start 1.4.2 Konsole, gestartet Wed Feb 18 23:32:02 CET 2004

Java 2 Runtime Environment: Version 1.4.2 von Sun Microsystems Inc.
Maximum native cursor size: 32, min size: 32
cursor size = 32,32
background: 307200 640,480
mousepressed 156.0 10.0 org.lwjgl.gui.Rectangle[x=50.0,y=95.0,width=210.0,height26.0]
Server.run()

java.lang.NullPointerException
      at java.io.ByteArrayInputStream.<init>(Unknown Source)
      at sh.Q3Level.load(Q3Level.java:88)
      at sh.ServerLogic.<init>(ServerLogic.java:114)
      at sh.Server.run(Server.java:118)
      at java.lang.Thread.run(Unknown Source)

Server.run() finally
java.net.SocketException: socket closed
      at java.net.PlainDatagramSocketImpl.peekData(Native Method)
      at java.net.DatagramSocket.receive(Unknown Source)
      at sh.UdpListener.run(UdpListener.java:101)
      at java.lang.Thread.run(Unknown Source)


After trying to connect to server:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x0
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
      at org.lwjgl.opengl.GL.nglBindBufferARB(Native Method)
      at org.lwjgl.opengl.GL.glBindBufferARB(Unknown Source)
      at trb.q3.VertexArray.disable(VertexArray.java:275)
      at trb.q3.BasicRenderer.render(BasicRenderer.java:463)
      at sh.Q3Level.render(Q3Level.java:209)
      at sh.SquareHeads.render(SquareHeads.java:355)
      at sh.SquareHeads.runGame(SquareHeads.java:285)
      at sh.Menu.runMenu(Menu.java:267)
      at sh.SquareHeads.runMenu(SquareHeads.java:182)
      at sh.SquareHeads.main(SquareHeads.java:979)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

cool, works fine here (xp, radeon 9700, jdk 1.5)
very nice speed, especially compared to the xith demo - though I don’t know if they are comparable ?

[quote]It also makes everything brighter and leaves it that way.
[/quote]
Yes, I modify the gamma settings to make things brighter. The problem is that it is not reset when the vm crashes. Maybe I’ll provide another way of making things brighter. Atleast until it becomes more stable.

[quote]Webstart doesn’t seem to start automatically when it’s not a jnlp file but a php file like yours.
[/quote]
My ISP has not set the jnlp mime type. So it’s either a php, or no webstart :frowning:

EgonOlsen: The game can not open/load a file in one of the jars. It might be a webstart issue, or I’m trying to load it in a way that is not working on your system. You could try deleting it from the webstart cache. Have you had any problems with webstart before. Ary you running window or linux? What browser?

The other two exceptions reported by zparticle and erikd are vertex array and/or vbo related. I’ll have to read up on this. And defenitly add more error checking :slight_smile:

[quote]very nice speed, especially compared to the xith demo - though I don’t know if they are comparable ?
[/quote]
Well, using a scene graph to render a quake level is not the most efficent way of doing it :slight_smile: So using xith will never come close to a purpose built engine. It’s more interesting to compare it to the original q3. Because of vbos it’s possible to make a quake viewer that is faster the the original. The special effects (fog, waving flags, animated textures etc) is slowing me down alot dough As I haven’t had the time/skill to optimize it.

[quote]EgonOlsen: The game can not open/load a file in one of the jars. It might be a webstart issue, or I’m trying to load it in a way that is not working on your system. You could try deleting it from the webstart cache.
[/quote]
Yes, that worked! It runs @ around 500-700 fps now (framecounter is hard to read at that rate). That’s on a P4HT@3.2Ghz, Radeon9700pro, WinXP. Collision detection seems to produce wrong results sometimes. I fall off the level twice.

Another update. Here is a screenshot:

http://home.halden.net/tombr/squareheads/images/squareheads_screen4.jpg

[]Added collision detection against bezier patches. It’s now possible to walk over the bridge without falling threw :slight_smile:
[
]Vertex colors is used on objects that do not have lightmap.
[*]Fixed a bug with regards to the fog.
Have not looked at the vertex array issues. And it is still possible to fall threw the map.

Time for another update and to bump this thread back to the first page. Some of the things added this time:

  1. Created a global matchmaker server. It’s now theoreticaly possible to find someone to play with.

  2. Remade the gui. It has got all the component types I’ll need. It’s also very easy to change and is perfect for prototyping. Still have to create a new look and feel for the final game.

  3. Lots of sounds.

  4. Doors

  5. Ingame chat

…and of course lots of other minor changes.

[quote]Time for another update and to bump this thread back to the first page. Some of the things added this time:
[/quote]
Could you come up with a short description (approx 100 words) for me to put on the java games pages?

Very nice game. Reminds me a lot of Quake 3. Is there anyway to run in fullscreen? I’d also suggest adding an invert mouse option.

New version is up.

I’ve added invert mouse option, fullscreen and md3 characters.

Spent most of my time rewriting the renderer. It’s now 2-3 times as fast :slight_smile:

I’m curious how you’re doing visibility determination; bsp tree or something else?

I’m using the Quake 3 bsp level format. It’s a leafy bsp with a possible visible set. For each leaf there is a list of wich other leafs that are visible.

I really like this projects. This proves that java is really ready for gaming.

I wanted to test your last version via webstart, but I got following error:

An error occurred while launching/running the application.

Title: Squareheads Test
Vendor: Tom-Robert Bryntesen
Category: Launch File Error

Could not find main-class sh.SquareHeads in http://home.halden.net/tombr/squareheads/sh_code.zip

[quote]Could not find main-class sh.SquareHeads in http://home.halden.net/tombr/squareheads/sh_code.zip
[/quote]
I did some refactoring and renamed SqaureHeads to Squareheads. But the jnlp file gets cached somewhere and webstart don’t see that the main-class has changed. I’ve changed it back again, and I hope it will work now.

If anyone has problem starting the game: Delete it from the webstart cache and try again. That usually does the trick :wink: