Re: Dedicated Multiplayer Server Guide
Posted: Tue Dec 09, 2014 6:29 pm
On, i have now a char but get Stuck in the other one !
I try now to delete him again
I try now to delete him again
Code: Select all
eysho@dev:~/private/factorio_alpha_x64_0.11.5$ wc -l /var/www/vhosts/factorio/private/factorio_alpha_x64_0.11.5/factorio-current.log | grep -o "[0-9]\+"
7
64
0
11
5
eysho@dev:~/private/factorio_alpha_x64_0.11.5$ ./pauser
./pauser: line 11: 7
64
0
11
5: syntax error in expression (error token is "64
0
11
5")
eysho@dev:~/private/factorio_alpha_x64_0.11.5$
in the script ?wc -l /var/www/vhosts/factorio/private/factorio_alpha_x64_0.11.5/factorio-current.log | grep -o "[0-9]\+" | head -1
I don't know what do you mean.The user connect and then the console reload he show User () and user x and y , and reload.
Code: Select all
apt-get install bc
Code: Select all
directly from the game?
unfortunately there is no such functionif(games.players.length == 1) { game.pause(); } else { game.unpause() }
Got everything working well except for the pauser script. It's not tracking joins, shows 0, then when I quit it counts a quit, and puts the total to -1.Alkalyne wrote:I just made a change in the startfactorio script :
That's allows to restart factorio easily using the last autosave.Code: Select all
name=$(find /path/to/factorio/saves -type f -printf '%T@ %f\n' | sort -n | tail -1 | cut -f2- -d" ")
NOTE : The pauser script don't work, since the key Shift+space does not pause the game in multiplayer since 11.2 ( )
But with the autosave I just need to stop the game to start it later
EDIT :
I have updated the pauser script, now it will pause the game :Code: Select all
#!/bin/bash PATHTOLOG="/var/www/factorio/factorio-current.log" OLDPLAYERCOUNT=0 PLAYERCOUNT=0 NUMBEROFLINESOLD=0 while :; do #get the current nuber of log entries NUMBEROFLINES=$(wc -l /var/www/factorio/factorio-current.log | grep -o "[0-9]\+") ABSOLUTELINES=$((NUMBEROFLINES-NUMBEROFLINESOLD)) #only look at new lines TAILEDLOG=$(tail -$ABSOLUTELINES $PATHTOLOG) #grab Joins PlayerJoinGame JOINSGAME=$(echo $TAILEDLOG | grep "MultiplayerManager changing state from(InGameSendingMap) to(InGame)" | wc -l | grep -o "[0-9]\+") #grab peer leaving QUITS=$(echo $TAILEDLOG | grep "PlayerLeaveGame" | wc -l | grep -o "[0-9]\+") #grab peer timeout DROPOUTS=$(echo $TAILEDLOG | grep "is not responding, dropping" | wc -l | grep -o "[0-9]\+") BOOT=$(echo $TAILEDLOG | grep "MultiplayerManager changing state from(CreatingGame) to(InGame)" | wc -l | grep -o "[0-9]\+") QUITS=$((QUITS+DROPOUTS)) echo "QUITS: "$QUITS JOINS=$((JOINSGAME)) echo "JOINS: "$JOINS echo "JOINSGAME:"$JOINSGAME PLAYERCOUNT=$((PLAYERCOUNT+JOINS)) PLAYERCOUNT=$((PLAYERCOUNT-QUITS)) if [ $BOOT -eq 1 ] then echo "BOOT : Pause on Boot" WID=$(xdotool search Factorio 2>/dev/null) xdotool windowactivate --sync $WID unset x y w h #need to press Escape once because of the Audio popup xdotool key Escape sleep 1 xdotool key Escape sleep 1 eval $(xwininfo -id $(xdotool getactivewindow) | sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" ) width=`echo "0.5 * $w" | bc` height=`echo "0.45 * $h" | bc` xdotool mousemove --window $WID $width $height xdotool click 1 sleep 1 xdotool key Escape echo "Paused" fi if [ $PLAYERCOUNT -eq 1 -a $OLDPLAYERCOUNT -eq 0 ] then echo "detected players, unpausing" WID=$(xdotool search Factorio 2>/dev/null) xdotool windowactivate --sync $WID unset x y w h xdotool key Escape sleep 1 eval $(xwininfo -id $(xdotool getactivewindow) | sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" ) width=`echo "0.5 * $w" | bc` height=`echo "0.45 * $h" | bc` xdotool mousemove --window $WID $width $height xdotool click 1 sleep 1 xdotool key Escape fi if [ $PLAYERCOUNT -eq 0 -a $OLDPLAYERCOUNT -eq 1 ] then echo "0 players, pausing" WID=$(xdotool search Factorio 2>/dev/null) xdotool windowactivate --sync $WID unset x y w h xdotool key Escape sleep 1 eval $(xwininfo -id $(xdotool getactivewindow) | sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" ) width=`echo "0.5 * $w" | bc` height=`echo "0.45 * $h" | bc` xdotool mousemove --window $WID $width $height xdotool click 1 sleep 1 xdotool key Escape fi #REMOVE the following line if you don't want to see current players. echo $PLAYERCOUNT OLDPLAYERCOUNT=$PLAYERCOUNT NUMBEROFLINESOLD=$NUMBEROFLINES #change to number of seconds between player count update [default: 1 sec] sleep 1 done
Oh nice, that's a good way to check it's pausing. Going to give this entire set-up another try and see if I can get it working. The pauser script is really the key to all of this though, without it, the biters just get worse and worse while the server stays up. Coming back to a map with 2-3 full days worth of biter spawn can be a headache.Piranha wrote:nimh, put metal plates in a box with an inserter outputting onto a 500 tile long belt then back into a box.. start the system, let it run 1/4 of the way down the belt, leave the game, wait a few minutes, join back.. If the plates reached the end and were put into the end box then the game didn't pause, if you come back in and the plates are only 1/4 of the way down the belt then you know the game paused..
At least I think that would work... haha
Code: Select all
apt-get install xserver-xorg-video-dummy
Code: Select all
Section "Monitor"
Identifier "Monitor0"
EndSection
Section "Device"
Identifier "Card0"
Option "NoDDC" "true"
Option "IgnoreEDID" "true"
Driver "dummy"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
EndSection
Code: Select all
DISPLAY=:10 xset s off
Code: Select all
#!/bin/bash
# New tmux session for x server
tmux new -d -s x
tmux send -t x sudo SPACE Xorg SPACE -noreset SPACE +extension SPACE GLX SPACE +extension SPACE RANDR SPACE +extension SPACE RENDER SPACE -logfile SPACE ./factorio/10.log SPACE -config SPACE ./factorio/xorg.conf SPACE :10 ENTER
# Attach to session for entering sudo password.
# Session can be left with CTRL+b +d
tmux attach -t x
Code: Select all
#!/bin/bash
# Start openbox Window Manager in new tmux session
tmux new -d -s openbox
tmux send -t openbox export SPACE DISPLAY=:10 ENTER
tmux send -t openbox exec SPACE openbox-session ENTER
# Disable Screensaver
xset s off
# Start factorio in new tmux session
tmux new -d -s factorio
tmux send -t factorio export SPACE DISPLAY=:10 ENTER
tmux send -t factorio factorio/bin/x64/factorio SPACE --mp-load-game SPACE world.zip ENTER
# Wait for the game starting up and opening the window
sleep 3
export DISPLAY=:10
# Get the Window ID
WID=$(xdotool search --name "Factorio 0.11.22")
# Resize the Window to 1x1 Pixel
xdotool windowsize $WID 1 1
Code: Select all
/var/games/Factorio/bin/x64/factorio: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by /var/games/Factorio/bin/x
64/factorio)
/var/games/Factorio/bin/x64/factorio: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by /var/games/Factorio/bin/x
64/factorio)
/var/games/Factorio/bin/x64/factorio: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.15' not found (required by /var/games/Factorio/bin/x
64/factorio)