setup own server

Well, right p2p would be an idea as long as you think of a ‘conventional’ 2 player game.

The ‘Game’ I’m thinking of is more a perpetual available sandbox like thing, that anybody who likes to ‘Play’ is able to connect to, rather then a ususal vassal implementation of a board or card game for 2 or like players.
Technically speaking there will be a ‘hosting’ Computer running the server and module unattended and perpetually logged in to the server. Anybody who wants to join the ‘Game’, to play around with the ‘Stuff’ available and afterwards like to leave and rejoin at any point of time can do so on its own volition.
That is just resembling a player that opened a Modul Session on the public VASSAL Server free to join for everybody but beeing AFK all the time…

I tried P2P but it just to complicated to use…
Connecting to a open server would be way easier.

What kind of ‘Game’ Im thinking of can’t be revealed here because of IP resasons as of now.
Guess this kind of ‘Game’ module will put VASSAL to its mere limits but actually it looks like it provides everything required except a easy to set up ‘Local Server’ option.

brgds
Stephan

Say I want (or rather need) to setup my custom server. I know next to nothing about programming, but I already managed to hack Vassal a bit for my gaming group’s purposes via trial and error.

I have source files in front of me and I read here those include server code. I located server URL in VASSAL.chat.DynamicClient. And I’m stuck.

What general steps should I take from this point?

Am I right that it’s necesary to compile a separate application and run it before others will be able to connect with the modified client? Would it be possible to run it on the same machine as my own instance of Vassal and still play?

Thus spake Filip:

Say I want (or rather need) to setup my custom server. I know next to
nothing about programming, but I already managed to hack Vassal a bit
for my gaming group’s purposes via trial and error.

I have source files in front of me and I read here those include server
code. I located server URL in VASSAL.chat.DynamicClient. And I’m stuck.

What general steps should I take from this point?

You need to replace that URL with the URL from which you’re pulling
the server configuration information. Look at what’s at that URL to
see what you need in the file.

Am I right that it’s necesary to compile a separate application and run
it before others will be able to connect with the modified client?

Not sure what you’re asking here.

Would
it be possible to run it on the same machine as my own instance of
Vassal and still play?

Yes, you could run a game server on the same machine.


J.

I’m not sure if I understand how Vassal server works. I always imagined there’s some separate application running on the server. Is it just that file?

Would it be enough to change the URL to information stored in a text file on the same machine, then everybody edits their configuration files, changing nodeHost to the IP of whoever works as server?

Thus spake Filip:

I’m not sure if I understand how Vassal server works. I always imagined
there’s some separate application running on the server. Is it just that
file?

That file is what the client uses to determine where to connect. The
entry point for the server itself is in VASSAL.chat.node.Server.

Would it be enough to change the URL to information stored in a text
file on the same machine, then everybody edits their configuration
files, changing nodeHost to the IP of whoever works as server?

No, becuase the URL which points to that text file is unfortunately
hard-coded in the client. You also have to change the URL in the client,
which will require recompiling.


J.

Ok, I tried to test it. Here’s what I did today, step by step:

  • Opened my port.
  • Created getServerImpl file, setting nodeHost to my IP.
  • Uploaded the file to a free hosting site to test things out. It was then possible to directly view the config file from a browser (just like the one at www.vassalengine.org/util/getServerImpl).
  • Changed urls in VASSAL.chat.DynamicClient and VASSAL.chat.node.Server as appropriate.
  • Recompiled.
  • Run Vassal and tried connecting to a server.

Vassal hangs when trying to connect, without giving any errors.

Should it work? What am I doing wrong?

Thus spake Filip:

Ok, I tried to test it. Here’s what I did today, step by step:

  • Opened my port.
  • Created getServerImpl file, setting nodeHost to my IP.
  • Uploaded the file to a free hosting site to test things out. It was
    then possible to directly view the config file from a browser (just like
    the one at www.vassalengine.org/util/getServerImpl[1]).
  • Changed urls in VASSAL.chat.DynamicClient and VASSAL.chat.node.Server
    as appropriate.
  • Recompiled.
  • Run Vassal and tried connecting to a server.

Vassal hangs when trying to connect, without giving any errors.

Should it work? What am I doing wrong?

