Playing Counter-Strike 1.6 on Wine on Linux
I think there's a bigger sort of strength donned on Free Software user, that is, other than the already immense freedoms and power that they already enjoy just by using it. That other strength is the tinkerer's mindset; the drive to test, try, debug and persist when things don't quite work. This ability is a gift that works even when we're forced (or choose, even) to use Proprietary software - which includes games.
Having spent some quality time off recently, I put myself to the task of doing maintenance to some old computers collected at my family's place. Bumping up Debian versions, doing some updates and checking backups to name a few things. One of these computers contained a gem, though: a copy of the classic Counter-Strike 1.6 for Windows.
I used to play it along with many other Half-Life 1 mods quite frequently back in the days following when I had started using Linux, and luckily for me, even back then it worked perfectly with Ubuntu. Eventually I moved on to freer alternatives, such as the cascade of Free Software Doom mods out there, and spent a long, almost decade-long hiatus without ever using Wine again.
This vacation, however, I decided to break the trend and try it out again. Would Counter-Strike still fare well with 2024 Linux? Yes it would. This is how I got it to work.
Gather the ingredients
To get Counter-Strike 1.6 running in your Linux box, you'll need the following:
- A Linux distribution that packages Wine for multiple architectures (32 and 64 bit x86).
- A recent version of Wine installed. Currently, the stable version is 9.0.
- A working copy of CS 1.6 with or without Half-Life 1.
Simple enough and straightforward, right? Well, not so fast.
Getting 32-bit support in your distro
For starters, not all Linux distros match requirement #1, and even those that do don't do it by default. Strictly speaking, #1 here means that, to play CS 1.6 (a 32-bit game based on a game from 1998), the system must have 32-bit wine binaries and other 32-bit support libraries even if the rest of the distro is 64-bit based. At this time of publishing, many distros ceased development of 32-bit versions, and for those that do, mixing architectures can become messy.
So how did I do it? I chose Debian, because enabling multiarch is quite easily if you're running from 64 bits, and they still maintain 32-bit x86 distributions (at least for now). A few other choices come to mind, like Alpine Linux, but I have never tried to mix architectures on it before, so I can't comment.
Enabling x86 in Debian's package manager is easy:
# dpkg --add-architecture i386
Cool! Now all you gotta do is apt install wine
, right?
Again, not so fast.
Installing a recent version of wine
If you have a more current version of wine in your distribution, this one is straightforward: just install it with your package manager and move to the next section.
However, Debian is frequently criticized for keeping "old" software versions in their stable distribution, and sadly, wine is a notorious case here. As I said, the current stable version released by the wine project is 9.0, yet the one Debian Bookworm (current stable as of this writing) provides is still stuck on the 6.0.3 version.
So this isn't going to work well, let alone be supported if something breaks. Instead, what we need to do is install the official up-to-date Debian wine builds, provided straight from the WineHQ team. Adding third-party repositories to Debian's apt isn't the most difficult thing in the world, but for the Wine one... let's just say that they could've improved a lot the process.
The Wiki page I referenced just before has the full instructions, but here's the short version of it:
First, download the public key used to verify the signature of the wine package builds:
wget -O /tmp/winehq.key https://dl.winehq.org/wine-builds/winehq.key
The thing is that the WineHQ team chose a different format of this key that isn't recognizable at first by apt, so when you updated the cache, it would claim that the signatures were invalid because the key couldn't be used. This was a source of so much frustration because it was not documented anywhere in the wiki. To turn this key into something usable, this is what you should do instead:
gpg --dearmor /tmp/winehq.key | doas tee /usr/share/keyrings/winehq.gpg > /dev/null
That's right, transform it into a binary GPG key that now APT can use.
Now you can add the repository by creating a new entry in your sources.list.d directory:
# Save as /etc/apt/sources.list.d/winehq.sources
Types: deb
URIs: http://dl.winehq.org/wine-builds/debian/
Suites: bullseye
Components: main
Signed-By: /usr/share/keyrings/winehq.gpg
And there you go. Should just be a matter of reloading the cache and installing the stable version of wine:
# apt update
# apt install wine-stable
Obtaining Counter-Strike 1.6
CS 1.6 is neither Free Software or Abandonware, so obtaining it can be a little tricky. If you have purchased it, now is a good time to look for that CD. If you don't have it anymore... let's say that you can still "find it" (with bots, even!) quite easily around the interwebz with some search engine skills. Same goes for CD Keys (they are needed to play even offline).
Torrent, Russian Warez sites, etc. all work here. And you can always try your luck at the low-hanging fruit of the Internet Archive, too. I mean, I can't link to anything specific here, but have a look in here, for instance, and you'll get the point.
Configure and debug the components
At this point, you should have a working modern version of wine with 32-bit support libraries installed by your distro's package manager and CS 1.6 ready to be installed. So let's start.
Before installing CS 1.6, create and configure your wine environment (called a "prefix") by running:
$ winecfg
Some first-run tasks will be done and at the end you'll have a configuration window looking like old Windows XP. You can take the time to configure additional stuff here, or just leave the defaults - they work with CS anyway.
Now install (or unpack, whatever) CS 1.6 by running:
$ wine setup.exe # or whatever installer your w4rez provided
Installation should go well, just remember in which Windows directory CS was installed, because we need to go there to run it. After setup is finished, drop to a Linux terminal and visit your wine prefix directory.
$ cd ~/.wine/drive_c/
Inside this directory, everything simulates Microsoft Windows. You'll recognize the system32, Program Files etc. directories. Now navigate to where you've installed CS 1.6. Playing the game is now as easy as:
$ wine hl.exe -game cstrike # goes directly into CS, not HL.
Prepare to enter your CD key here (you did find it in the previous step, right?)
Troubleshooting
If you can't run the game in OpenGL, or can't set up resolution to widescreen, chances are that the 32-bit OpenGL Linux libraries have not been installed for wine to use. In Debian, you need the libgl1
package in 32-bits for this:
# apt install libgl1:i386
Then run the game again and try to use these settings.
If the game claims that the CD key has not been correctly entered, or crashes every time when you try to start a match with some sort of Valve Key error, you have to enter a new CD key into the game. To do this, you have to dig into the fake Windows registry of wine and edit it inside there. You can use wine's own regedit tool for this:
$ wine regedit
Edit the key
HKEY_CURRENT_USER > Software > Valve > Half-Life > Settings > ValveKey
And enter a valid CD key in there and restart the game. This should fix these errors.
Pet peeves
A big peeve when running CS this way (at least in my system) is that the full 1080p resolution of my external monitor does not work. The game limits itself to a perceived limit of 720p and refuses to go larger, despite both xrandr and wine simulating the 1920x1080 resolution. No luck here, and even setting the screen height and width via the regedit trick before does not seem to bear fruit; the game simply goes back to a 640x480 resolution when I do so.
This is a weird bug, too, because I remember being able to run it way back in Ubuntu 14.04 or so with the full screen covered, so I know it's possible. I'd love to hear if somebody fixed this, and how.
Conclusion
Linux gaming, even with proprietary games, is alive and kicking thanks to the Wine project going full steam ahead (pun intended?), and some plain old hacker spirit persevering to make things work.
However, even with all its glory, I feel that this specific game should no longer exist as this proprietary mess that requires all sorts of these workarounds and hacks to work on Linux. Counter-Strike was released more than 20 years ago, and the game on top of which it runs even longer - not to mention the fact that its very game engine was built as a modification of the Quake Engine itself. In other words: it's time to release its source code.
Being written mostly in C++, Valve actually ported the engine to Linux sometime in 2013, but the source code itself was never released. In other words, no modding, derivatives or even decent packaging for this one in Free Software; it's as good as proprietary.
So to any Valve employeese reading this free software hacker's appeal: please release the GoldSrc engine's source code to the public. Take the lead that Id software did. You could keep the art and the maps as part of your intellectual property (much like Doom and Quake are now), but a free engine coupled with a highly-creative modding community would take this game to the sky.
You already did an amazing job with Proton, wine itself, and even chose to base your console on Arch Linux (and unlike pretty much all other video game consoles, I hear this one is very hacker-friendly). You know deep inside what's the next step concerning this game. Do the right thing and release it.
How do you play CS 1.6 or other proprietary games on Linux? How do you do so? Let me know on Mastodon!
This post is number #52 of my #100DaysToOffload project.
Last updated on 04/17/24