01-19-2017, 04:31 PM
Introduction
Yes, it's possible.
Generally there are three ways for Linux users to run Windows applications. Those ways are Wine, virtual machines and dual boot. Each of those ways is less preferable than the other. Wine is generally the best because it runs Windows applications almost natively in Linux by providing a compatibility layer between the application and the OS, translating the API calls from Windows ones to Linux ones. This essentially means very little performance loss at the cost of infrequent bugs and lack of functionality.
This shows in Freelancer in that I haven't found a way to run Freelancer without the Vsync forced on using Nvidia drivers. This is perhaps possible, however I couldn't find a good way to do it and as such this makes it borderline impossible to use for snub pvp. However if you just want to fly around in game, do trading or cap combat then it should generally be doable (however I don't know the implications of low-fps during cap combat).
Just to quickly touch on other ways of doing this. I know that several community members here use a dual-boot with Windows 7 to play Freelancer (I do it myself this way as well) and this is probably the most preferable way when it comes to game performance, however this of course means you have to stop whatever you're doing on Linux and boot into Windows to play the game which is rarely the most optimal thing to do. Also you need a Windows license.
The third way of course is virtualisation, either through direct methods like VFIO (if you manage to get this working, hats off) or a hypervisor. The issue with Freelancer is that VirtualBox flat out doesn't work or doesn't provide playable performance, Vmware Player causes issues with the mouse cursor in game and Vmware Workstation is goddamn expensive. I managed to get Freelancer running on Vmware Workstation once upon a time and the results, while better than Wine were still very unsatisfactory (like 100% CPU core usage). Of course this also requires a Windows license.
So this is not a way to fully replace Windows booting (because of the aforementioned Vsync issue as well as possible updates to the DSLauncher which might break things), but just a way for Linux users to have at least a way of playing the game.
Prerequisites
I've done this on elementary OS Loki (0.4). The installation process should be very similar on other Linux distributions, especially various flavours of Ubuntu. Also before begin I need to put in some very important red text.
DO NOT EVER UNDER ANY CIRCUMSTANCE INSTALL "directx9" COMPONENT
I don't know why that is but the only fix after installing it through winetricks or otherwise was a full reinstallation of the distro. Again, no clue why that's a thing but it is. Deleting wineprefixes or other things didn't help, so don't even try to install it because it will break things.
As far as the prerequisites are concerned, you will need to install the newest versions of Wine (2.0-rc5 at the time of writing). If you are on an Ubuntu-flavoured distro you can follow this guide from WineHQ to get the staging versions of Wine. If you are on Arch then like everything it's probably in the AUR. Others, I don't know. I suggest that after installing wine you use the terminal command
Code:
wine --version
to check your version.
You will also need winetricks and playonlinux.
Code:
sudo apt install winetricks playonlinux
PlayOnLinux is a very convenient tool to manage wineprefixes, wine versions and components. One thing you'll want to do before proceeding with the installation is to ensure you have the 32-bit wine version installed in POL alongside your system one. Do it by opening Tools -> Manage Wine Versions in the POL window.
You will also need Freelancer and the Discovery Freelancer installer. I used the repacked version made by some Russian going by the name "Origami". I suppose ThePirateBay links might be slightly out of line here so you might try with the ISO but I don't guarantee it's going to work. You can get Discovery Freelancer launcher exe from the forums.
Installation
Open POL and create a new 32-bit wineprefix by going to Configure -> New. Choose the system wine version (in my case 2.0-rc5) and name it something descriptive. For the purposes of this tutorial I will assume you named it freelancer.
Next we will need to install several required winetricks components. Note that this requires a bit of attention to the terminal output, especially if you haven't installed any winetricks components previously as not all of them can be fetched automatically. Sometimes winetricks will prompt you to manually download a file from a target website and place it in a certain directory and rerun the command.
Code:
WINEPREFIX=$HOME/.PlayOnLinux/wineprefix/freelancer winetricks d3dx9 directplay dotnet20 dotnet30 dotnet40 mfc42 vcrun6 vcrun6sp6
Once the command finishes successfully (you can rerun it to see if all components are installed), open POL and go to Configure -> freelancer -> Miscellaneous -> Run a Windows executable in this virtual drive and select the Freelancer installation .exe. If you use the ISO, make sure to unpack it first. Then, after the installation finishes, install the NoCD patch (if you use the Origami version, the NoCD patch is included in the repack). Remember to always use the default installation directories.
Now go to Configure -> freelancer -> General -> Make a new shortcut from this virtual drive and select Freelancer.exe. Run it and see if it works.
Next, we will need to install Discovery. Go again to Configure -> freelancer -> Miscellaneous -> Run a Windows executable in this virtual drive and select the Discovery Freelancer installer .exe. Click through the installer and install everything to default directories. Ignore the fonts integrity error, we will fix that later. Repeat the process of making a shortcut this time with DSLauncher.exe.
Note that the DSLauncher is quite buggy in Wine and can be tough to work with. Sometimes the prompts will not accept mouse clicks and you will have to use the keyboard to click through them. The patch downloads can sometimes also drop connection, in which case you will have to restart DSLauncher.
When the DSLauncher is done updating, try running the game to see if it works and if you can connect to the server.
Fixes
Fonts:
Download this (courtesy of
Importing accounts:
Go to your Windows partition and copy Users/name/My Documents/My Games/Discovery/launcheraccounts.xml to ~/Documents/My Games/Discovery (or your default documents folder if you use a different one).
Windowed mode:
Running Freelancer in windowed through DSLauncher doesn't work (most of the time). Instead in POL open Configure -> freelancer -> Wine -> Configure Wine -> Graphics and check "Emulate a virtual desktop". Insert the resolution you want the window to be and run Freelancer again.
Alt-tabbing causes a black screen:
On some desktop environments (I noticed this on Pantheon) alt-tabbing causes the game to black screen. This can be solved by running PlayOnLinux in a separate workspace and then switching between workspaces instead of alt-tabbing.
Vertical sync:
Note that this does not limit your FPS. If your FPS exceed 155 while fighting, you might be sanctioned for cheating.
Note that this does not work on Nvidia graphics drivers. Confirmed working only on Nouveau. Instead of opening POL normally, run it from terminal with:
Code:
__GL_SYNC_TO_VBLANK=0 vblank_mode=0 playonlinux