Quantcast

How to make your own Automated Game Host server

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to make your own Automated Game Host server

Veqryn
Administrator
This post was updated on .
How to make your own Automated Game Host server for our lobby, so that other people can play Axis & Allies online.

Once this is made, anyone can connect to it as long as you leave it on.  
After joining the game room, any player may change the map to whichever they want, using the "Network" button.  
They can also have it load any "Autosave", and even send the server a savegame to specifically load.
They can also download whatever save the server is currently using.  This is useful if someone disconnects, because the server will automatically load the autosave, thereby letting all other users download it.

Basically, if we can get a bunch of these (like 10-15) running at all times in the lobby, we will have permanently solved the problem of people "not being able to host".  
Clients connecting to this server and changing the map and playing on it, do not need to know how to port forward or how to host, because they are not the ones hosting, the automated server is the host.


Step 1:  Download the latest TripleA
Use one of these links:
link: https://sourceforge.net/projects/tripleamaps/files/TripleA/
alternative link: https://sourceforge.net/projects/triplea/files/


Step 2:  Prepare to run the server by changing the name of server and the port you want to use for it
For linux, edit this file: run-headless-game-host.sh
For windows, edit this file: run-headless-game-host-windows.bat
For mac, edit this file: run-headless-game-host-mac-os.sh
Inside of these files, you will see this line:
java -server -Xmx96m -Djava.awt.headless=true -classpath bin/triplea.jar games.strategy.engine.framework.headlessGameServer.HeadlessGameServer triplea.game.host.console=true triplea.game.host.ui=false triplea.game= triplea.server=true triplea.port=3304 triplea.lobby.host=173.255.229.134 triplea.lobby.port=3303 triplea.name=Bot1_YourServerName triplea.lobby.game.hostedBy=Bot1_YourServerName triplea.lobby.game.supportEmail=yourEmailName(AT)emailProvider.com triplea.lobby.game.comments="automated_host"

Change triplea.port=3304 to be whatever port you plan to use, like 3300, or 3301, etc. (You MUST be able to host normally for this whole thing to work, so make sure to forward your ports)
Change triplea.name=Bot1_YourServerName and triplea.lobby.game.hostedBy=Bot1_YourServerName to be the name of your host (please include the word "bot" in the name somewhere)
Change triplea.lobby.game.supportEmail=yourEmailName(AT)emailProvider.com to use your email address, so that lobby admins can contact you when your host has crashed or frozen or otherwise stopped working.


Step 3:  Run the server
Double click the file.
Or if you are a termina/console/command-line environment, type out the name of the file to run, or even type out the "java" command above.



Troubleshooting:

If you get the message that "java is not a recognized command", that is because your computer does not know what the command "java" is.  

You must add the command "java" to your "command PATH", in environmental variables:
http://www.java.com/en/download/help/path.xml
or https://www.google.com/search?q=add+java+to+path

The "path" you want to add is the path to the java\bin folder in your computer (this is the path on my computer, it will be different on yours [you need quotes because there is a space]): "C:\Program Files\Java\jre6\bin\java.exe"

make sure you add it to the end of the PATH list, normally with something like a ; separating it from the other entries.


If you get the message: "Error: no 'server' JVM at 'C:\Program Files\Java\jre.........'"
This is because you are not using a java made for servers.  This is OK and very easy to fix.
Just delete the "-server" tag in the file.


Some pictures:
Server terminal view:



View from client side:



thanks,
Veqryn
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

siparo
Where is the file 'run-headless-game-host.sh' located?

I've scanned through the folders within the TripleA app and can't locate it.

Thanks,
Siparo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
It comes with the all platforms version (and also the windows version).  I will include one with the mac version in the future, but right now it doesn't.

I have updated the triplea.jar and the .sh anyway, so you need to re-download the all platforms version anyway.
Specifically, you have to download the one from this link, because it is the only one I updated:
http://sourceforge.net/projects/tripleamaps/files/TripleA/stable/1_7_0_3_automated_game_server/
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
In reply to this post by Veqryn
I've updated the triplea.jar file, please redownload it and then replace your existing triplea.jar file with it.
The new version creates log files (you must have file write permission in the triplea folder btw), and also should be more stable.
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
In reply to this post by Veqryn
I think i am getting closer to fixing the bugs.

I've added yet more logging (it is really verbose now...), and I've also added a few try/catch blocks in certain places.

