The Age of Wonders II on Linux HOWTO

Christopher Corkum - hacker(at)nbnet.nb.ca

V0.01 2004-08-10
A collection of workarounds that will allow Age of Wonders II: The Wizard's Throne to be played under Linux with help from TransGaming's Cedega. Not for the faint-of-heart, this process involves some steps that are inelegant and downright UGLY - but they do work.

1. Introduction

2. Updates

3. Overview

4. What is needed

5. Installation - The First Hurdle

6. Getting AoW2 Running - The Second Hurdle

7. Taking Control - The Third (and hopefully final) Hurdle

8. Concluding Remarks

9. Getting Help

10. Questions and Answers

11. Bits and Pieces

12. Credits

13. Disclaimer

14. Copyright


1. Introduction

Following in the footsteps of classics such as Master of Magic and Heroes of Might & Magic, Age of Wonders II: The Wizard's Throne is arguably one of the best turn-based strategy games ever released. Unfortunately, the game has so far resisted all efforts to make it playable in any OS but Windows, leaving those of us who prefer alternative OSes with the option of either rebooting or doing without - until now. After much trial, error, dumb luck, late nights, and caffeinated beverages, I have finally figured out a way to get AoW2 playable in Linux, with a little bit of help from TransGaming's Cedega. It's not trivial, it's not pretty - heck, it's UGLY - but it works, and here's how it can be done.

2. Updates

August 10, 2004 - Initial Release

3. Overview

Getting AoW2 working under Linux has been quite an interesting challenge. Several hurdles had to be crossed in order to get the game to a playable state, each one being a distinct issue that had to be handled separately. And as much as I'd like to take credit for solving these problems, I can't. What I'm about to show you is at best a collection of kludgy workarounds, rather than being an elegant solution. Also, some of this I happened upon not by any skill, but by pure dumb luck. I don't expect any of this to be considered a proper long-term solution, but I am hoping that it will give enough insight into the issues so that TransGaming can more easily create proper fixes for problems, and will allow us to actually play the game in the meantime.

4. What is needed

In order to play Age of Wonders II in Linux, you will need a few things. For starters, you'll need a copy of Age of Wonders II itself. If you don't own the game but want to try it, there is a demo available at http://aow2.godgames.com/aow2/demo_download.html, though I don't know if the demo will work with this procedure or not - I haven't tried yet. Next, you'll need a copy of Cedega (formerly known as WineX) which you can get via a subscription from TransGaming at transgaming.com - it's not free, but it is worth the money. You'll also need a computer running Linux, and have Cedega properly installed and running on it. Finally, you will need either access to a computer running Windows, or have some other means of getting a few native Windows DLLs, as some of these steps will require a couple of these files.

Also note that these instructions assume that you are running Cedega via the command-line. So far, I haven't yet worked out how to do some of these steps when running Cedega via Point2Play, but once I have the process figured out, I will update this document with the information.

One final thing - for safety's sake, you should modify your Cedega config file so that it will run programs in a desktop window rather than go to fullscreen. Load the config file ( /.transgaming/config) in an editor, scroll down to the section headed [x11drv] and remove the ";" at the start of the line that reads "Desktop" = "800x600", optionally changing the "800x600" to something else if you wish. This will make the adjustments for the final step a little easier, and will also make killing Cedega much easier if something goes wrong and the game freezes.

5. Installation - The First Hurdle

"Cannot open AVI" - that's the error message that comes up when the AoW2 installation program is run under Cedega, just as it seems as though the game is going to install. The problem is that the installer uses the 'animated file copy' routines from Windows that display an animation and a progress meter while copying files, and only the native version of the appropriate DLL supports this. In order to get this working properly, you need to get a copy of shell32.dll from a Windows PC (I used the one from Win2K). There are two ways to get Cedega to load the native version of the DLL - the proper way which is a little involved, and a second way which takes advantage of an (I believe) undocumented feature in order to greatly simplify the process.

To get Cedega to use the shell32.dll the proper way, you need to copy the DLL into the proper directory in Cedega's virtual Windows drive, and then modify the configuration files so that Cedega will load the native DLL rather than use it's own built-in version. Copy the dll file to  /.transgaming/c_drive/windows/system32/ - this is where Cedega will look for it. Load the config file ( /.transgaming/config) in your favourite text editor and scroll down to the [DllOverrides] section. Now find the line that reads

"shell32" = "builtin, native"

and change it so that it reads:

"shell32" = "native, builtin"

After you have this done, you will be able to continue with the install process, documented below.

If you'd rather not mess with the configuration files, there is an easier way. An undocumented feature of Cedega is the fact that, if there are any DLLs in the directory from which the program is run, Cedega will use these DLLs in preference to any other built-in or native DLLs elsewhere, regardless of the settings in the configuration file. So to get Cedega to use the native shell32.dll, all that needs to be done is to run Cedega from a directory containing the dll - make a new directory, copy the dll to it, cd into the directory, and then run the installer.

Once you have Cedega set up to use the native shell32.dll, you can install the game. Insert and mount the AoW2 CD, and then start the installer by running "cedega /mnt/cdrom/aow2installer.exe" from the command line. Now that the native dll is in place, with support for the animated file copy routines, the installer should be able to run properly. It's still not perfect - at the end of the process there will be an odd 'external exception' error, after which you have to hit 'cancel' and apparently cancel the installation, but the game DOES get properly installed.

After installing the game, you will probably want to install the newest patch. The current patch is available at http://aow2.godgames.com/aow2/files.html, and it can be installed the exact same way as the game itself. Like the game's installer, the patch installer also needs the animated file copy routines, so if you get the old 'Cannot open AVI' error, make sure you still have Cedega set up to use the native shell32.dll.

