Thursday, January 10, 2008

Setting up Java Game Server 1.4

Couple of main points.

Project is ready to be opened in Netbeans 5.5.

Go to Trace.java class and take comments off of this one section.

public final class Trace {

public Trace() {
}

public static void out(String s) {
System.out.println(s);
}


In my production code I had the System.out.println(s); commented out.

Next, realize that once you fire the program off inside Netbeans (or from command line), you have to use Windows Task manager to stop it.

It's not like a regular java program where you can push stop. You'll find it floating around as a 6-8Meg java process in the task manager.

JAGS runs on port 81, so I you try to fire two of them off, or don't notice the other one still running, you'll get a startup message saying address already in use.

Here's a successful startup:


Here's what happens to me all the time when I try and run two of them (bad thing):
java.net.BindException: Address already in use: JVM_Bind



Once you've got your server running, and you've modified your Actionscript Client to point to your localhost, fire that Flex program off.

You should see messages talking about starting connections like this:

LISTENING on PORT 81
CONN # 0 :127.0.0.1
CONNECTION STARTED: 0
# Conns:1


And this...

--------------------
SECURITY POLICY SENT
--------------------
IN conn_0c: 1199952686796>no id0.17506256978958845>!server>Hello.
MESSAGE:
TIME: 1199952686843
FROM: no id0.17506256978958845
TO: !server
Action Verb: Hello.

COMMAND not found.Hello.
IN conn_0c: 1199952686859>no id0.17506256978958845>!server>!whats_my_name
MESSAGE:
TIME: 1199952686859
FROM: no id0.17506256978958845
TO: !server
Action Verb: !whats_my_name

OUT: !your_id:conn_0c

IN conn_0c: 1199952686859>no id0.17506256978958845>!server>!auto_match:2
MESSAGE:
TIME: 1199952686859
FROM: no id0.17506256978958845
TO: !server
Action Verb: !auto_match:2

:conn_0c looking for up to 2 total players.
OUT: !name_group:group_0g

OUT: !you_host:conn_0c

NEW GAME: group_0g


Now the arbitrary commands in the Actionscript Client project will start to make a little more sense.

Good luck! I've got to get some sleep...

1 comment:

Anonymous said...

Good Job! :)