SXX Jul 9, 2014 @ 3:22am
*deprecated* [Linux] Workaround for lag-less multiplayer *lag fixed*
WARNING!
This workaround no longer required, developers fixed the problem in latest Beta!
http://steamcommunity.com/app/48700/discussions/0/864951475505126116/?tscn=1405116145#c45350791311010626

! ! ! ! ! ! ! ! !
...
Easier workaround is this one!
Most easier workaround without root access requirement:
1 - Right-click on the game title under the Library in Steam and select Properties.
2 - Under the General tab click the Set launch options... button.
3 - Enter this into field and click OK:
strace -f -e write -o /dev/null %command%
4 - Close the game's Properties window and launch the game.
Enjoy lag-free multilayer!

Though this will attach strace to every child thread so it's have higher performance hit than automatic script!

Automated bash script for attaching strace
This script only attach strace to network thread so should cause less performance drop, but require root access!

I made automatic bash script that attach strace. You can run it before you start game and then it's will attach strace to network thread ever time you connect to some server. :-)

Code:
#!/bin/bash
need_lines=8

echo "Start scanning for warband network process..."

while [ true ]
do
ps_warband=`ps -efL | grep warband | grep -v grep | grep -v '/bin/sh'`
ps_lines=`echo "$ps_warband" | wc -l`

if [ "$ps_lines" -eq "$need_lines" ]
then
thread_pid=`echo "$ps_warband" | awk 'NR=='+$need_lines | awk '{ print $4 }'`
echo "Network process found! Attach strace to PID: $thread_pid"

strace -o /dev/null -p "$thread_pid"&
wait

echo "Network process exited! Continue scanning..."
fi

sleep 0.01
done
If you want to run this script without root you need to configure sudo to run strace as non-root user.

Where I tested it...
This workaround should let you play in multiplayer with Windows performance. It's tested by me on Kubuntu 14.04 with 3.16RC4 kernel, game is running on highest settings with Intel HD4600 with most recent drivers from Oibaf PPA.

I'm running i7 4771 and I not sure how well this will work on not that beefy CPUs. :-(

My little research of game "lag" problem.
This part doesn't important at all so if you just want to get into the lag-less game skip it.

So I'm big fan of Warband MP so I'm was really annoyed by fact that MP lagging so much in newly appeared Linux version. I'm tried to understand why it's happen few days ago, but all my previous guesses were wrong: networking specific, too many open sockets, blocked ports, packet loss.

Still back in few days I'm noticed that game tried to read "steam.pid" way to often and I'm thinked that it's related to fact of "lags". It's understandable that game using it to track Steam client activity (DRM? Achievements? no idea), but tons and tons of file access every second really not looks like a good thing. So I'm tried to move both steam.pid and game content into tmpfs (RAM). This wasn't too successful so I'm decide to run game while Steam in offline mode and without overlay, but it's still read this file and lagged.

Only then I decide to check if there some thread that load CPU more than anothers and bingo! I'm find it and it's was thread that handle networking and read this "steam.pid" so possible this is one that actually using Steam API. Unfortunately I still had no idea how to fix it.

Accidentally I leave strace opened for this nasty thread and then when I get into game client there was no lag. Soon I find out that it's what make lag gone: tested it with Steam overlay enabled and confirm that game work properly with strace.

Outdated original how-to...
You shouldn't use this one, use launch option or script above!

1 - First of all run game normally; no modifications needed.

2 - Once main menu loaded execute this command in terminal:
ps -efL | grep mb_warband_linux
This will print all threads Warband executable running and it's will looks like that:
i@ubuntu-vm:~/.steam/steam/SteamApps/common$ ps -efL | grep mb_warband_linux
i 24546 24545 24546 0 1 13:49 ? 00:00:00 /bin/sh -c "/home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux"
i 24547 24546 24547 52 7 13:49 ? 00:05:54 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24548 12 7 13:49 ? 00:01:24 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24552 0 7 13:49 ? 00:00:03 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24553 0 7 13:49 ? 00:00:03 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24554 0 7 13:49 ? 00:00:04 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24566 0 7 13:49 ? 00:00:00 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24567 0 7 13:49 ? 00:00:00 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24701 22816 24701 0 1 14:00 pts/11 00:00:00 grep --color=auto mb_warband_linux
So here is base 7 threads that game using, none of them cause "lag".

3 - Now try to open Multiplayer, find any server you like to play at and join it.

4 - Once you joined server run same command once again:
ps -efL | grep mb_warband_linux
Now there will be 8 threads, e.g new one appear:
i@ubuntu-vm:~/.steam/steam/SteamApps/common$ ps -efL | grep mb_warband_linux
i 24546 24545 24546 0 1 13:49 ? 00:00:00 /bin/sh -c "/home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux"
i 24547 24546 24547 62 8 13:49 ? 00:08:57 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24548 11 8 13:49 ? 00:01:41 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24552 0 8 13:49 ? 00:00:04 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24553 0 8 13:49 ? 00:00:04 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24554 0 8 13:49 ? 00:00:05 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24566 0 8 13:49 ? 00:00:00 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24567 0 8 13:49 ? 00:00:00 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24547 24546 24747 80 8 14:03 ? 00:00:02 /home/i/.steam/steam/SteamApps/common/MountBlade Warband/mb_warband_linux
i 24749 22816 24749 0 1 14:03 pts/11 00:00:00 grep --color=auto mb_warband_linux
So basically last thread with PID "24747" it's one that handle networking.

