Console version for server?

I'd like two run a dedicated server (or two). However, my server of choice is a headless unix box without a windowing environment installed.

Is it possible to start the server java app from the command line (feeding it the necessary params), or do I have to install X-windows, and that whole rigamorale?

TIA,
f

Re: Console version for server?

Oh yes. Smiley asked for this, so I added it. If you start the .jar file with the command to execute the class org.invade.InvadeEarthServer, you can give it arguments, and it will tell you what they do... should be Host/IP, Port, then server list data. There are a couple of commands you can type while it is running.

Re: Console version for server?

Aiiiee. My java naivete is showing :) Okay, so I must admit that I don't know how to execute a class AND a jar at the same time. Also, when I try to launch just the jar, I get:

invadeearth# java -jar InvadeEarth.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/retrogui/dualrpc/client/NotConnectedException

I've snagged all the files that were listed in the server webstart file from sourceforge, and stashed them in the same directory as the InvadeEarth.jar file (which I think is what the classpath defaults to unless otherwise defined).

What, in my ignorance, am I doing wrong?

f

Re: Console version for server?

shoot, it's been a while since I worked on this. I'll have to try some things. For one thing, I know you'll have to include the class name "org.invade.InvadeEarthServer" in the command line, because with -jar t might execute the InvadeEarth client, or nothing.
The exception it's throwing it because, as you guessed, it can't find the DualRPC library jar.

The basic syntax is
java -classpath (class path entries) org.invade.InvadeEarthServer [Invade earth arguments]

The class path entries should be ; separated. It may need to include every jar file (InvadeEarth.jar and each of the libraries)?!

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html

Let me know if you can figure it out. If not, I'll experiment with it until I get it to run again :)

Re: Console version for server?

Booya, I got it to work, I think, thanks! You were right about having to include all the *.jar files in the classpath. The syntax under unix is pretty ugly:

java -cp InvadeEarth.jar:InvadeEarthResources.jar:commons-codec-1.3.jar:dualrpc-client-2.0.2.jar:dualrpc-common-2.0.2.jar:dualrpc-server-2.0.2.jar:jdom.jar:jogg-0.0.7.jar:jorbis-0.0.15.jar:jogg-0.0.7.jar:log4j-1.2.8.jar:swing-layout-1.0.jar:tritonus_share.jar:vorbisspi1.0.2.jar org.invade.InvadeEarthServer "ip addr" "port" "rules" "map" "max # players" "server desc"

As soon as I can gussie that up and get it into an rc file I can get a couple of dedicated servers up and running.

f

Re: Console version for server?

excellent... glad it's working.

I think if Netbeans had done a better job jar-ing things up the classpath wouldn't be such a problem. That was an old version of the IDE. At least it's working though.

Re: Console version for server?

Okay, I went overboard and made a entire nanny program that starts and relaunches the game servers as needed. Servers are up now, after a bit of testing I'll post a link to the code.

Few questions:

Can only 3 servers be registered to a single IP? I get an error on the console when I try to register more than that.

Is there a way to enforce the "rules" type, so that someone can't start a 2210AD game on a Pantheon server or vice versa?
Also, is there any way to prevent some joe schmoe from blowing into a network game in progress and resetting it via a "new game" command? (whooooah, baby, that would toast my tomales).

f

Re: Console version for server?

Also the server(s) appears to disappear off the server list fairly quickly unless I occasionally have them run the "post" command. Is this expected behavior? Also, I sporadically receive error codes when using the post command:

[08-07-22@22:48:11] server pantheon: Error posting to server list (error=-4)

Is that unusual?

f

Re: Console version for server?

- I'm not aware of a limit of servers/IP (as long as they are different ports), though I've never hosted more than 1 or 2.
- Can't enforce the rules :S those fields were just added as a quick way to "advertise" what type of game you wanted to play.
- It is possible to block "new game" commands, but unfortunately I think it has to be done from the server, because the server and client are completely separate programs. (I was working with an older version of the DualRPC library, and I was also rather inexperienced with network programming...) I think no one can reset a game by accident, because it will load the current game as soon as they connect, but there have been instances of people deliberately sabotaging games... that's why we added the "block new game" option, but like I said, I think it's server-side. However, saving and loading over a network seemed to be fixed as far as I can remember, so it is possible to save backups of the game in progress in case of such a situation.
- No idea what the error code means, other than "the post failed". It shouldn't crash the server or anything, but it means the server list won't contain the posting.
- I think there may be a failsafe in the serverlist that erases "old" posts. Maybe the windowed version is sending posts periodically?

I wish the server worked better for what you're trying to do, but I originally cobbled it together for people who know each other. The networking stuff is a (mostly) happy experiment from several years ago.