emulation

Playing Starcraft on Linux using Wine

Wine logo

Here's a quick HOWTO for using Wine to play Starcraft on a Linux machine.

Starcraft Installation

  $ apt-get install wine (as root)
  $ winecfg

The winecfg (graphical) utility will setup some config file defaults in your ~/.wine directory. Click on Graphics and activate Allow DirectX apps to stop the mouse leaving their window. Also, click on Audio (a dialog will pop up, just click OK). This will autodect your soundcard and setup Wine to use it. Under Drives click Add (this will add D:) and change the path to /media/cdrom, so that Wine knows about your CD-ROM drive. Finally click OK to close winecfg and save the settings.

winecfg screenshot

The next step is to insert the Starcraft CD-ROM into the drive and start the installer using Wine:

  $ mount /media/cdrom (as root)
  $ wine /media/cdrom/setup.exe

Follow the instructions in the installer until the Starcraft install is finished (you'll need your CD key number), then exit the installer (don't start playing Starcraft right away).

The next step is to get the latest patch and get rid of the need to insert the CD-ROM every time.

  $ wget http://ftp.blizzard.com/pub/starcraft/patches/PC/SC-1161.exe
  $ wine SC-1161.exe

After the patch is installed click OK and Starcraft will be started (very annoying). Leave the game again. We'll get rid of the CD-ROM requirement now:

  $ cp /media/cdrom/install.exe ~/.wine/drive_c/Programme/Starcraft/StarCraft.mpq

That's a pretty big file, it may take a while. You might have to change "Programme" in the path (I have the German Starcraft version). That's it. You can now play Starcraft (without needing the CD-ROM) using:

  $ wine ~/.wine/drive_c/Programme/Starcraft/StarCraft.exe

Notes

A good thing is, it even works nice and fast with the open-source nv NVIDIA driver (no need to install the proprietary driver).

I noticed one very annoying "bug" with the mouse behaviour at first. The mouse would sometimes just get stuck during the game (which is a total disaster of course, if you're in the middle of a fast-paced game). Left-clicking somewhere would "unstuck" the mouse, but it's still very bad. After many, many hours of reading bugreports and trying various patches I finally found out the root cause for the problem.

It's somehow related to my window manager (IceWM); whenever you move the mouse to the bottom of the Starcraft screen (where the IceWM status bar is, even though it's not on top or even visible, and even though Wine/Starcraft runs in full-screen mode!), something funny happens with X11/IceWM and the mouse gets stuck. I haven't yet found out if/which IceWM option could fix this behavior, but I have a small work-around. Just start Wine directly on a second X11 server with Starcraft (without any window manager being involved):

  $ xinit -e '/usr/bin/wine ~/.wine/drive_c/Programme/Starcraft/StarCraft.exe' -- :1