At least when these weird errors (that I can't explain) happen, It should not freeze anymore. The game will close, but not freeze. Or at least it shouldn't freeze. Anyway, I'm still looking into the root cause but I am really at my wits end on this thing.

I've updated the "triplea.jar" file again today,
Please close your server, download and replace your jar, and then restart.
(download it from the link i provided above: http://sourceforge.net/projects/tripleamaps/files/TripleA/stable/1_7_0_3_automated_game_server/triplea.jar )

thanks,
veqryn
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
In reply to this post by Veqryn
I think I've fixed the bug.

Unfortunately half of it is server side while the other half is client side.

But at least now, if the bug occurs, the server should still be able to keep going, it will just reset to the waiting screen with the autosave loaded.

Anyway, please update your jar file again.
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
In reply to this post by Veqryn
updated for 1.8.0.1 triplea
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

ZjelcoP
Hi,

I've been trying to get a bot up, got one desktop running day and night anyway.
I just followed the how to and troubleshooting, I'm not very computersavvy or into java.
If bots are best left to those who know exactly what they're doing I'm also fine with that.

Some questions:
1:How to get multiple bots up? Just make multiple files and run them all?
2:What happens to a running game when a bot goes offline? (comp/router restart)

Seem to get stuck here:

Headless AWT Test: true
triplea.game.host.console:true
triplea.game.host.ui:false
triplea.game:
triplea.server:true
triplea.port:3300
triplea.lobby.host:173.255.229.134
triplea.lobby.port:3303
triplea.name:Bot1_TARS
triplea.lobby.game.hostedBy:Bot1_TARS
triplea.lobby.game.supportEmail:xxxxxx@hotmail.com
triplea.lobby.game.comments:automated_host
Invalid argument: triplea.lobby.game.reconnection must be an integer equal to or
 greater than 43200 seconds.

Usage and Valid Arguments:
   triplea.game=<FILE_NAME>
   triplea.game.host.console=<true/false>
   triplea.game.host.ui=<true/false>
   triplea.server=true
   triplea.port=<PORT>
   triplea.name=<PLAYER_NAME>
   triplea.lobby.host=<LOBBY_HOST>
   triplea.lobby.port=<LOBBY_PORT>
   triplea.lobby.game.comments=<LOBBY_GAME_COMMENTS>
   triplea.lobby.game.hostedBy=<LOBBY_GAME_HOSTED_BY>
   triplea.lobby.game.supportEmail=<youremail@emailprovider.com>
   triplea.lobby.game.supportPassword=<password for remote actions, such as remo
te stop game>
   triplea.lobby.game.reconnection=<seconds between refreshing lobby connection
[min 21600]>
   triplea.server.startGameSyncWaitTime=<seconds to wait for all clients to star
t the game>
   triplea.server.observerJoinWaitTime=<seconds to wait for an observer joining
the game>

   You must start the Name and HostedBy with "Bot".
   Game Comments must have this string in it: "automated_host".
   You must include a support email for your host, so that you can be alerted by
 lobby admins when your host has an error. (For example they may email you when
your host is down and needs to be restarted.)
   Support password is a remote access password that will allow lobby admins to
remotely take the following actions: ban player, stop game, shutdown server. (Pl
ease email this password to one of the lobby moderators, or private message an a
dmin on the TripleaWarClub.org website forum.)

Press any key to continue . . .
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Frankie9
You'll need to specify a different port for each bot.  Take a look at the two screen shots to see how I organize the Wopr bots.  I have a folder for each bot.  To conserve storage space you'll want to move all the maps from the maps subfolder located in the bot directory into the maps folder located in the user profile folder "PROFILENAME/triplea/maps" (this folder will be created the first time you run the game I believe.)  This way you can just update the one maps folder in the user profile folder via SVN if you want to make maintenance easier, if you run more than one bot, and leave the maps folder in each bot folder empty.

I think it's great that you're trying to get a bot or bots added, maybe start with one and get a feel for it, then add more.

The bots autosave each turn.  Otherwise, the players will save the game when someone needs to stop playing.  They reload their own save when they continue at a later time.

For the naming, I believe you'll want to start with Bot16_TARS.  Veqryn is running 1 through 3, I'm running 4 through 15.  Best to start with 16, bots are referred to simply by their number in the lobby, so this will avoid confusion.






Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Veqryn
Administrator
In reply to this post by ZjelcoP
"Invalid argument: triplea.lobby.game.reconnection must be an integer equal to or greater than 43200 seconds. "

this is a bug, and i've just fixed it

please redownload the "bots" version of the game engine zip
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

ZjelcoP
thx for your help so far guys.

Frankie, this is the error I got running as administrator.

Error: Could not find or load main class games.strategy.engine.framework.headles
sGameServer.HeadlessGameServer
Press any key to continue . . .

Here's the altered file:
run-headless-game-host-windows.bat
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

Frankie9
The batch file is missing the "-server" switch.  Should be java -server -Xmx256m ETC ETC

Don't need to run as administrator, in the lobby the other day I asked you to run as administrator to see if the error changed, I seem to recall a different error message when we chatted yesterday, but no matter, I was tired.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make your own Automated Game Host server

ZjelcoP
as Veqryn wrote in troobleshooting up in this thread:

If you get the message: "Error: no 'server' JVM at 'C:\Program Files\Java\jre.........'"
This is because you are not using a java made for servers.  This is OK and very easy to fix.
Just delete the "-server" tag in the file.

So i did. Seems to work fine this way.

I fixed the logging error by expanding writing permissions to TripleA map.

no more errors, bot goes up, just noone can join it...: connection refused.
will have look at firewall.

I'll let this rest for now, don't want to give the lobby a bad name just as it is this busy.
Plenty bots up i think.
Loading...