Tag Archives: games

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.