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.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

27 Responses to Age of Empires 2 HD on VirtualBox

  1. Gustavo says:

    Great post. Have you tried to play over networks (internet & LAN)?

    • Jethro Carr says:

      I’ve had internet games – performance hasn’t been great during them, but I think that’s because P2P connectivity doesn’t work as I’m yet to configure my firewall properly, so all my traffic is going via a relay host.

  2. Bob says:

    Thanks for posting this! But when I do this, the virtual machine always aborts (so it gets a BSOD?). I only have 256MB VRAM on my GPU total, so could that be the reason?

    • Bob says:

      It aborts when I press “play” in the launcher, that is.

      • Jethro Carr says:

        The VRAM on your GPU shouldn’t be an issue, instead I suspect your version of VirtualBox or the VirtualBox Guest OS drivers is out of date.

        Check the version you have, it should be at least as new as 4.2.12-84980, if not newer. If you’ve just upgraded VirtualBox, you’ll need to re-install the guest OS additions/drivers, in order to ensure you have the latest stable 3D graphics.

        • Bob says:

          Thanks for the reply. I have the latest VirtualBox, and I installed the latest Guest Additions. I might have pressed “yes” when it asked if I wanted to install the basic Direct3D support, but I don’t really remember. I’ll try reinstalling and making sure to press “no”.

        • Bob says:

          OK, I installed the experimental 3D drivers like the tutorial said, but my VM crashes Mac-side now. My guess is that that’s the unstable part. I have all the latest software from Oracle.

          • Jethro Carr says:

            Bugger, that’s unfortunate. :-( I suspect there must be some bug/difference with the MacOS version of VirtualBox compared to the Linux version.

            I had crashes of VirtualBox itself with older releases that would show up as OpenGL library errors on the Linux host, so it’s possible that the MacOS version suffers a similar problem but unlike Linux has yet to be fixed.

            Check the version upgrades frequently, if lucky it may be fixed in nearish future. :-(

  3. Larry says:

    Thanks, i could start the game, but when a campaing starts a have s white screen and cannot see the maps. Please help me with that

  4. Erik Fritts says:

    Thank you so much for these Barney style instructions I refuse to double-boot and shouldn’t have to. I love VirtualBox. I needed to activate the WDDM driver so I could test games built on an engine for Windows7 for school. I guess I needed someone to draw me a map Seriously thanks :)

  5. Erik Fritts says:

    OH! and I’m doing it on a Mac so it does work on mac. In fact I updated VB to 4.2.16 r86992 today

    • Jethro Carr says:

      Awesome, glad my instructions were useful for you :-)

      • Jaime says:

        Lazy person here but… any chance you could upload the VBOX image to the internet? Let’s say to mega or similar?

        It’d be very welcomed.

        • Jethro Carr says:

          Sorry mate, that would be a violation of the license of Windows, of Age of Empires and would also expose sensitive information such as my Steam account. So have to say no.

  6. Sahir says:

    Just in case anyone else runs into this issue, if you get a white screen but everything else works you can disable antialiasing in the options to get it to work!

    • nataliofosco says:

      Thanks you Jethro and thank you also Sahir, yours was the final fix :)

    • Jethro Carr says:

      Thanks Sahir -following an upgrade I ran into the same issue, your suggestion fixed it. :-)

    • andreasmb says:

      Thank you Jethro, and thank you Sahir for the final piece of the puzzle!

    • Javier says:

      How can I disable the antialiasing in the options? Do you mean the Age Of empires options? Virtual box options? window options?

      • zeezee says:

        had the same issue, wasted hours researching …until I tried VMware instead. No issue there, no need to fiddle with settings. It just works. Give it a try.

      • roger says:

        to disable anti aliasing (it’s an option in AoE) click on the top right scroll bar -> options)

        Thanks for the good instructions!

  7. sando says:

    Thanks. This work for me on OSX Mountain Lion with Windows 7 guest. One thing I notice is that the mouse scroll on the map does not work sometimes except for when I am laying down a new building. Not sure what would cause this. Any idea?

  8. Gerii says:

    I had it working on my system, but I now updated VirtualBox and the guest additions to 4.3.16 and the game to 3.8 and now the fonts are missing. :( I see them for a second when I start the game but then they vanish. Anyone else having this issue?

    • JaXX says:

      Same here, fonts disappear after a second (everywhere) ever since I install the experimental 3D support… anyways, everything should be fine, but it’s not, and my mac host is only getting 2/3 fps out of it making the game totally unplayable.. Hopefully, it was only 4 euros on black friday…

  9. Sam says:

    Legend! Works for me, thanks.

  10. aerovistae says:

    The video display options are greyed out for me when I try to turn on 3D acceleration in virtualbox. Why is it greyed out??

Leave a Reply