Tag Archives: virtualbox

Age of Empires 2 HD on VirtualBox

It’s been a few years since I’d last played it, but Age of Empires is still one of my all time favourite games. I started playing it back as a young noobling on Windows 98 with a Celeron 433mhz machine and loved the perfect balance the game achieved between simplicity and flexibility.

AOE 2 offered a large number of different civilisations with different research options, yet once you learnt the basics, it was quick and easy to pick up the rest and run with it – generally it made for a very fun game, both against the AI but also against friends multiplayer over a 10mbit LAN. ;-)

Whilst AOE 2 still ran on modern Windows, the game was showing it’s age with issues like hard coded resolutions (800×600 or 1024×768 anyone?), assumption of an optical media drive for the music to be loaded from and dated multiplayer functions.

Recently Microsoft re-released AOE 2 as “Age of Empires 2 HD” on steam, taking the opportunity to fix up the above issues and port the game to newer DirectX versions and adding in Steam support providing better multiplayer support.

AOE 2 HD on Steam

AOE 2 HD on Steam

Now as a Linux geek I used to have a dedicated Windows PC hanging around for gaming – however with my move to AU, I now only have my Linux laptop and I wasn’t very keen to go back to a dual-booting world, having last done dual boot over 5 years ago.

Instead I have a Windows 7 VM inside VirtualBox which is a very good virtualisation product for desktop users offering easy management of VMs, good guest OS integration (eg desktop resizing) and also basic 3D acceleration.

I had tested the old AOE 2 original game in my VM which ran OK, but after AOE 2 HD was installed, I found the newer game would refuse to start with:

Error on start, subcode=1

The forums discuss a range of issues for this, but the general consensus is that with the move to a newer DirectX, the game would fail if some of the newer features were absent (eg shaders). I was worried about my Intel GPU being too poor as some posts suggested, but thankfully even the Intel GPUs from a few years ago are enough to play this game.

The issue was that the level of 3D acceleration being provided by VirtualBox was too low – this was easily verified by running “dxdiag” utility.

No 3D

By default, Virtualbox delivers DirectDraw Acceleration but not Direct3D.

By default if you enable 3D acceleration and install the Guest Additions, the acceleration is limited to just the stable basic features. For more advance 3D features, a module is available, but needs to be specifically selected during the installation as it’s not “stable” yet.

The stability of this feature is also rapidly changing – after turning everything on and running the game, I was causing the VM to crash entirely on the Linux OS-side.

ShCrOpenGL[23043]: segfault at 7fd40d7c3f90 ip 00007fd3f47c2f9d sp
00007fd3f4a8ba90 error 4 in VBoxSharedCrOpenGL.so[7fd3f4732000+cb000]

Generally I’m not a fan of Segfaults on my system. In order to avoid any nasty surprises, you must upgrade to the absolutely latest upstream version (at time of writing, this was 4.2.12-84980). Make sure you grab the latest version from Oracle/VirtualBox themselves, as if you’re using a distribution version their latest version in the distribution repositories may not be as up-to-date.

After installing/upgrading VirtualBox, adjust your virtual machine to be using 3D Acceleration and give it the full 256MB video memory.

You kind of want to enable 3D acceleration for 3D to work ;-)

You kind of want to enable 3D acceleration for 3D to work ;-)

Once booted, install the latest version of Guest Additions (“Devices->Install Guest Additions” from VirtualBox VM menu). Older VirtualBox drivers still work for most tasks, but you must do this installation/upgrade in order to get the absolute latest 3D fixes for the game to run.

When installing, make sure you select “Direct3D Support (Experimental)” from the component selector.

3D support is an option, not a standard feature.

3D support is an option, not a standard feature.

Note that VirtualBox will try and talk you into installing the stable basic 3D drivers. Make sure you select No and get the fully featured (but less stable) drivers.

No is Yes in our case.

No is Yes in our case.

Once installed, you’ll need to reboot and your Windows system should now feature the much better 3D support.

To verify, run “dxdiag” again to check the report:

Ready to party!

Ready to party!

Once done, you should be good to play! :-D

Recommend going to full screen in VirtualBox, before launching the game, the directional edge-of-screen scrolling works a bit weirdly otherwise. There’s also a quirk with the launch videos, where they play but display a blank screen. Just click to skip through them and to get to the game launch screen.

And we're live!

And we’re live! Back to the mines peons!

Performance and stability seems to be OK – I haven’t been able to take advantage of the higher resolution support much thanks to my laptop having a wonderfully crap display of 1280×768, so I can’t be sure whether it works well on higher resolutions or if the 3D acceleration can’t handle it.

My test was done on a x86_64 Debian Wheezy system running kernel 3.6.7 using the Oracle provided VirtualBox package (4.2.12-84980~Debian~wheezy) and a fully patched 64-bit Windows 7 Home Premium guest with latest Guest Addition drivers.

I have not tested on MacOS, but I would assume the process and support to be the same, since VirtualBox uses OpenGL on the HostOS side for the 3D Acceleration Pass-through.

Virtualbox Awesomeness

Work recently upgraded us to the latest MS Office edition for our platform. Most of our staff run MacOS, but we have a handful of Windows users and one dedicated Linux user (guess who?) who received MS Office 2010 for Windows.

I’ve been using MS Office 2007 under Wine for several years, it was never perfect, but about 90% of the functionality worked with some exceptions such as PDF export and certain UI and performance artifacts.

With the 2010 upgrade I decided to instead switch to using Windows under a VM on my laptop to avoid any headaches and to fix the missing features and performance issues experienced running Office under Wine.

Whilst I’m a fan of Xen and KVM, they aren’t so well suited for desktop virtualisation as they’re designed more for server environments and don’t offer some of the more desktop focused features such as seamless integration, video acceleration and easy point & click management interfaces.

Instead I went with VirtualBox thanks to it being mostly open source (open source with exception for a few extensions for USB 2.0 forwarding and network boot) and with a pretty good reputation as a decent VM application.

It also has some of the user-friendly desktop features you’d expect such as being able to forward USB hardware through to guest, mounting any folder on the host as a network share (without needing to setup samba) and 2D/3D video acceleration.

But the real killer feature for me was the seamless windows feature, which allows me to boot the virtual windows desktop and Windows applications alongside my Linux applications smoothly and without the nastiness of an RDP window.

Windows & Linux application windows running together concurrently.

Sadly it’s not quite good enough for you to be able to run the latest Windows games in as the 3D acceleration is quite basic, but it’s magnificent for just about any other non-multimedia application.

The only glitch I found, is that if you have dual screens, you can only run the windows session on one screen at a time, although virtualbox does allow moving the session between monitors whilst running so it’s not too big a deal.

The other annoying issue I had with virtualbox is that it uses image files for storing the guest VMs and it doesn’t appear possible to get it to use an LVM volume instead – so in my case, I waste a bit of space and performance for unnecessary filesystem formatting to store the Windows VM. I guess this is a feature that only a small subset of users would want so it’s not particularly high priority for them to add it.

I’m running Win7 with 2 virtual cores and 1GB of RAM on top of a host with an Intel Core i5 CPU (with hardware virtualisation enabled), 8GB RAM and a Intel 320 series SSD and it’s pretty damn snappy.

As a side note, the seemless window integration also works for Linux-based guests, so you could also do the same ontop of a Windows host, or even Linux-on-Linux if desired.