Thursday, March 18, 2021

Case study: Diablo II on Raspberry Pi with mod and network support

🕐🕐 Duration: 2 to 3 hours
🔧🔧 Difficulty:Easy to Medium
🌟🌟🌟🌟 Interest: Hours of fun

[Updated May 06, 2021: Working with Box86 and Wine-x86]
[Updated January 03, 2022: Added reference to OpenDiablo2]

Hello,

Are you a geek? Are you born in the 70's, 80's or maybe 90's? Do you like brutish hack'n'slash? Do you like buying a new mouse every 2 months? If this is the case, there is a major chance that you have played Diablo II back in your young days.
And also that you still remember and like that game.

Guess what? Diablo II has been ported to arm. This guy made it.  

If you want to save yourself the trouble, the best way to install Diablo II on wine-arm is to install and use PiKISS.

If you ever want to do the manual route, this excellent guide on reddit will make you able to run it. Note that the link to mesa libraries is in a embedded video which can be annoying while you can just use PiKISS to install them.

So is there more to know?

Wine-arm

This can be a pitfall if you are a Box86 user: Diablo II will run with arm version of Wine, as in the one you will install with:
 
sudo apt-get install wine

If you plan to use Wine-arm and Wine-x86 on the same system, be careful not to destroy your wineprefixes by running with the wrong Wine.

Performance

Gaming performance is awesome. However loading delays can be quite long especially if you are playing with a mod. Don't lose patience if you start a new game or change act.
 
Avoid freezes by keeping a decent voltage supply. This can make you die and will make you lose your character in hardcore mode. 

Recommended purchase

You might want to buy more than one... Get a wireless mouse if you don't already have one: 
US
UK 
Italy 
Spain 

Playing mods

libd2game_sa_arm.exe.so doesn't give a launcher like D2SE.EXE. 
However, you can start the mod if you unpack the whole file in the main directory and start the game typing:
 
LD_LIBRARY_PATH=/home/pi/mesa/lib/arm-linux-gnueabihf LIBGL_DRIVERS_PATH=/home/pi/mesa/lib/arm-linux-gnueabihf/dri/ GBM_DRIVERS_PATH=/home/pi/mesa/lib setarch linux32 -L wine libd2game_sa_arm.exe.so -direct -txt
 
You can also download my helper script and run it from Diablo II directory. 

This has proven to be working with Diablo II Content Update and works in local network multiplayer games as well!  
 

Network play 

 
In order to play multiplayer games you will need both versions to be compatible:
  • If you play stock Diablo II, just run libd2game_sa_arm.exe.so from Pi with the same Diablo II directory content (D2Patch.mpq ...) as on the other computer. You can run Diablo II.exe from the x86 computers.
  • If you play mod, Raspberry will use -direct -txt while x86 computers will use D2SE.exe
  • Anyone can host the game (Raspberry Pi or x86). Be sure to decrease voltage issue risk because it will make you freeze and you might die in hardcore.
Will your love like Diablo II and play it with you in network multiplayer games? Well mine did!
 
 
diablo 2 raspberry pi mod content update
Diablo II content update on Raspberry Pi
with cold plains demon (dead).


 

x86 and Box86

As an update on May 6, 2021, Diablo II works with Wine-x86 and Box86 and provides a good performance. The guide hereafter assumes you have D2SE available on your system.

There are a lot of goodies on this method:
  • You can now play with a clean Diablo II directory and a mod selector like D2SE.exe.
  • You can play Diablo II easier from RetroPie like it was a classic Wine/Box86 launcher app
  • You can also play Diablo II from RetroArch with bash script core and a startx/xserver configuration
There are two downsides, the first being that the network play is slower (but it still works) and the second is that the configuration is a bit tricky.

Configuration
You will first have to fool D2VidTst by editing your registry

    WINEPREFIX=/path/to/X86/wineprefix /home/pi/path/to/X86/wine regedit

Set all the keys hereafter
diablo 2 regedit raspberry pi box86
You will have to set all these manually but you will only have to do it once.


Once all those keys are set in your registry, start D2VidTst.exe
 
    LD_LIBRARY_PATH=/home/pi/path/to/gl4es/lib/ WINEPREFIX=/path/to/X86/wineprefix /home/pi/path/to/X86/wine /path/to/D2VidTst.exe

Fool D2VidTst.exe by skipping the test.

Run D2SE.exe

    LD_LIBRARY_PATH=/home/pi/path/to/gl4es/lib/ WINEPREFIX=/path/to/X86/wineprefix /home/pi/path/to/X86/wine /path/to/D2SE.exe

At the first time you started D2SE.exe, untick window mode and click "Configure Glide".
On the Configure Glide screen set the options:
  • Settings
    • window mode: unticked
    • captured mouse: ticked
    • keep aspect ratio: ticked (although you might want to untick it to stretch to screen)
    • vertical synchronization (VSYNC): ticked
    • fps limit: no
    • static size: no
    • window extras: unticked
    • refresh rate: auto
    • desktop resolution: ticked
  • Renderer
    • texture memory: 16MB
    • buffer-texture-size: 1024x1024
    • 32-bit rendering: ticked
    • texture for videos: ticked
    • bilinear filtering: unticked
    • shader-gamma: ticked
    • no gamma: unticked
    • keep desktop composition: unticked
  • Wrapper-statistics
    • corner for infos: upper left
    • framerate: unticked
    • clock: no
    • texturemass: unticked
  • Extensions
    • tick everything except WGL_ARB_render_texture
  • Do a test to make sure it works then quit