You didn’t mention above that you started a server process on the
machine whose IP is in getServerImpl. Did you?


J.

Uh, I don’t think so. How do I “start a server process”?

Based on this thread so far, my understanding was that server code is part of Vassal itself and no additional applications need to run on my machine as long as other clients know where to connect. Guess I was wrong?

Thus spake Filip:

Uh, I don’t think so. How do I “start a server process”?

java -Djava.util.logging.config.file=logging.properties -cp Vengine.jar -Xmx512M VASSAL.chat.node.Server -port 5050 -URL vassalengine.org/util/ >& ./log/vassal-server &

You’ll need to change the URL to the one for the directory where you put
getServerImpl.

Based on this thread so far, my understanding was that server code is
part of Vassal itself and no additional applications need to run on my
machine as long as other clients know where to connect. Guess I was
wrong?

Yes, you have to run a game server in order to have something to connect
to.


J.

1 Like

Thanks. I’m making some progress. I managed to start a test server. A friend was able to connect and his connection was logged.

However, when trying to run Vassal and connect from the same machine, it still hangs. Module library window works fine, but module controls window grays out and freezes. The server doesn’t even log my connection attempt. I tried running the server process on my other computer and connect from my main machine - but it’s the same. Both use Ubuntu Linux and the same IP.

You said earlier that it should be possible to play from the same machine - what might be the problem here?

Thus spake Filip:

Thanks. I’m making some progress. I managed to start a test server. A
friend was able to connect and his connection was logged.

However, when trying to run Vassal and connect from the same machine, it
still hangs. Module library window works fine, but module controls
window grays out and freezes. The server doesn’t even log my connection
attempt. I tried running the server process on my other computer and
connect from my main machine - but it’s the same. Both use Ubuntu Linux
and have the same IP.

Is the server running on the machine with the IP address indicated in
getServerImpl?


J.

Yes.

My friend was able to connect from different IP. I’m trying to connect from the machine with the same IP address.

Thus spake Filip:

Yes.

My friend was able to connect from different IP. I’m trying to connect
from the machine with the same IP address.

I’ve never tried running the game server on the same machine as the one
from which I’m running the client. I can’t think of any reason inherent
to the game server code that would prevent it from working, but the game
server code is a buggy mess, so there might be some reason it fails of
which I’m unaware.

If you friend can connect, then obviously you’re not having a problem
with port 5050 accepting incoming connections, so at least you can
rule that out.


J.

It was caused by my router. I solved the problem by compiling another client that links to a getServerImpl file with nodeHost = 127.0.0.1. Tested the solution with a friend and we were both able to establish the connection with our respective variants of the client.

Perhaps there’s a more practical solution to find, but at least we are now independent from the main server and able to play when it’s down. Thanks for guiding me through the process :slight_smile:

I encountered a weird problem today.

It seems the main server was down this evening? Connecting to Vassal website was not possible.

Apparently this also made it impossible for us to play using my own server. Vassal kept freezing when trying to connect to my own server, both for myself and for other players.

It was the first time we encountered this problem. Since moving to our private server last month, we didn’t encounter any issues. In particular, if the main server was failing during that period, it didn’t affect us in any way. Unless it wasn’t failing throughout the last month, or not when we played (though with our gaming frequency usual server failures used to plague us like every second game).

Also, nothing changed on my side since our last successful game. We twice checked everything that we could check, and everything seemed fine on my side. Server config file in place, IP in place, router configuration in place and so on. I checked the log, and it confirmed that the server was started, but no connections. When a friend tried to ping the server, it logged “Ping, Server closed socket” and that’s all.

Now that the website is up again, I’m once again able to connect to my private server.

The only explanation that we were able to come up with is that our private server version of Vassal is still somehow dependent on the main server working. What might be causing this? My guess is that it might be connected to server stats code, but I wouldn’t bet on that specifically. We suspect that this dependency is only present either when starting the private server when the main one is down or connecting to private server when the main one is down (otherwise, we would probably encounter this issue in the middle of some earlier game).

Any ideas how to fix that so as to avoid similar problems in the future?

Thus spake Filip:

I encountered a weird problem today.

It seems the main server was down this evening? Connecting to Vassal
website was not possible.

It was. A momentary power outage knocked our server offline.

