Page 1 of 3

Headless Server - how to run a Lux room from the command line

Posted: Sun May 28, 2006 11:35 pm
by dustin
Lux includes a headless server option. This means you can run a host from the command line, and it will operate in the background without creating any windows or graphics. NOTE: You will need some degree of computing skills to get this running.

Instructions:
- Install all desired maps or generators that aren't default maps (i.e: Classic, Biohazard). You can use the PluginManager or copy the files into the proper Support folder location. If you want to host typical biodeux, then you need to install the Biohazard map generator plugin.

- You need to make sure your computer firewall and router are set to allow hosting. If you've never hosted a Lux room on your computer before, try it, you'll probably need to follow some of the router and firewall setup.

Mac OS X instructions:
- Open up the Terminal application (inside /Applications/Utilities/)
- Change to the directory Lux is, typically the command will be: cd /Applications
- Run your customized Lux headless command. Here's an example for you to modify:

Code: Select all

java -Djava.awt.headless=true -cp "./Lux Delux.app/Contents/Java/LuxCore.jar:./Lux Delux.app/Contents/Java/MRJAdapter.jar" com.sillysoft.lux.Lux -headless -network=true -public=true -map=RomanEmpireII -cards=4e3 -conts=5 -time=30 -name=Your_name -desc=Your_description
Windows instructions:
- Open a terminal/shell window.
- Navigate to the Lux Delux install folder.
- Run your customized Lux headless command. Here's an example for you to modify:

Code: Select all

jre8_40_private\bin\java -Djava.awt.headless=true -cp * com.sillysoft.lux.Lux -headless -network=true -public=true -map=RomanEmpireII -cards=4e3 -conts=5 -time=30 -name=Your_name -desc=Your_description
Linux ssh session instructions:
- ssh into your linux server
- download the linux package:

Code: Select all

wget http://sillysoft.net/download/LuxDelux-linux.tgz
- unpack the download package:

Code: Select all

tar xzf LuxDelux-linux.tgz
- Navigate to the Lux Delux install folder:

Code: Select all

cd LuxDelux
(Optional) - install additional maps or AIs by copying them from your home computer into the corresponding Support folder inside the remote LuxDelux/Support/ folder.

- Run your customized Lux headless command. Here's an example for you to modify:

Code: Select all

linux-private-jre8_40/bin/java -Djava.awt.headless=true -cp "LuxCore.jar:lib/*" com.sillysoft.lux.Lux -headless -map=RomanEmpireII -network=true -public=true -cards=5e15 -conts=30 -time=30 -name=Your_name -desc=Your_description -shuffle3 -nofirstturncontbonus -regcode=LD-YOUR-REGCODE
If you want to be able to exit from your ssh session and still have the host run, add these bits to the front and end of your customized command:

Code: Select all

nohup YOUR_CUSTOMIZED_VERSION_OF_ABOVE_COMMAND  &> logfile.txt &
Those commands should be all on one big line. Most of the switches should be self-explanatory. If you want a private game then switch -public=true to be -public=false. If you play around with the switches it should tell you if you do anything wrong and let you know how to do it right.