Finally, after you have the installed and patched, make sure you undo whatever it was you did to enable the use of the native dll. Either remove the file from Cedega's /windows/system32/ directory and change the config file back the way it was before, or, if you used the 'easy' way, move the DLL somewhere out of the way where Cedega won't accidentally pick it up. If you don't do this, you will have a LOT of problems with other games - most installers won't work at all with the native shell32.dll.

6. Getting AoW2 Running - The Second Hurdle

If you have ever tried to run AoW2 with Cedega, and only got a black screen with a mouse cursor and a grey textured bar along the bottom of the screen, you've hit the second hurdle. After some investigation and a lot of dumb luck, I discovered that the cause of this is something related to a couple of functions in the Cedega built-in version of one of the DirectPlay DLLs. It's not that the game needs a working copy of the dll to function - just that if these functions are run, it somehow messes the program up and keeps it from running properly, resulting in the black. What is needed is a way to keep Cedega from loading and using a dpnet.dll at all.

The simplest way that I've found to keep Cedega from loading dpnet.dll is to create a fake one, and then set things up so that Cedega will try to use it. It doesn't matter what you use as the file, as long as it's not a real DLL, so just create a text file and name it dpnet.dll. As with the shell32.dll for the installation, there are two ways you can Cedega to use the file rather than its built-in version. Either place the fake dll in  /.transgaming/c_drive/windows/system32/ and modify the config file, or simply put the file in the directory from which you are going to run the game from, which in this case is in the same directory as the game executable itself.

Once this fake dll is in place, run the game with Cedega. The game will try to load the dpnet.dll and fail, and not call the functions that were causing the issue. If everything was done properly, the game should load up, and display the main menu. We are almost there!

7. Taking Control - The Third (and hopefully final) Hurdle

After AoW2 loads up to the main menu, you will most likely quickly discover that, though the game appears to be running, there is no way to get the program to respond to mouse input. Either the game doesn't respond to mouse clicks, or the mouse cursor doesn't move at all. This is the third hurdle, the last that must be crossed before the game can be played.

Over the course of many tests, I discovered that this problem doesn't always happen, that occasionally the mouse cursor will respond. Sometimes it would just move a little bit, on other occasions I would be able to navigate through the game a bit, and on a couple tries, actually managed to get into the game itself. After much experimenting, I finally discovered that the cursor was only responding when the game wasn't actually running, when something was causing the program or the system to stutter or pause. When things were running smoothly however, no input would go through to the game at all.

Initially, I found that pausing the execution of the game (by hitting control-z in the terminal from which it was run), clicking in the game window, and then resuming the game (by running 'fg' in the same terminal) would always allow those mouse clicks to go through and be processed by the game. This allowed me to navigate through the menus a bit, but was obviously not a practical way to play the game. After a bit more playing around though, I discovered a little trick to making the program stutter just enough to make it possible to play the game without slowing things down too drastically. Remember that ugly kludge I mentioned up in the intro? Well, here it comes.

In order to run AoW2 so that it will respond to mouse input, run this command from the game's directory:

cedega AoW2.exe -debugmsg +dsound

This will cause a steady stream of debugging data to be printed to the console from which you have run the program. This constant scrolling display should give the game the slowdown it needs in order to start receiving input from the mouse. It's very possible it might not work right away - if not, you'll need to increase the load on the system a bit more for a few moments. Switch from the game back to the console window with the mouse (don't use alt-tab - you might make the game try to minimize itself, which can't be recovered from without restarting), and resize it a couple times while it's scrolling like mad. Switch back to the game window (again with the mouse) while the extra load is still present, and see if the menu items respond to having the cursor passed over them. If not, try again until it works - the key seems to be to send the game mouse movement events while the system is under stress. Once the menu items start responding to the mouse cursor, you should be able to navigate though the menus and start playing. When the game is responding to input, you probably don't need to slow it down as much anymore (possibly not at all actually - still working on this). You should be able to minimize the terminal console that you ran the game from, hiding the scrolling and keeping it from slowing down the system. If the mouse stops responding (it seems to for me when certain events happen), just go through the above procedure again to let the game reacquire it.

That's it - we're done - go play!

8. Concluding Remarks

I warned you it was ugly!

As I said before though, I don't expect any of this to be considered a proper long-term solution. At best, my work here will give enough insight into the issues so that TransGaming can track down and fix the problems properly, while also allowing us to actually play the game for the time being.

9. Getting Help

This whole document has been about my trying to fix the problems that I discovered while working at getting AoW2 running on my own computer. But I'm only a single person working on a single system - no doubt there are more potential issues here than the ones I managed to find myself. If you try this out, and run into any problems not mentioned here already, I would appreciate hearing about them so I can try to help out and hopefully document a solution to the issue. I'm often hanging out as 'pacula' in #cedega on freenode.net on IRC, and also frequent the Cedega forums at http://transgaming.org/forum/index.php, also as 'pacula'. You can also get in contact with me via email at hacker(at)nbnet.nb.ca or hacker(at)sweetleafstudios.com.

10. Questions and Answers

Nothing yet - ask me some!

11. Bits and Pieces

None yet

12. Credits

Thanks go out to:

13. Disclaimer

Use the information in this document at your own risk. I disavow any potential liability for the contents of this document. Use of the concepts, examples, and/or other content of this document is entirely at your own risk.

All copyrights are owned by their owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.

Naming of particular products or brands should not be seen as endorsements - except for Cedega and Age of Wonders II - they both rock!

14. Copyright

Copyright © 2004-08-08 by Christopher Corkum. You are free:

Under the following conditions:

For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the author.