You can then start Diablo II by clicking "Start Plugin" (avoid clicking "Start D2").
Before Diablo II launches make sure to minimize your console window because this method will not bring Diablo II as front task. If you are having trouble with this point you can always configure Diablo II as windowed application.

OpenDiablo2

The future is bright. Brand new project (yet unfinished), OpenDiablo2 is the place to be. When it's compilable on Raspberry Pi, I'll give it a try. Go there.

Conclusion

The arm version of Diablo II is awesome! It works better than some plain linux x86 Wine installations. You can play mods and in local network. 
A recent update made Diablo II playable in Box86. Raspberry Pi users now have the choice, both solutions having their own pros and cons. I personally stick with Wine-arm version because I play in network. However the Box86 version is more than playable and looks much more like the original.

The pi gamer

8 comments:

  1. hello thanks for the wonderful guide. i successfully installed in raspberry pi4 con.retropie diablo 2 with pikiss. I have a problem ... the audio is not working. a question if I wanted to also install wine + bix86 and keep winearm that I installed together with diablo 2 with pikiss how should I do?

    ReplyDelete
    Replies
    1. Hello,
      Sound issues are usually a nightmare on linux and are even worse on a Raspberry Pi.
      What I can give as advice for you is to first check your config.txt to see if your hdmi_group matches your sound output.
      See this link: https://thepigamer.blogspot.com/2021/02/performance-comfort-improving-your.html if you want to read on that opportunity.

      You might also have a problem with your alsa installation/configuration. I would advise you that if config.txt didn't work to try restarting from a pristine Raspbian with good config.txt.

      Other track is:
      - Reinstall alsa/pulseaudio
      - This might also help you: https://retropie.org.uk/forum/post/258547

      As for WineARM + Winex86 + Box86: Both wine can coexist. Winex86 will be installed somewhere on your /home/pi/winex86xxx/bin/wine/. You will have to run Winex86 by typing the full path to the binary and WineARM will run by simply typing wine. Make sure not to run WineARM on Winex86 WINEPREFIX and vice-versa. I can suggest you to check "quality of life script" part at this link to get both working with easeness: https://thepigamer.blogspot.com/2021/01/making-wine-and-box86-work-under.html

      Delete
    2. thanks for the tips. for winearm + wine + box86 i will do a test. for the audio problem of wine instead I noticed that from winecfg in the sound card I have winealsa as driver and I have 3 found audio insert bcm..hdmi, bcm..headphone and default. I chose bcm..hdmi as output. wine audio test works play the beep. but maybe the winealsa driver is wrong? how do you change? in all emulators I have audio and even his desktop. I believe it is a wine configuration problem.

      Delete
    3. From what you say, Exarkuniv's problem on Retropie forum seems the closest(rpi4+Retropie+winearm). It was a kernel problem for him. You might want to try to see if it works on plain Raspbian.
      If so you might want either to recompile kernel on Retropie or try to make the D2SE+box86+winex86 works as it gives good performance on Pi3 and should therefore show more than playable on yout Pi4

      Delete
  2. hi i managed to troubleshoot winarm and now diablo 2 works with audio. now i am trying to install winei386 + box86 along with winarm. i downloaded winei386 and unzipped to a folder in home / pi. if I type winecfg it always starts winarm. if I insert the links of wine, wineboot, winecfg and wineserver of winei386 in usr / local / bin it conflicts with winearm and neither of them works. do you have any suggestions for me?

    ReplyDelete
    Replies
    1. Hello,
      I personally don't bother. I leave winex86 in /home/pi/winex86/ and call it with full path because it's emulated and it's not part of your distro. If you want to follow that path, I made a script /home/pi/winex86.sh in my other blog post so whenever you want to run a box86 game you'll just have to type "winex86.sh somegame.exe" instead of the whole wineprefix thing.

      Otherwise, if you want to have winex86 inside your distro directories you should rather look to put it in /opt/ directory and manage it with "sudo update-alternatives" command.

      Placing winex86 in /usr/bin or /usr/local/bin risks erasing your winearm or risks making winearm pointing to x86 version of wineserver which will make winearm stop working.

      If you erased your winearm a good track to get it back working is getting a package from winehq and replace it in the right directories.

      Also make sure you use the right wineprefix with the right winearch. It can cause headaches if you mess up there for a quite easy to troubleshoot mistake. Still can be an issue if you forgot to be careful to wine/wineprefix.

      Hope it helped!

      Delete
  3. the post you are talking about is this?https://thepigamer.blogspot.com/2021/01/making-wine-and-box86-work-under.html?m=1 thanks

    ReplyDelete
    Replies
    1. Hello,
      The script is available on my other post, not the one RetroPie related:
      https://thepigamer.blogspot.com/2021/01/performance-topic-running-x86-games-on.html

      Delete

Play ET: Legacy on Raspberry Pi [FPS]

🕐🕐 Duration: A few hours 🔧 Difficulty: Easy 🌟🌟🌟🌟 Interest: Hours of fun