Apparently this also made it impossible for me to start my own server.
Vassal kept freezing when trying to connect to my own server, both for
myself and for other players.

It was the first time we encountered this problem. Since moving to our
private server last month, we didn’t encounter any issues. In
particular, if the main server was failing during that period, it didn’t
affect us in any way. Unless it wasn’t failing throughout the last
month, or not when we played (though with our gaming frequency usual
server failures used to plague us like every second game).

I don’t recall any other instances of our server being offline in the
past month, though it’s possible that it happened at some time when I
was otherwise occupied.

Also, nothing changed on my side since our last successful game. We
twice checked everything that we could check, and everything seemed fine
on my side. Server config file in place, IP in place, router
configuration in place and so on. I checked the log, and it confirmed
that the server was started, but no connections. When a friend tried to
ping the server, it logged “Ping, Server closed socket” and that’s all.

Now that the website is up again, I’m once again able to connect to my
private server.

The only explanation that we were able to come up with is that our
private server version of Vassal is still somehow dependent on the main
server working. What might be causing this? My guess is that it might be
connected to server stats code, but I wouldn’t bet on that specifically.
We suspect that this dependency is only present either when starting the
private server when the main one is down or connecting to private server
when the main one is down (otherwise, we would probably encounter this
issue in the middle of some earlier game).

Any ideas how to fix that so as to avoid similar problems in the future?

Grep over the code (which you’ve modified?). Do you find any instances
of vassalengine.org there?


J.

Quite a lot of those, in fact.

src/VASSAL/i18n/VASSAL_it.properties:ModuleManager.quickstart=<html><center><h2>Per iniziare a giocare</h2>Scarica un modulo ed aprilo con il menu File.<br>Si possono trovare molti moduli sul sito <a href\="http\://www.vassalengine.org">http\://www.vassalengine.org</a>.</center></html> src/VASSAL/i18n/VASSAL_it.properties:BugDialog.connection_failed_instructions=<html>VASSAL non e' stato in grado di inviare la vostra segnalazione di errore. Per cortesia inserite il file <a href\="file\://%1$s">%1$s</a> ed una descrizione di cosa stavate facendo al momento dell'errore nella sezione di <a href\="http\://www.vassalengine.org/forums/viewforum.php?f\=3">Supporto Tecnico &amp; Bugs</a> del Forum di VASSAL .</html> src/VASSAL/i18n/VASSAL_es.properties:BugDialog.connection_failed_instructions=<html>VASSAL fue incapaz de enviar su reporte de errores. Por favor publique el archivo <a href\="file\://%1$s">%1$s</a> y una descripcion de qu\u00E9 estaba haciendo cuando el error ocurri\u00F3, en la secci\u00F3n <a href\="http\://www.vassalengine.org/forums/viewforum.php?f\=3">Technical Support &amp; Bugs</a> del foro de VASSAL.</html> src/VASSAL/i18n/VASSAL_es.properties:ModuleManager.quickstart=<html><center><h2>Para empezar a jugar</h2>Descargue un m\u00F3dulo y abralo usando el men\u00FA Archivo.<br>Se pueden encontrar muchos m\u00F3dulos en <a href\="http\://www.vassalengine.org">http\://www.vassalengine.org</a>.</center></html> src/VASSAL/i18n/VASSAL_nl.properties:ModuleManager.quickstart=<html><center><h2>Om te spelen</h2>Download een module vanuit het bestand menu.<br>Vele modules kunnen gevonden worden op <a href\="http\://www.vassalengine.org">http\://www.vassalengine.org</a>.</center></html> src/VASSAL/i18n/VASSAL.properties:BugDialog.connection_failed_instructions=<html>VASSAL was unable to submit your bug report. Please post the file <a href="file://%1$s">%1$s</a> and a description of what you were doing when the bug occurred in the <a href="http://www.vassalengine.org/forums/viewforum.php?f=3">Technical Support &amp; Bugs</a> section of the VASSAL Forum.</html> src/VASSAL/i18n/VASSAL.properties:ModuleManager.quickstart=<html><center><h2>To start playing</h2>Download a module and open it using the File menu.<br>Many modules can be found at <a href="http://www.vassalengine.org">http://www.vassalengine.org</a>.</center></html> src/VASSAL/i18n/VASSAL_fr.properties:ModuleManager.quickstart=<html><center><h2>Pour jouer</h2>T\u00E9l\u00E9chargez un module et ouvrez le \u00E0 partir du menu Fichier.<br>Les modules peuvent \u00EAtre t\u00E9l\u00E9charg\u00E9s dans la section Modules du site Vassal \: <a href\="http\://www.vassalengine.org">http\://www.vassalengine.org</a>.</center></html> src/VASSAL/i18n/VASSAL_fr.properties:BugDialog.connection_failed_instructions=<html>VASSAL n'a pas pu soumettre votre rapport d'erreur. Merci de joindre le fichier <a href\="file\://%1$s">%1$s</a> et la description de la s\u00E9quence de vos manipulations qui a conduit \u00E0 l'apparition de ce probl\u00E8me dans <a href\="http\://www.vassalengine.org/forums/viewforum.php?f\=3">Technical Support &amp; Bugs</a> section d\u00E9di\u00E9e du Forum VASSAL.</html> src/VASSAL/i18n/VASSAL_ja.properties:BugDialog.connection_failed_instructions=<html>VASSAL \u306F\u3042\u306A\u305F\u306E\u30D0\u30B0\u30EC\u30DD\u30FC\u30C8\u3092\u63D0\u51FA\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30D5\u30A1\u30A4\u30EB <a href\="file\://%1$s">%1$s</a> \u3068\u30D0\u30B0\u304C\u8D77\u304D\u305F\u3068\u304D\u3042\u306A\u305F\u304C\u4F55\u3092\u3057\u3066\u3044\u305F\u306E\u304B\u306E\u8AAC\u660E\u3092 VASSAL \u30D5\u30A9\u30FC\u30E9\u30E0\u306E <a href\="http\://www.vassalengine.org/forums/viewforum.php?f\=3">Technical Support &amp; Bugs</a> \u30BB\u30AF\u30B7\u30E7\u30F3\u306B\u6295\u7A3F\u3057\u3066\u4E0B\u3055\u3044\u3002</html> src/VASSAL/i18n/VASSAL_ja.properties:ModuleManager.quickstart=<html><center><h2>\u30D7\u30EC\u30FC\u3092\u59CB\u3081\u308B\u306B\u306F</h2>\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u30E1\u30CB\u30E5\u30FC\u304B\u3089\u958B\u3044\u3066\u4E0B\u3055\u3044\u3002<br>\u305F\u304F\u3055\u3093\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u304C <a href\="http\://www.vassalengine.org">http\://www.vassalengine.org</a> \u306B\u3042\u308A\u307E\u3059\u3002</center></html>

