As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
Multiplayer after GameSpy - Lobby and NatNeg

Here are two examples how the startup with Xvfb is starting. The handling of the parameter is a bit confusing because some arguments can not be nested into quotes.
Moreover the strange »\"« after the mod name is needed.

Code:
# Start without Xvfb:
wine /home/user/Civ4/Civ4/Beyond\ the\ Sword/Civ4BeyondSword_PitBoss2014.exe mod= "PB Mod_v9"\" /ALTROOT="Z:\\home\\user\\Civ4\\PBs\\PB1"

# Same with xvfb:
xvfb-run -a -e /run/shm/xvfb.1.err --auth-file=/tmp/PB1 -s "-fbdir /run/shm/PB1 -screen 0 640x480x24" wine '/home/user/Civ4/Civ4/Beyond the Sword/Civ4BeyondSword_PitBoss2014.exe' mod= "PB Mod_v9"\" /ALTROOT="Z:\\home\\user\\Civ4\\PBs\\PB1"

# This variant with 'unbuffer' is used on our server.
xvfb-run -a -e /run/shm/xvfb.1.err --auth-file=/tmp/PB1 -s "-fbdir /run/shm/PB1
-screen 0 640x480x24" unbuffer wine '/home/user/Civ4/Civ4/Beyond the Sword/Civ4BeyondSword_PitBoss2014.exe' mod= "PB Mod_v9"\" /ALTROOT="Z:\\home\\user\\Civ4\\PBs\\PB1"  | grep -v "^FTranslator::AddText\|fixme:\|err:"
Reply

Yeah I can run it that way no problem. I was trying to spawn it as a service (power goes out often enough where I live) where the Xvfb is pre-created by a service that starts an x11vnc process like this:

Code:
[Unit]
Description=VNC spawner for Civ Servers
Requires=network.target
After=network.target

[Service]
User=civuser
ExecStart=x11vnc -create -env FD_PROG=/usr/bin/fluxbox -env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 -env X11VNC_CREATE_GEOM=$[1:-1024X768X16} -nevershared -forever -bg -nopw

I will try again with some of your commands but I will be attaching them to the displays spawned by this service with env variable i.e. DISPLAY=:20
Hopefully it works this time around with no problems, I was previously getting errors from Xauth

What do you do if you want to manage the server, however? I am curious to see how you do it. Or do you just not need to do that from the pitboss screen being output to the framebuffer
Reply

(April 28th, 2021, 20:30)HappyPart Wrote: I was previously getting errors from Xauth

The 'startPitboss.py' script normally should call 'xauth merge {COOKIE}' with a cookie file provided by the xvfb-run call. (Maybe this fails for you. If I remember correctly this works only in the second run of 'startPitboss.py', I do not know the reason.)

Quote:What do you do if you want to manage the server, however? I am curious to see how you do it. Or do you just not need to do that from the pitboss screen being output to the framebuffer

I do not use the Pitboss server window for managing. We just need to provide some output because the PB server sometimes throws error popups (You can not disable all popups by CivilizationIV.ini-settings.)

One reason for writing this modification was the desire to avoid the window completely. In its original version the PB Admin windows consumed a lot of CPU load (permanent redrawing).
We lowered the redrawing frequency ( time.sleep(0.01) -> time.sleep(0.1))
but on our server we use the radical solution and removed the window drawing completely (see "gui"-flag in pbSettings.json).
I only use ssh+screen to start the games on our server. Maybe you can also use screen/tmux to start games after a power loss?!

The managing can be done with three tools/scripts:
1. Use 'startPitboss.py / startPitbossEnv.py' for the start of the games. This wrapper scripts allows an easier way to start the server with the correct settings.
If the game crashed I would restart it with following steps:
a) python3 startPitboss.py 1 list # lists last saves of 'PB1'
b) python3 startPitboss.py 1 {filename} # loads given save

2. You can use PBSpy for managing task of running games.
In contrast to civstats this tool allows you to control your server! You will see the option only if you're logged in on the page and visit the page of your game. There is an 'manage' link which show you the options.
Set the autostart-flag in pbSettings.json on 1 and the game will skip the 'wizard' pages and directly loaded the last save.

