Thursday, April 19, 2012

Running multiple instances of D2 under linux (ubuntu with wine)

Ubuntu/wine and D2 are a dream team. In fact, this runs so well that its worth installing ubuntu besides windows just for this. What you get is:
  • running multiple instances of d2 in their own window

  • no problems with minimizing windows, easy on resources, it is fast!

  • no problem running other programs beside d2 and keeping an eye on everything

  • you don't change the D2 programm at all, so i would dare say that blizzard has nothing against this.



Preparations:
  • You need a full installation of d2 for every instance you want to run. I would recommend registering on new b.net, adding your cd keys and downloading the d2 and lod installers from there.

  • If you run windows and linux, you should make a partition on the harddisk just for programs that you want to use in windows and linux unchanged. In my installation, i have assigned the drive letter L: to this partition.

  • In windows, and for every instance, install d2 and lod to drive L:, rename the program directory and install the next instance. i use program directories named d2a, d2b, d2c. because of this my d2 installations are in L : \programme\d2a etc.

  • D2 is in fact a portable application. So you can run the same installation from windows and from linux .



How it works:
  • Wine simulates a windows environment under linux. This is not well known, but Linux with wine can run a lot of windows programs with no problems, just by starting the program.

  • In wine, the windows "installation" resides in ~/.wine by default. If you copy this directory, e.g. to .wine-d2a, you can run a program in a seperate "windows-installation" by setting the environment variable with ''export WINEPREFIX=$HOME/.wine-d2a''

  • Its best to create small script file which sets the environment variable and launches d2 with the right command line switches (-skiptobnet and -w)



How to do it:
  • prepare your d2 installations in windows. it's possible to do it under linux/wine, but if you have windows installed, i would do it there.

  • make copies of your .wine directory. if you have not installed wine, install it using synaptic.


    Code:
    cd $HOME
    cp -a .wine .wine-d2a
    cp -a .wine .wine-d2b
    #and so on


  • once you have your installations ready, copy the script code below into a text editor, adapt it and save it in ~/bin as d2a, d2b, etc. Mark the scripts as executable (chmod +x ~/bin/d2*).


    Code:
    #!/bin/sh
    export WINEPREFIX=$HOME/.wine-d2a
    winecfg
    cd /mnt/drive_l/Programme/d2a
    wine "/mnt/drive_l/Programme/d2a/Diablo II.exe" -skipbnet -w




The script will first configure the .wine-d2a directory. You can comment winecfg out by adding a # at the beginning of the line once your are done. When winecfg starts, got to the Graphics settings and:
  • Uncheck "Allow Directx Apps to stop the mouse leaving their window"

  • Check "Allow the window manager to decorate the windows"

  • Check "Allow the window manager to control the windows"

  • Check "Emulate a virtual desktop"

  • Check "Allow Pixel Shader"



You should enable the "virtual desktop" option. Otherwise, d2 will seem to freeze when it looses focus (d2 considers itself minimized).|||Very interesting!

I have several computers with D2 LoD on them (all Ubuntu 8.10 and 9.04, of course... never again will Window$ taint the purity of my home LAN ) and I can mule reasonably effectively anyway, but I might just give these instructions a try!

One comment, you may have to mark your shell script with the "executable" flag to ensure that it runs properly.

Anyway, keep up the good work with Ubuntu... the O/S that says to Bill and Steve, "you history, man".

Cheers

Mr. Bill|||Thanks for the advice, I'm going to give it a try, I'm already playing LOD in ubuntu/wine, I'll have to give this a try, I have a spare cd key.|||Ok I'm lost, I'm running strictly Ubuntu, not dual boot, and I can't seem to figure out how to get diablo installed into the d2a version. Unfortunately I'm not very smart with linux, any detailed help would be great.|||Quote:








Ok I'm lost, I'm running strictly Ubuntu, not dual boot, and I can't seem to figure out how to get diablo installed into the d2a version. Unfortunately I'm not very smart with linux, any detailed help would be great.




I assume that you are already running diablo with your first cd key. So one copy if d2 is installed in your .wine directory.

To get two installions of d2 in .wine and .wine-d2a open a terminal window and do this:


Code:
export WINEPREFIX=$HOME/.wine-d2a
winecfg
wine /cdrom/install.exe

After this, you should have a working installation of d2 in .wine-d2a|||I must say this is really cool, and I'm very tempted to put ubuntu on my lenovo to try it out. I'm slightly worried about getting my wireless to work and the video drivers to work correctly, particularly for the switchable graphics the notebook has.

This is a great guide though, thank you for posting it.|||Quote:








I must say this is really cool, and I'm very tempted to put ubuntu on my lenovo to try it out. I'm slightly worried about getting my wireless to work and the video drivers to work correctly, particularly for the switchable graphics the notebook has.

This is a great guide though, thank you for posting it.




I'm glad you find the guide useful

I run ubuntu 9.04 on a lenovo x300, works like a charm, out of the box. There were some issues with the Intel graphics drivers and suspend/restore, but i have never run into these. Definitely worth a try!|||Quote:








Very interesting!

One comment, you may have to mark your shell script with the "executable" flag to ensure that it runs properly.




Thanks for the feedback, i have added the chmod +x it to the instructions. Its so nice to turn away from windows, and find that you can still use most programs for which you have not found the replacement.|||Thanks dyolf, I'll give that a try.|||Sorry to take it OT here a bit, but from everything I've read there's one reason I shouldn't make the switch to ubuntu. Battery life. From all the people I've seen switch to ubuntu they went from 4 hours on their T400 (my model) to roughly 1.5 with the same 6 cell battery.

Did you have any battery discrepancies on your x200?

No comments:

Post a Comment