No patches needed (stock Wine from Debian unstable works fine, that's version 1.0.1 right now). I hope this saves other people some debugging time...

Brood War Installation

In order to play the Brood War expansion you can follow a similar procedure. Insert the Brood War CD-ROM, then:

  $ mount /media/cdrom (as root)
  $ wine /media/cdrom/setup.exe
  $ cp /media/cdrom/install.exe ~/.wine/drive_c/Programme/Starcraft/BroodWar.mpq
  $ wget http://ftp.blizzard.com/pub/broodwar/patches/PC/BW-1161.exe
  $ wine BW-1161.exe

After you've done that, you can start both Starcraft (classic) and Brood War via:

  $ wine ~/.wine/drive_c/Programme/Starcraft/StarCraft.exe

You will be asked in the game whether you want to actually play the Starcraft or Brood War variant.

Reducing CPU load

As of version 1161 for the Starcraft / Brood War patch, there's a new game option which can drastically lower the CPU load while playing Starcraft. First fire up Starcraft and start any game. Then, press F10, select Options / Game speed, and check the "Enable CPU Throttling box". You'll probably need to restart Starcraft afterwards.

Multiplayer and Firewalls

Multiplayer LAN games work just fine (didn't try BattleNet that much yet), but if you use a strict firewall rule set as I do (which blocks most ingress as well as egress traffic) you have to open a number of different ports. Here's what I added to my firewall script:

  $IPTABLES -A OUTPUT -m state --state NEW -p udp --dport 6111 -j ACCEPT
  $IPTABLES -A INPUT -m state --state NEW -p udp --dport 6111 -j ACCEPT
  $IPTABLES -A OUTPUT -m state --state NEW -p udp --dport 6112 -j ACCEPT
  $IPTABLES -A OUTPUT -m state --state NEW -p tcp --dport 6112 -j ACCEPT # BattleNet

Starcraft on netbooks

One A110 netbook running Starcraft

Starcraft works just fine on various netbooks; for instance, I tested it on my One A110 netbook (VIA VX800) with 256 MB of RAM, and the whole .wine directory being on a USB thumb drive (thus slow; but my internal SSD was already full). I bet it'll also work fine on the ASUS Eee PC and other netbooks...

Audio works fine, and game speed is quite OK, the only minor "problem" is that you should use an external USB mouse, the touchpad is just too small (and too slow to use) for such a fast-paced game.

The full Wine package (and all dependencies) consume quite a lot of space on the (usually very small) hard drive or SSD of a netbook, but luckily you can get away with only a minimal Wine install for playing Starcraft:

  $ apt-get install wine-bin libwine-alsa (as root)

That's sufficient, and a lot smaller than installing the full wine package.

Update 2010-06-23: There's a contributed Hungarian translation now (thanks!)
Update 2009-03-04: Added info about patch 1161 and CPU load reduction.
Update 2008-12-19: Added Starcraft-on-netbooks section.
Update 2008-12-13: Added BroodWar and multiplayer info.

Testing stuff with QEMU - Part 3: Debian GNU/kFreeBSD

Debian GNU/kFreeBSD screenshot 1

Note: This article is part of my Testing stuff with QEMU series.

From the Debian GNU/kFreeBSD port page:

Debian GNU/kFreeBSD is a port that consists of GNU userland using the GNU C library on top of FreeBSD's kernel, coupled with the regular Debian package set.

Q: Why would anybody want to do that?
A: Why not? [1]

So, after we have talked about that, let's start:

  1. Install QEMU:
    apt-get install qemu
  2. Download the latest Debian GNU/kFreeBSD installer ISO image (either for i386 or amd64):
    wget http://glibc-bsd.alioth.debian.org/install-cd/kfreebsd-i386/20070313/debian-20070313-kfreebsd-i386-install.iso
  3. Create a QEMU image which will hold the Debian GNU/kFreeBSD (i386) installation:
    qemu-img create -f qcow2 qemu_kfreebsd_i386.img 5G
  4. Boot directly from the ISO image and install Debian into the QEMU image:
    qemu -boot d -cdrom debian-20070313-kfreebsd-i386-install.iso -hda qemu_kfreebsd_i386.img
  5. The FreeBSD installer will now start. For more detailed instructions see the Installing Debian GNU/kFreeBSD manual.
    First you can choose between an "Express" or "Custom" install (I used "Express").
  6. Next you end up in the partitioning tool. Type "a" to use the entire (QEMU) disk for the installation (the disk is called "ad0", not "hda" as on Linux). Type "q" to quit the partitioning tool.
  7. You are now asked which boot manager to use. For QEMU you should use "BootMgr", the default FreeBSD boot manager. If you install on real hardware you can also use GRUB; in that case choose "None" here (see the manual for more information), but note that the installer does not install or configure GRUB for you! You should do that beforehand!
  8. Next up: The disklabel editor. Here you'll create a partition ("slice" in FreeBSD-speak) for the root filesystem and a swap partition.
    Press "c" to create a new slice (will be called "ad0s1"), enter "4GB", choose "FS" (filesystem), and enter "/" for the root filesystem. Per default the UFS2 file system will be used. To create the swap partition, press "c" again, enter "1023MB", and select "swap". The new slice is called "ad0s1b". Press "q" to quit.
  9. Choose "minimal" when asked which distribution to install.
  10. Installation media dialog: select "CD/DVD" and "acd0" (for QEMU's ATAPI/IDE CD-ROM drive).
  11. The installation will now begin, and after a while you're asked to switch to console 3 using ALT-F3. Do it.
  12. You'll have to answer a bunch of questions: geographic area + city you're in (for timezone), whether you want to participate in the Debian popularity contest, whether module-init-tools should load additional drivers (no, so press ENTER three times). The installation will soon be finished.

At the end you must select "No" as you're told to do, then reboot via "Exit Install". You can then shutdown QEMU.

  1. Restart QEMU with the newly installed Debian GNU/kFreeBSD:
    qemu -hda qemu_kfreebsd_i386.img
    Debian GNU/kFreeBSD screenshot 2
  2. Press enter at the FreeBSD boot manager prompt, then login as root (there's no password).
  3. First things first: Set up a root password:
    passwd
  4. Now let's fix networking, update the system and install a bunch of packages:
    nano /etc/network/interfaces
    Yes, there's no vi, not even a symlink to nano! Uncomment the two "ed0" lines ("ed0" is the equivalent to "eth0" on Linux, I guess).
    /etc/init.d/networking restart
    apt-get update && apt-get dist-upgrade
    apt-get install vim xorg icewm xterm
  5. You can fix your console keymap using the kbdcontrol package (just select your keymap from the menu):
    apt-get install kbdcontrol
  6. Finally, let's fix X11 and start it. But first we create a new user, as we don't want to run X11 as root:
    adduser uwe
    vi /etc/X11/xorg.conf
    The mouse device is "/dev/psm0", the protocol "PS/2", and the graphics driver should be "vesa":

      Section "InputDevice"
          Option "Device" "/dev/psm0"
          Option "Protocol" "PS/2"
      [...]
      Section "Device"
          Driver "vesa"
        
  7. That's about it. Login as "uwe" (or whatever your username is) and start X11:
    startx

Wasn't all that hard, eh? Now, if you've got some spare time, head over to the Debian GNU/kFreeBSD wiki page and help improving this port ;-) You should probably start with reading the PORTING guide.

Both kfrebsd-i386 and kfreebsd-amd64 seem to be reasonably stable already (and more than 70% of the whole Debian archive builds fine on these architectures, see kfreebsd-i386_stats and kfreebsd-amd64_stats). I'll quite likely install kfreebsd-amd64 on one of my boxes soonish and start using it, maybe I'll even find some time to fix/patch/port some packages...

[1] More elaborate answer(s) and reasons are available in the Debian wiki.

Syndicate content