Moreover you can add other accounts as game admins. So, if your absent this person can also reload previous saves, etc.

One disadvantage of this approach/our implementation is that you can only control the game if the server has loaded the game. It doesn't work if the game fails to load a game. In practice, however, the problem is not as big as it seems.


3. An other tool I've wrote is https://github.com/civ4-mp/pyconsole (very advanced usage!)
This gives you a python like commandline interface and full control to a running game.
It contains predefined command for the most common admin tasks like PBSpy do.
And if you are a skilled Civ4 modder you can also run arbitrary Python code. This is useful to fix problems like wrong game options or wrong resources, etc.

You need to enable this in pbSettings.json (shell section) if you want use it.



For your fully automation I would suggest to set
• 'autostart': 1 in PB1/pbSettings.json
• Put (admin) passwords of games in pbPasswords.json
It is better to collect them in one file but not pbSettings.json.
The game will search for the correct password of the given save during the start.
• Use startPitboss.py to start the game.
• If the server doesn't start/crashs use SSH to connect and use 'startPitboss.py list' to find out a save which does loads.
Main issue for failures are wrong password/mods for a gives save file.
Reply

Are pitboss servers using PB Mod_v9 limited to normal Civ4 games, or can they be hosts to savegames that are transferred from the Realms Beyond mod, RtR, or Realism Invictus, for example? What about the unofficial patch / BUG mod?
Reply

Hello HappyPart,

the mod components of the PB Mod can be merged into other mods, yes. This was already done for a few mods like RtR, CloseToHome, Pie's Ancient Europe, BASE.

The code basis of our mod grows over the years but most changes are still 'orthogonal' to other mods. Thus the merge of code should not be problematic.
Reply

I'm having trouble figuring out how/if I can install Civ4 on Linux Mint under Wine. I have Civ4 installed on my old Windows XP device, and I can probably dig up the CD; can I work with these? (And, er, how?) Thanks for any suggestions/advice you can offer!
Reply

Probably this works. I diverted this instructions from my install script for the Pitboss server binary. Thus, some instructions related with the the 3D Graphic setup could be missing. Please ask if one of the following steps not works as expected. I can not provide a bullet prove installation instruction, but can help to solve problems if it does not work.

0. Copy the whole Civ4 installation to your Linux machine (or mount the partition...). You do not need the DvD's, but just the folder installed on your Windows XP.
1. Install wine
2. Civ4 is a 32bit application. Thus you need on a 64bit system many system libraries and wine in its 32bit variant, too. You can install them by
Code:
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install wine32

This will use the wine version from the official repository of your Linux distribution. Step 1 & 2 can be replaced by other methods, e.g. using the wine repository.

3.  (maybe redundant)
Code:
apt get install libgl1-mesa-glx:i386
 

4. Create new 32 environment for Civ4:
Code:
WINEPREFIX=~/.wine32 WINEARCH=win32 wine

Without the WINEPREFIX the default folder "$HOME/.wine" will be used. Prepend the WINEPREFIX in the following commands. Otherwise the stuff will be installed in the 'wrong wine folder'.

If you do not use other programs, simply use the default value ~/.wine.
5. Download recent winetricks:
Code:
wget "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks"

4. Install msxml3 via above winetricks.
Code:
chmod +x winetricks
WINEPREFIX=~/.wine32 ./winetricks --unattended msxml3


5. Start Civ4, e.g. with the mod 'CloseToHome_2.0'. (Note that all params (mod= ...) are quoted together as one string! If I remember correctly this is important.  nono )

Code:
cd .../Civ/Beyond the Sword/
WINEPREFIX=~/.wine32 wine Civ4BeyondSword2015.exe "mod= CloseToHome_2.0"


This instructions is not complete. Some things like ingame fonts needs more steps.

Edit: Instructions for creating a *.desktop-File for startup can be found here.
Reply