These appear harmless. Are they?

src/VASSAL/build/module/WizardSupport.java:      help = new ShowHelpAction(new URL("http://www.vassalengine.org/wiki/doku.php?id=getting_started:getting_started"), null);

Looks harmless as well.

src/VASSAL/chat/DynamicClient.java: * Determines server implementation at run-time by downloading properties from the vassalengine.org site. Refreshes

Clearly harmless.

src/VASSAL/tools/BugUtils.java:      final String url = "http://www.vassalengine.org/util/bug.php";

Not sure about this one. Doesn’t seem like it should be causing the problem.

src/VASSAL/chat/HttpMessageServer.java: "http://www.vassalengine.org/util/getMessages", //$NON-NLS-1$ src/VASSAL/chat/HttpMessageServer.java: "http://www.vassalengine.org/util/postMessage", //$NON-NLS-1$ src/VASSAL/chat/HttpMessageServer.java: "http://www.vassalengine.org/util/motd", //$NON-NLS-1$ src/VASSAL/chat/peer2peer/DirectPeerPool.java: HttpRequestWrapper r = new HttpRequestWrapper("http://www.vassalengine.org/util/getMyAddress"); //$NON-NLS-1$

Not sure what exactly this class does, but it looks like it might be causing some issues. Is it possible to safely disable this completely? Otherwise, how to handle those getMessages, postMessage, motd and getMyAddress files for my own server? Does Vassal only read them, or is something actually send there? If the latter, I have a problem, as I’m currently using dropbox for my server configuration files, so it won’t accept incoming traffic.