You can join your own headless server (and you'll be promoted to the host). If you're having trouble joining it from the same computer, try entering '0' into the 'private game address' box in the Join Game window and clicking Join. (You'll need to clear the private address field to join any other listed games fyi)

The headless server will not play games with all bots, to save CPU.

The following command line options are supported:
-name=hostname
-map=ClassicPartDeux (remove all spaces from map names)
-desc=Hello_everyone (replace all spaces with underscores)
-time=30
-conts=15
-cards=51015
-unranked
-placed
-scenario
-bio1 to -bio6
-shuffle2 (randomize and winner stays)
-shuffle3 (highest ranked players)
-shuffle4 (cycle out game losers)
-public=true
-port=6619
-agent=<bot> (can also use the values "networkplayeronly" or "networkplayeronlyfull")
-regCode=CODE (if you're getting notices about pirates or non-registered account)
-gamelimit=45
-nofirstturncontbonus
-novariablestart (turns off extra starting armies for last players)

If you want unicode output in the shell window, add -Dfile.encoding=UTF8 to the command you run.

If you want to host multiple rooms on the same computer, you need to specify a different -port setting for each of them (use 6620, 6621, etc).

You can turn off bot-only games by typing /set abortbotgames as the host in the chat. Do it when you only have 1 instance of Lux running. This works for both normal and headless servers.

Posted: Mon May 29, 2006 1:54 am
by Kef
inetresting, way cool man!

Posted: Tue May 30, 2006 11:25 am
by Vidar
Will this new feature enable me to start a headless host at home, and then join it at work (using the same reg code)? Cause, that would kick ass.

Posted: Tue May 30, 2006 4:08 pm
by dustin
Yes Vidar, it will.

known bugs in this beta:
- it will prevent you from joining using your name if you specified that name as the hosts's name (so choose a different host name, not your usual nick, for now)
- the shuffle option doesn't preserve the owner as host

Posted: Sat Aug 25, 2007 12:38 pm
by killercatfish
pretty awesome, ill mess with this in a couple days.
especially all day hosting on a laptop, may get the cpu to run a little cooler :D

Posted: Sat Aug 25, 2007 3:08 pm
by dustin
You should be able to turn off bot-only games by typing /set abortbotgames as the host in the chat. Do it when you only have 1 instance of Lux running. This should work for both normal and headless servers.

I removed a bunch of useless posts from this thread. If you don't know what a headless server is, then this thread is not for you. You can use google to find out what any and all of this stuff means if you're so inclined.

Posted: Sat Aug 25, 2007 4:46 pm
by killercatfish
will simply closing the terminal end the game?

Posted: Sat Aug 25, 2007 5:05 pm
by dustin
Closing the terminal should end the game, however your host would still show up in the tracker for a few minutes. Type /quit into the terminal to cleanly shutdown the server from the tracker.

Anything you type into the terminal is treated like the chat-box. You can use commands like /start, /boot, etc.

Posted: Sat Aug 25, 2007 5:07 pm
by killercatfish
Pretty awesome man, im loving this. Should I be able to log into the GUI via my same computer, or when I am using the headless, can i not play in my room GUI style without restarting the room?

but for anyone interested, here is the room up.

Image

Posted: Sat Aug 25, 2007 5:25 pm
by killercatfish
I know im probably getting annoying, but i dont have the same host controls when i come into my headless room as myself-- when im guested out as myself in my room and try to restart i get the typical [Only the host can use that command]..is this suppose to happen?

Also, does the /set abortbotgames mean the bots wont play even when humans are in there? and if so is there a way for them to play once there are humans?

Thanks!! (quite excited )
:roll:

Posted: Sat Aug 25, 2007 5:45 pm
by killercatfish
do you have a link to more advanced commands?

Posted: Sat Aug 25, 2007 5:58 pm
by Kef
It should take the settings of the last game you set up with the GUI (the Lux app) if you mean the stuff that ain't indicated by the flags.

Dustin, it will still overwrite my name when I start Lux.app, that's a bit of a pain :(


ps kcf: Image

Posted: Sat Aug 25, 2007 6:15 pm
by killercatfish
no it wont, just change the name in the main menu, it will have put your "headless hosting name" in there, just change it--

Posted: Sat Aug 25, 2007 6:27 pm
by Kef
killercatfish wrote:no it wont, just change the name in the main menu, it will have put your "headless hosting name" in there, just change it--
that's what I meant

Posted: Sat Aug 25, 2007 6:57 pm
by killercatfish
Ive been hosting with the room name killercatfish Beta, for a while now. It tried to make my name killercatfish Beta when i opened the GUI, warned me i was gonna muff up my raw, i deleted beta, and ive played in the room with killercatfish and no raw reset.

Posted: Sun Aug 26, 2007 6:18 am
by dustin
killercatfish wrote:when im guested out as myself in my room and try to restart i get the typical [Only the host can use that command]..is this suppose to happen?

Also, does the /set abortbotgames mean the bots wont play even when humans are in there? and if so is there a way for them to play once there are humans?
1. Try guesting in and maybe you'll have control. This is probably a bug.

2. No, abortbotgames will just make it so no game gets played when there are only bots.

Posted: Mon Aug 27, 2007 10:48 pm
by killercatfish
I am in a motel room, i opened their router and am hosting, 6619 is open. Same setting as I always have at home.
I can get into any room, only when i open lux i am refused from my room. This is new any idea?

Posted: Mon Aug 27, 2007 11:57 pm
by dustin
Are you trying to join with the same name as the server? What error message do you get?

Posted: Tue Aug 28, 2007 9:53 am
by killercatfish
just as if i were ban:
[Checking for aliases...]
[Connecting to LuxServer at 216.228.180.197 port 6619...]
[Connection refused]

I am trying to play as Killercatfish as usual.
Very strange, room works fine obviously, and also when i start it with the GUI instead, i am able to play just fine.

Just strange, it probobly would work again when i have my own router up, just in this room for a few days and wondering if you had any ideas.

Thanks.

Re: Headless Server - how to run a Lux room from the command line

Posted: Wed Mar 28, 2018 5:58 pm
by mikeyg
I'm baaa-aaack.

I'm seeing a crash-check. Does this mean my old scripts to monitor the status of the server are no longer needed?

Re: Headless Server - how to run a Lux room from the command line

Posted: Wed Mar 28, 2018 6:11 pm
by mikeyg
huh:

LuxWorld: run()
0 = Angry named Red - IP: n/a
1 = Boscoe named Lux Luthor - IP: n/a
2 = Communist named MikeyG - IP: n/a
3 = EvilPixie named Zoodiac - IP: n/a
4 = Killbot named k-OS - IP: n/a
5 = Quo named blob - IP: n/a
✱ Registering with the LuxTracker... ✱
✱ Registered successfully with LuxTracker from address 68.248.152.253 ✱
Crash check: timeRunningMinutes=0, playerNameString=
Crash check: timeRunningMinutes=0, playerNameString=
takeTurns. boardNameStatic()=Roman Empire II
Host server is running a game with only bots. Abort the game. gamePhase=3
Crash check: timeRunningMinutes=0, playerNameString=
Crash check: timeRunningMinutes=1, playerNameString=
<NetCon - Server-side of mikeyg> netConnection.run caught an exception
java.lang.ArrayIndexOutOfBoundsException: 1
at com.sillysoft.lux.D.B.P(Unknown Source)
at com.sillysoft.lux.D.B.run(Unknown Source)

That's me joining, or attempting to.

Re: Headless Server - how to run a Lux room from the command line

Posted: Thu Mar 29, 2018 3:29 pm
by dustin
mikeyg wrote:
Wed Mar 28, 2018 5:58 pm
I'm baaa-aaack.

I'm seeing a crash-check. Does this mean my old scripts to monitor the status of the server are no longer needed?
probably not needed anymore, yea (depending on what exactly it was doing).

Is your second post a log from running headless server?? That's what this thread is about

Re: Headless Server - how to run a Lux room from the command line

Posted: Thu Mar 29, 2018 5:16 pm
by mikeyg
yep

Re: Headless Server - how to run a Lux room from the command line

Posted: Wed Mar 25, 2020 3:39 pm
by erich
Howdy folks,

I'm attempting to run a lux room on a linux host.

I'm using the following command:

Code: Select all

java -Djava.awt.headless=true -cp "LuxCore.jar:lib/*" com.sillysoft.lux.Lux -headless \
-map=ClassicWidescreen \
-network=true \
-public=false \
-cards=51015 \
-conts=30 \
-time=30 \
-name=eric2 \
-desc=risky_covid_19 -shuffle3 -nofirstturncontbonus \
-port=6619 \
-novariablestart \
-regcode=LD-<REDACTED> \
-unranked
Attempting to connect from a client, I get the following results on the client side

Code: Select all

✱ Connecting to LuxServer at <REDACTED> port 6619... ✱
✱ Connection to remote host lost ✱
and the following log on the server side

Code: Select all

<NetCon - Server-side of eric2> netConnection.run caught an exception
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at com.sillysoft.lux.D.B.P(Unknown Source)
	at com.sillysoft.lux.D.B.run(Unknown Source)


also possibly of note is the output of this command, the zero denominator seeming suspicious to me

Code: Select all

/u
  Connected users - 0/0 players:
    eric2 (host - guest only)


Am I missing something obvious here?

Much thanks for any help!

Re: Headless Server - how to run a Lux room from the command line

Posted: Wed Mar 25, 2020 5:16 pm
by killercatfish
This is what I currently use on mac terminal.... not sure if it will help. If you figure this out, let me know. Would love to plug a dedicated raspberry pi into my router!

cd ..
cd ..
cd applications
java -Djava.awt.headless=true -cp "./Lux Delux.app/Contents/Java/LuxCore.jar:./Lux Delux.app/Contents/Java/MRJAdapter.jar" com.sillysoft.lux.Lux -headless -network=true -public=true -map=BioDeux-extreme -cards=5e25 -conts=25 -time=23 -name=Killercatfish -desc=Hello_World_Email_Host:_killercatfish@gmail.com___Have_Fun -nofirstturncontbonus -abortbotgames -novariablestart

Re: Headless Server - how to run a Lux room from the command line

Posted: Thu Mar 26, 2020 8:57 am
by PJB
erich wrote:
Wed Mar 25, 2020 3:39 pm
Howdy folks,

I'm attempting to run a lux room on a linux host.

I'm using the following command:

Code: Select all

java -Djava.awt.headless=true -cp "LuxCore.jar:lib/*" com.sillysoft.lux.Lux -headless \
-map=ClassicWidescreen \
-network=true \
-public=false \
-cards=51015 \
-conts=30 \
-time=30 \
-name=eric2 \
-desc=risky_covid_19 -shuffle3 -nofirstturncontbonus \
-port=6619 \
-novariablestart \
-regcode=LD-<REDACTED> \
-unranked
I believe the linux command code should look more like this:

linux-private-jre8_40/bin/java -Djava.awt.headless=true -cp "LuxCore.jar:lib/*" com.sillysoft.lux.Lux -headless -map=RomanEmpireII -network=true -public=true -cards=5e15 -conts=30 -time=30 -name=Your_name -desc=Your_description -shuffle3 -nofirstturncontbonus -

Re: Headless Server - how to run a Lux room from the command line

Posted: Thu Mar 26, 2020 9:58 am
by mikeyg
Here is what I used to use on linux - haven't tried it in a while. It fires it up in a detached session of screen so you can re-attach as needed:

Code: Select all

#!/bin/bash
screen -dmS luxserver51015 /usr/bin/java -Djava.awt.headless=true -cp "./LuxCore.jar:./MRJAdapter.jar" com.sillysoft.lux.Lux -headless -abortbotgames=true -network=true -port=6619 -public=true -cards=51015 -conts=15 -map=RomanEmpireII -time=35 -name=mikeyg -immediate=true -transfer=true -desc="Play Nice. Please rate the host: http://sillysoft.net/lux/rankings/hosts/rate.php?host=mikeyg"

Re: Headless Server - how to run a Lux room from the command line

Posted: Thu Mar 26, 2020 3:00 pm
by dustin
hey erich, can you post the whole log file that comes out into server console when you start up the headless server there? Might have better clues in there.

Have you played a public game using the eric2 name and that reg code? It's possible that is required to register the name and reg together

Re: Headless Server - how to run a Lux room from the command line

Posted: Sat Apr 04, 2020 3:07 pm
by mikeyg
Hey Dustin!!!

I've noticed, running a server with the latest version of LuxCore in headless mode, and attempting to connect to it with the latest version as a client, fails. ArrayOutOfBounds error. Is there a way I can gather more debug info for you?

Connecting to the latest version in headless mode from version 6.51 as the client works just fine.

Re: Headless Server - how to run a Lux room from the command line

Posted: Sun Apr 05, 2020 1:00 am
by dustin
Hey Mikey, I'm able to join your host with latest Lux no problem. Are you running it headless at the moment?

I've seen the ArrayOutOfBounds error in the past and thought I fixed it already in latest release. Tho I could have missed something still