Thanks so much - that did it!  As you mentioned, the in-game fonts aren't working, which isn't a big deal, except that - perhaps relatedly(?) - the tile yields display incorrectly on the map:  They're correct in the mouse-over text and their in-game effects are fine, but when displayed via ctrl-y, in the city screen, or with a Settler active, the yield icons each display as a single bread slice.  (E.g. a grass rice, plains hill forest, or desert incense each display as one breadslice, a plains wheat, grass hill forest, riverside grassland, or riverside desert hill each display as two breadslices side by side, and a plains fur displays as three bread slices side by side.)

Do you know of a way to fix this (whether or not this means taking the additional steps needed to set up the in-game fonts)?

One other note:  I found I also had to put quotes around the filepath; e.g. (with the ellipsis representing my full filepath, and using the BTS_Wrapper in this case, just to have that set up in hopes of someday connecting to a Pitboss game)
Code:
cd ".../Beyond the Sword/"
WINEPREFIX=~/.wine32 wine BTS_Wrapper.exe "mod= RB63"

Also, the terminal wrote a series of error messages, though I don't think they affected anything significant unless the last represents something I've missed.
Code:
0030:err:menubuilder:Process_Link unable to load L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\Logs.lnk"
0030:err:menubuilder:wWinMain failed to build menu item for L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\Logs.lnk"
0032:err:menubuilder:Process_Link unable to load L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\Saves.lnk"
0032:err:menubuilder:wWinMain failed to build menu item for L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\Saves.lnk"
0042:err:menubuilder:Process_Link unable to load L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\CivilizationIV.ini.lnk"
0042:err:menubuilder:wWinMain failed to build menu item for L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\CivilizationIV.ini.lnk"
'import site' failed; use -v for traceback

Thanks very much for your help!
Reply

Glad to hear that it works smile

(January 15th, 2022, 18:40)RefSteel Wrote: ... single bread slice.

Do you know of a way to fix this (whether or not this means taking the additional steps needed to set up the in-game fonts)?

I assume you can fix this by switching to the „real implementation“ of DirectX9. Normally the version installed by wine works, but for some graphic cards/drivers not.
Try to install it with (above) winetricks by
Code:
./winetricks d3dx9

An other font issue can be fixed by
Code:
cp Civ4/Resource/Fonts/sylfaen.ttf {YOUR_WINE_DIR}/drive_c/windows/Fonts/.
After this, the Pedia entries should using the normal Civ4-like font.

Quote:One other note:  I found I also had to put quotes around the filepath; e.g. (with the ellipsis representing my full filepath, and using the BTS_Wrapper in this case, just to have that set up in hopes of someday connecting to a Pitboss game)
Code:
cd ".../Beyond the Sword/"
WINEPREFIX=~/.wine32 wine BTS_Wrapper.exe "mod= RB63"
[/code]
Yeah, the spaces in the folder names needs to be escaped or the path needs to be quoted.

[quote]
Also, the terminal wrote a series of error messages, though I don't think they affected anything significant unless the last represents something I've missed.
Code:
0030:err:menubuilder:Process_Link unable to load L"C:\\Program Files\\Civ4\\Sid Meier's Civilization 4 Complete\\Beyond the Sword\\Logs.lnk"
...
Thanks very much for your help!

You can disable the wine related error/warning messages by prepending "WINEDEBUG=-all".
Reply

Thanks so much!  Both fixes worked!  Specifically, in a little more detail, in case I someday need to repeat the process and forget the details in between:
Code:
WINEPREFIX=~/.wine32 ./winetricks d3dx9
followed by
Code:
cp "{filepath for my civ directory, meaning Beyond The Sword's parent directory}/Resource/Fonts/sylfaen.ttf" {filepath for my wine32 directory}drive_c/windows/Fonts/

Just one esoteric issue I've noticed:  On the city screen, ctrl-click acts like a normal click (i.e. when the build at the front of the queue has not yet been started, ctrl-click on a new build replaces the one at the front of the queue instead of pushing it down the list).  This is not a critical problem and might have more to do with my machine than the way civ is installed.  Either way, thanks again for helping me to get Civ working on this machine!
Reply



Forum Jump: