Sunday, November 4

Setting up Battlefield 2

No, this is not a screen capture from me.

Note: Adjusting the winecfg settings will alter your game play with other games through Wine. Please be aware of the changed settings so you can revert back to normal when attempting to play other games. This guide was compiled using Wine version 0.9.44.

I typically wouldn't post a guide to installing a game that doesn't completely work, but this has been a sort of 'side-project' for me and I believe the information can be useful to others.

Battlefield 2 does run on Linux. However, there are some texture, resolution, and other miscellaneous issues that have proven a bit more difficult to tackle than they were for Steam. My current configuration runs the game in single player at nearly maximum video settings in 800x600 windowed resolution. The textures show some jaggies, but the problem from Off Screen Rendering has been solved (no fps slowdown on goz when enabled). There are several other things that need to be tested (online multiplayer, patching, etc), but I have not gotten around to it. Knowing this, here's a guide to get to the point where I am:

To start the install, I inserted my original Battlefield 2 disk into my cd drive. The disk was automatically detected but didn't run the autoplay.exe. I double clicked on it and the game began to install. When I was prompted to insert another disk, I clicked on an open terminal and typed in:

>wine eject

This ejects the CD via Wine so the installer knows the disk has been removed. I used this method to finish installing the rest of the disks. At the end of the install, the session actually froze up. I ended up using ps aux to find and kill the installation. The game had already been installed so killing it did not make a difference.

Next I grabbed some Windows libraries for Direct 3d. The drivers I need were d3dx9_24.dll and d3dx9_25.dll. After a quick google search, I downloaded them from here and here. I navigated to my download directory and promptly unzipped and moved the files to the correct directory for Wine:



>mv d3dx9_24.dll d3dx9_25.dll ~/.wine/drive_c/windows/system32

Now the game would load, but I ran into several problems. The game would only load if I opened it with a Virtual Desktop in Wine. Also, the in game graphics would reflect the sky on the ground. This gave me a very disorienting experience and made it pretty difficult to play. To address some of these problems, I looked over the wine app database . Eventually I found that there is a quick fix for the sky problem. In a nutshell, Battlefield 2 uses both on screen and off screen rendering modes that are incapable of being emulated by Wine. To overcome this,I had to tell Wine to do both at the same time (At least this is my understanding of the problem). To do this, I had to edit the registry:


Then I navigated to HKEY_CurrentUser>Software>Wine>Direct3D. Now I had to add a new string to enable Off screen rendering. I right clicked New>String and entered:


To set the value, I right clicked on OffscreenRenderingMode and clicked Modify. For Value Data, I put in:


I clicked OK and exited the registry editor. Next I had to tell Wine that I wanted it to emulate a Virtual Desktop. I went pulled up a terminal and went to my wine config:


Next I selected the tab Graphics and clicked on "Emulate a virtual desktop". I have tried many different resolutions, but what seems to work the best (because of cropping from toolbar at the top and bottom of GNOME) was 800x600. This is probably something you will need to play around with to get your settings to work properly. I clicked OK and closed the configuration.

After running the game for a bit it was very apparent that there is an issue with the mouse. Now it was a problem at first but , after looking at the solution to the problem, I decided I could just live with it for now.

The graphical issues in Battlefield 2 were somewhat similar to setting up Steam. The game would not let me change any of the video settings in game so I had to manually change them in the configuration:

>cd ~/Battlefield\ 2/Profiles

I had already setup my user name and password so I went changed to the settings for my username (If you have not setup your user name, you will have to change the video settings in the Default directory):

>cd 0001

Now I had to change the video settings so the graphics would look more like they should from an nVidia 8600GT:

>vim Video.con

I changed every "quality" setting to 3. I also changed the resolution to 800x600 to reflect my resolution in virtual desktop.

Now I had all the settings adjusted to where they seemed to work best. I created a new Launcher on my Desktop. For the launch command, I used:

>env WINEPREFIX="/home/foo/.wine" wine "C:\Program Files\EA GAMES\Battlefield 2\BF2.exe" +menu 1 +restart +fullscreen 1 +szx 800 +szy 600

Where 'foo' is the name of the directory I used for Wine (In most cases, this is your login name). The setting +restart skips the long intro and goes directly to the game while +fullscreen 1 sets the game to be opened in full screen mode. The option +menu 1 seems to be a necessary launch option even though it doesn't seem to do anything useful for the game.

This is as far as I went in playing around with settings. There are tons of resources on glitches here as well as the graphics problem. If you happen to come up with an alternative to this setup that works better or corrects errors, please post them. I will update this as the game configuration becomes cleaner/more efficient.

1 comment:

mythtvonxbox said...

Hi, Trying this myself. I can run BF2 just fine but I get the wacky sky / texture / graphics problem.

I'm trying to edit the registry but I'm getting conflicting instructions from different places.

Here you say edit the registry string in the following:


However, shows that the registry value that needs changed is in:


I have tried both and neither work for me. When I try either of them, Battlefield will start up then freeze up after about two seconds into "EA Games, Challenge Everything"

Which sub-folders does the registry value need to be in? Have you come across the problem of BF2 freezing after these values are changed?