June 24, 2009
Starcraft on VirtualBox (and Hamachi)
Rationale
Starcraft on Wine is horribly slow due to the missing DIB engine.
Handling DIBs is a crucial component when it comes to fast 2D drawing. Other games like Age of Empires and even applications like Adobe Photoshop are affected by this weakness in Wine.
Work on this has started last year as a Summer of Code program, but progress has slowed down recently.
All in all I guess we won’t get a usable implementation within the next few years except if another dedicated effort is spent on it.
Enter VirtualBox
Luckily another solution has come up recently: Sun’s VirtualBox virtualization product is free (as in beer and freedom), easy to use and works well enough with Starcraft.
Here’s my basic setup: VirtualBox 3.0.0 (in beta state right now but so far it hasn’t crashed on me) with guest additions, Windows XP and Starcraft Brood War 1.16.1.
I have enabled DirectDraw acceleration and bridging as network mode in VirtualBox. Both are simple point-and-click settings; you need to make sure the vboxnetflt module is loaded, though.
All of Starcraft is usable and very importantly fast.
Resolution issues
Update: You can just use VBoxSDL to start your VM in proper fullscreen mode without jumping through the hoops below. Makes it much more convenient and reliable.
VirtualBox does not have a real full-screen mode. With the guest additions you’re able to get a Desktop that resizes automatically to fit, but fixed resolutions (Starcraft uses 640×480) will not be scaled up to fill the VirtualBox window or the whole screen.
I have tried XRandR but it just made the viewport smaller which is worse than useless.
The kludge here is to copy over your X config, remove all resolutions except for 640×480 and start a new X server. I cannot go into the full detail here but it boils down to this:
xinit /home/sky/scripts/xinitrc.2 -display :1 \ -- :1 -ac -config xorg.conf.lowres
Put in some lightweight window manager or VirtualBox itself at the end of xinitrc.2.
After that just use VirtualBox as you have before and switch to full screen.
You should be ready to get the full experience of playing Starcraft now!
Bonus: Hamachi integration
Hamachi is a proprietary cross-platform VPN solution that is also beginner-friendly and gratis. It works well with my VirtualBox setup, too.
However the latest version (1.0.3.0) does seem to have some problems with UDP networking.
Downgrading to 1.0.1.4 helped, and I was even able to play Starcraft via a VPN. Don’t forget to turn off the helpful Windows firewall least it might interfere with your network.
Did this post help you?
If yes, then I’d like to know about it. Please also tell me about other games that work or don’t work with this setup.
If you’re really happy about it you may also send me a gift.
Comments(6)
very cool tip!
i have starcraft working fine in wine 1.0.1 in debian
Could you please go into full detail about resolution? It seems to be the solution of my problem, but I didn’t get how to make it.
Artem,
some days ago I actually discovered a better method for the resolution problem. Use `VBoxSDL’, which comes with VirtualBox, to start your virtual machine. VBoxSDL is capable of doing proper fullscreen scaling.
Artem,
I found out how to do it with VBoxSDL.
First you must run the command “$ VBoxSDL –detecthostkey”, and press your preferred hostkey. VBoxSDL will not remember the one you’ve set up in VBoxOSL.
The command will reply by something like “–hostkey 312 0″ witch you must add when you start up the machine: “$ VBoxSDL –hostkey 319 0 -vm “Windows 7″”. The last string is the name of the machine.
When the machine starts up, you can press hostkey + F to toggle fullscreen, this time with stretching.
Nice tip, thanks!