src/VASSAL/chat/peer2peer/P2PClient.java: }, "http://www.vassalengine.org/util/")); src/VASSAL/chat/peer2peer/TextClient.java: pool = new CgiPeerPool(info, "http://www.vassalengine.org/util/"); src/VASSAL/chat/CgiServerStatus.java: request = new HttpRequestWrapper("http://www.vassalengine.org/util/"); //$NON-NLS-1$ src/VASSAL/tools/version/VersionUtils.java: private static final String baseURL = "http://www.vassalengine.org/util/";

These have the same address in common. There was the same address in VASSAL.chat.node.Server.java, and I’ve already changed it to the location of getServerImpl. Should that be enough to fix these?

src/VASSAL/chat/node/NodeClientFactory.java:    final String host = param.getProperty(NODE_HOST,"game.vassalengine.org");  //$NON-NLS-1$

Uh. This isn’t URL. Is this interfacing directly with the main server in some way? What should I do with this?

Ok, I’ve been experimenting today.

Am I right that classes in VASSAL.chat.peer2peer are only for direct peer to peer games and have nothing to do with main server games? It appears to me that the only purpose of vassalengine.org/util/getMyAddress in VASSAL.chat.peer2peer.DirectPeerPool.java is reading player’s IP for such games. Is that how it knows what to display in the p2p connection window? Is there more to it?

Instances of vassalengine.org in other VASSAL.chat.peer2peer classes are in inactive parts of the code. My current guess is that leaving vassalengine.org/util/getMyAddress alone should be safe.

My actual suspects are:

src/VASSAL/chat/HttpMessageServer.java: “http://www.vassalengine.org/util/getMessages”, //$NON-NLS-1$
src/VASSAL/chat/HttpMessageServer.java: “http://www.vassalengine.org/util/postMessage”, //$NON-NLS-1$
src/VASSAL/chat/HttpMessageServer.java: “http://www.vassalengine.org/util/motd”, //$NON-NLS-1$

src/VASSAL/tools/version/VersionUtils.java: private static final String baseURL = “http://www.vassalengine.org/util/”;

src/VASSAL/chat/CgiServerStatus.java: request = new HttpRequestWrapper(“http://www.vassalengine.org/util/”); //$NON-NLS-1$

I tried creating empty files with those names to the server config folder, and changed all URLs as appropriate. This build shows no games in server stats. I’m not sure if that fixed the problem, but at least it didn’t break anything - I’m still able to connect to my server. I need to test it with other players, but I guess we’ll just have to wait for the next main server failure to know for sure. Unless you can immediately point out something that I ignored.

Tested with other people and works. For now, as I have no way to check if this solution actually fixed the problem.

Thus spake Filip:

Ok, I’ve been experimenting today.

Am I right that classes in VASSAL.chat.peer2peer are only for direct
peer to peer games and have nothing to do with main server games? It
appears to me that the only purpose of
vassalengine.org/util/getMyAddress[1] in
VASSAL.chat.peer2peer.DirectPeerPool.java is reading player’s IP for
such games. Is that how it knows what to display in the p2p connection
window? Is there more to it?

I can’t say. I’ve never looked at that code before.

Instances of vassalengine.org in other VASSAL.chat.peer2peer classes are
in inactive parts of the code. My current guess is that leaving
vassalengine.org/util/getMyAddress[2] alone should be safe.

My actual suspects are:

src/VASSAL/chat/HttpMessageServer.java:
http://www.vassalengine.org/util/getMessages”, //$NON-NLS-1$
src/VASSAL/chat/HttpMessageServer.java:
http://www.vassalengine.org/util/postMessage”, //$NON-NLS-1$
src/VASSAL/chat/HttpMessageServer.java:
http://www.vassalengine.org/util/motd”, //$NON-NLS-1$

src/VASSAL/chat/CgiServerStatus.java: request = new
HttpRequestWrapper(“http://www.vassalengine.org/util/”); //$NON-NLS-1$

I tried creating empty files with those names to the server config
folder, and changed all URLs as appropriate. This build shows no games
in server stats. I’m not sure if that fixed the problem, but at least it
didn’t break anything - I’m still able to connect to my server. I need
to test it with other players, but I guess we’ll just have to wait for
the next main server failure to know for sure. Unless you can point out
something that I ignored.

It’s likely these that are the problem. I’m glad you got it to work.


J.