5 - Now attach strace to this process using this command:
sudo strace -e write -p 24747
Obviously you need to replace "24747" with your PID.
And yes this is does require root permissions.


6 - As long as "strace" attached to this process game won't lag!
There won't be any output because this process do not write anything.

7 - Once you disconnect and join same or other server you'll have to attach "strace" again.
This is happen because new networking thread spawned every time you join server.

Enjoy lag free game!

How is this works?
To be fair I have no idea because I'm not the guy who usually debug blobs. ;-)

Possible strace slow-down this thread or make it work faster instead. I still have feeling that problem related to how game watch Steam client running, but this might be just red herring and actual problem might be completely different...
Last edited by SXX; Jul 11, 2014 @ 6:28pm
Showing 1-11 of 11 comments
< >
SXX Jul 9, 2014 @ 4:11am 
If you not sure how to join Beta
If you not sure how-to get into Linux Beta here is how-to:
1 - Open game "Properies", then "Betas" screen.
2 - Input this password into form "betapassword" and press Enter.
3 - Now you'll able to choose beta via drop down menu, choose it.
4 - Once it's done Steam will download Linux/Mac versions of you.

If for some reason it's failed to update from Windows version you have now then you might need to remove game and install it once again with Beta option enabled.
Last edited by SXX; Jul 9, 2014 @ 6:40am
Mattio Jul 9, 2014 @ 5:28am 
Fantastic find, worked for me but seems there are still many other problems with MP. I just fell under the map after running 30 seconds lol > http://steamcommunity.com/sharedfiles/filedetails/?id=283481086
Maybe it was a 1 off, will give the script a try in a bit.
All we will need now is Napolionic & the odd fix & we're all good to go! :)
SXX Jul 9, 2014 @ 5:48am 
Happy that somebody able to test it! Thanks!

Originally posted by Mattio:
Fantastic find, worked for me but seems there are still many other problems with MP. I just fell under the map after running 30 seconds lol >
Yeah I feel that something wrong happen when I just on Arena map. E.g when I just on fence it's looks like I go over it.

Basically I suppose that you can run whole game with "strace -f" via Steam's "Launch options", but it's will likely cause a lot more serious performance hit. :)
Last edited by SXX; Jul 9, 2014 @ 5:49am
Ledpen Jul 9, 2014 @ 6:15am 
Works for me, too, thanks! Could someone reading this thread possibly explain how strace fixes the lag?
SXX Jul 9, 2014 @ 6:44am 
So this can be done without scripts with Steam out of box "launch options" only. Though this will attach strace to all processes so I not sure how big performance impact will be; so in case of performance drops script still preferable.

Updated first post with more information. :-)
Last edited by SXX; Jul 9, 2014 @ 6:51am
MustafaK  [developer] Jul 9, 2014 @ 11:01am 
This is interesting :) We were planning to fix this today but something came up on Windows build that we had to look. But I'm sure we'll be able to fix it until weekend. Thanks for the workaround.
Robin inda Hood (LFT) Jul 9, 2014 @ 11:15am 
SSX, thanks you for such a great work!
SXX Jul 9, 2014 @ 7:02pm 
@MustafaK
Good news that this would be fixed soon.

I'm already had several awesome fun hours in MP so digging clearly worth it.
Now Warband just need native headless server so I won't need Wine to run it. :)
Last edited by SXX; Jul 10, 2014 @ 3:45am
B1-66ERDK Jul 11, 2014 @ 2:28pm 
Hmm I have tried the first solution, the easy one (strace -f -e write -o /dev/null %command%), in the the game launch option. but it does not seem to change anything for me, multiplayer still crazy laggy but single play is playing great :)

Any ideas?? i'm using Xubuntu 14.04

But ok, if they are gonna fix it soon, I can survive :) would just be nice to be able to play it here over the weekend so I can see if it was something I would want to buy.
Last edited by B1-66ERDK; Jul 11, 2014 @ 2:35pm
SXX Jul 11, 2014 @ 6:26pm 
Originally posted by B1-66ERDK:
But ok, if they are gonna fix it soon, I can survive :) would just be nice to be able to play it here over the weekend so I can see if it was something I would want to buy.
Devs already fixed this problem in new Beta:
http://steamcommunity.com/app/48700/discussions/0/864951475505126116/?tscn=1405116145#c45350791311010626
Last edited by SXX; Jul 11, 2014 @ 6:28pm
B1-66ERDK Jul 12, 2014 @ 3:57am 
Hey thanks, that worked.. everything is running great now.. did not see their post for some reason.
Showing 1-11 of 11 comments
< >
Per page: 15 30 50
Date Posted: Jul 9, 2014 @ 3:22am
Posts: 11