How to run Age of Empires 2 HD on Arch Linux (Steam Version)
Valve changed the world of games on Linux for the better when they decided to bet on Linux as the base for SteamOS, their fine-tuned operating system made to run on prebuilt computers called Steam Machines. Nowadays a lot of the game engines are linux-compatible, and therefore there's a good amount of new games that get Linux support upon release.
Age of Empires II is an old game that recently got a remix from Microsoft. It was one of my favourite games growing up and the new edition has HD graphics, there's a couple of new expansions, with new campaigns and civilizations :).
I bough the game, knowing that sadly it had no native Linux support. But I was hopeful I could make it run. In fact after some time installing it ran pretty well! This in turn made me wanna share how I got it working and how you too can also get it working!
Installing the game
My preferred way to have it run was trough PlayOnLinux. If you never heard of it, you can think of it as a wrapper on top of Wine, the compatibility layer that allows for Windows's software to run natively on Linux. PlayOnLinux creates individual wine "bottles" for each software you install, which allows for each software to run with a specific set of configurations know to work best for that particular case, with the added bonus of greater isolating of the software.
You can create your own app configurations on PlayOnLinux, but fortunately someone already created one for the game we want. It then just requires some fine minor tweaks for everything to play nicely under Arch Linux.
This is as easy as:
$ sudo pacman -S playonlinux
Install the game
Open up PlayOnLinux, and click on
Install button. At this point the application will likely ask you to synchronize the list of scripts with the server, allow it to do so. Once that is done, search for the game and choose the
Follow the steps provided by the installer. Read each step carefully. It will setup everything you need to run Steam, and then to run the game. During the installation of the script, you'll be asked to login to Steam and install the game, do that and don't just click
next or since the process needs for certain files to be in place to properly set things up.
After Steam has been installed, login to it, disable Steam Overlay from within Steam settings. This is needed for the game to run without glitches.
Having installed the game on Steam, close it. Make sure it is not minimized near the tray and really close it. Proceed with the installation on PlayOnLinux until it finishes.
Modifying a few things
After all of this, try to run the game. In my case I would only see the game launcher, with no labels on the buttons. By pressing on the buttons the app would crash and nothing would happen. If it worked for you, you can stop now and enjoy the game! Otherwise continue reading for details on how to fix this and other issues.
Reset the state
The game did not start, but that doesn't mean the process died entirely. Go back to PlayOnLinux, select the game, press Configure on the right panel with the game selected, and on the new window select Wine > Kill Processes . This will ensure that all the instances of wine related to this game are properly killed.
You should do this every time you run the game, quit and want to tweak configurations. It will prevent you running around in circles when trying to find a solution, otherwise you might end up fixing whatever issue it is that you're facing but never know it because there was still a previous configuration in effect.
Bypass the launcher
So my first problem was with the launcher itself. We can bypass the launcher of the game and drop into the game directly. To do this, the easiest way is to navigate to the place where the game is installed, in my case (adapt path accordingly to your installation):
$ cd ~/PlayOnLinux\'s\ virtual\ drives/AOE2HD/drive_c/Program\ Files/Steam/steamapps/common/Age2HD/
Then backup the launcher app, just in case, and make the main game executable be the new launcher:
$ mv Launcher.exe Launcher.exe_backup $ cp AoK\ HD.exe Launcher.exe
After dropping directly into the game, I could see it briefly and then it would still crash stating "failed to create directsound".
After inspecting the Wine configuration I saw it wasn't detecting any sound system. My audio was working fine under Linux, so for Wine to fail it meant I was missing some libraries. Read ahead to know which missing sound libraries to install. I use Pulse, but if you don't you might skip those.
Note: make sure you have multilib repository enabled if you're running Arch x86_64!
Installing the necessary ALSA libraries
$ yaourt -S alsa-lib alsa-plugins lib32-alsa-lib lib32-alsa-plugins
Installing the necessary Pulse libraries
$ yaourt -S libpulse lib32-libpulse
Other sound-related libraries that might help in case you still have no sound (generic advise for most games):
$ yaourt -S mpg123 oss lib32-mpg123 lib32-openal
The app would not crash after this, and the game would run perfectly apart that it was missing sound. This can easily be solved by quitting the game, and resetting the state again as I've written above. From the same Settings window where you reset the state, pick Configure Wine. Go to the Audio tab and play with the values. Hit apply each time you change the values before pressing the Test Sound button. Once you find one that works, save it and go back to testing the game. My game had sound now :D
Other Wine-related issues
If you face other issues, a good place to start would be by taking a look at Arch Linux Wine wiki entry for details on most common problems and how to solve them.
Here's AoE II HD running flawlessly on my 2015 MacBook Pro :) 🎉
And also here's a video I've recorded with my phone: