SGS Tank

Not sure if anyone’s interested yet but I’ve made the tank hack I’ve been trying stuff out with available. Its here:

http://www.cokeandcode.com/sgs/tank-1.zip

as of tonight it looks like this:

http://www.cokeandcode.com/sgs/sgs-tank-1.png

http://www.cokeandcode.com/sgs/sgs-tank-2.png

I’ll make the source available (again if anyone can be bothered) - but it needs documenting first.

Kev

Very cool kev! Im lookign fwoard to trying it out!

JK

worked cool here kev- nice one!

Kev,

Any chance of webstarting the game and running it remotely? :slight_smile:

-Chris

Of course, I didn’t webstart it because I thought I wasn’t allowed to distribute SGSClient.jar right now.

I can host it on bob (the newdawn box) probably but again - not sure if I’m allowed to do this.

Kev

Um, so actually, is it allowed?

Kev

Go ahead and webstart it, but put a password infrotn of it pelase so its not open to the general public.

That seems reasonable to me and Ill take the heat if anyone complains.

Ok, I’m webstarting it up. However, problems:

If I run the client from inside Eclipse it works quite happily with the remote server.
If I run the client from webstart and make it connect to a local server, it works happily.
If I run the client from webstart and make it connect to a remove server, I get the following the exception on first connection:


java.nio.BufferUnderflowException
	at java.nio.Buffer.nextGetIndex(Unknown Source)
	at java.nio.HeapByteBuffer.get(Unknown Source)
	at com.sun.gi.comm.users.protocol.impl.BinaryPktProtocol.packetReceived(BinaryPktProtocol.java:656)
	at com.sun.gi.comm.users.client.impl.TCPIPUserManagerClient$2.packetReceived(TCPIPUserManagerClient.java:183)
	at com.sun.gi.utils.nio.NIOConnection.packetReceived(NIOConnection.java:155)
	at com.sun.gi.utils.nio.NIOConnection$PacketHandler.processRecvBuffer(NIOConnection.java:236)
	at com.sun.gi.utils.nio.NIOConnection$PacketHandler.handleRead(NIOConnection.java:258)
	at com.sun.gi.utils.nio.NIOSocketManager.handleRead(NIOSocketManager.java:324)
	at com.sun.gi.utils.nio.NIOSocketManager.processSocketEvents(NIOSocketManager.java:311)
	at com.sun.gi.utils.nio.NIOSocketManager.run(NIOSocketManager.java:272)
	at java.lang.Thread.run(Unknown Source)

Feel free to IM me if its going to be easier (or you’d like the passwords for the webstart :))

Kev

What kind of discovery are you using? real? or local file?

Its a file, but its actually a remote URL (idea suggested by Endolf). Its definitely getting to the server, I see this on the server each time I start the client:


Apr 5, 2006 1:59:08 AM com.sun.gi.logic.impl.SimulationImpl queueTask
WARNING: attempt to queue task for unknown uid UUID(1144198748566:97590039584873
0135)
Apr 5, 2006 1:59:08 AM com.sun.gi.logic.impl.SimulationImpl$1 userLeft
INFO: user UUID(1144198748566:975900395848730135) leaving but was not joined.

Kev

If you cna, id feel better if you switched to doing real discovery with the discovery manager just soI knew that your discovery doc was correct

Ok, worked out I’m recieving a disconnect() call back from SGSClient that I’m not when I’m outside of webstart. Why? Who knows - however, my code exits in certain cases when it recieves disconnect. With that removed everything works!

Just had two clients connecting to my remote server and its working like a charm. Blasting yourself via an server isn’t too much fun but its a pretty good proof of concept / learning experience.

Kev

Id love to get a chacne to trace that disconnect in a debugger and see whats makign it happen

I’ll happily make the source available, buts its a pretty poor example of code at the moment :slight_smile:

No comments, no structure and lots of commented out bits but here it is:

http://www.cokeandcode.com/sgs/tank-src.zip

Kev

I’m very interested into the DarkStart project and I just would ask a question about sgs-tank.
I got the last version of sgs (0.9.1-r2129) but I had to update all the packages in sgs-tank because all “paths” are com.sun.gi.comm.users instead of com.sun.sgs.client.
Did I do a mistake or was sgs-tank developped with a previous sgs lib ?

Thanks to all persons like kevglass providing such good materials to learn about the sgs logic.

albo

SGS Tank hasn’t been updated since the early access release 1. I believe the concepts still hold but the API has changed signifcantly since that release.

I’m currently working on a project that hopefully is going to use darkstar eventually so once I grok the new DS I’ll probably revisit SGSTank.

Kev

Thanks for your fast response !

I’m going to study your code without compiling it just to illustrate the concepts of sgs.

I’m also waiting for the new tutorials docs promised by sun. In the PDF tutorial docs of SGS, they speak of an “extent” doc.

Thanks again,

albo