Stardew Valley on OpenBSD and on Raspbian
The last few days I lost a lot of time that could have been spent productively by playing Stardew Valley instead. If you are into gaming, you most likely know about it: It is a modern Harvest Moon, i.e. a farming simulation that also has some dating simulation and (diverging from the normal Harvest Moon formula) even action rpg parts.
My wife and I play it in co-op mode - I run it on OpenBSD, she plays on our main computer, the Raspberry Pi 4 running Linux (Raspbian). I want to use this article to document what I had to do before we could play together. Stardew Valley is, regrettably, a closed-source game, so "just recompile it" was not an option. But at least it has a Linux port that you can get on GOG.
The easy part: OpenBSD
The bad news is: OpenBSD cannot run Linux programs anymore. The support for Linux binaries was removed a few years ago, as no one was interested in doing the necessary work to maintain it. This has the upside of reducing the attack surface on OpenBSD, but it reduces your gaming options even more than on Linux.
The good news: Thanks to folks like Thomas Frohwein (thfr@), there is an easy way to play some modern, closed source games. And it works flawlessly for Stardew Valley.
* Install fnaify(1) * Get the Linux installer from GOG * Use unzip(1) on it to extract the game * cd to the data/noarch/game subdirectory * Execute fnaify there * Start the game by running ./StardewValley
You might have to increase your data limit via "ulimit -d 8000000" or similar - with that number, the game works on my system, but a lower limit will most certainly work too.
You should now be able to play.
Playing on Raspberry Pi
On Raspbian, things are not exactly that simple, as there is no fnaify(1) in the repository. Theoretically speaking, the script should work fine if you prepare all necessary dependencies and create the directory structure it expects. I did not go that route, but instead fixed it manually.
I cannot give you the complete package list that needs to be installed in order to play, as most packages were already installed on my system. Some packages will be obvious, but you will have to find out for yourself.
As a word of warning: I am using the 4GB variant of Raspberry Pi 4. Stardew Valley runs fine, but without swap I cannot even run Firefox at the same time (well, maybe I could if it were not for the many open tabs). The reason for that seems to be, according to the folks who made it playable on the OpenPandora, that Stardew Valley loads all music into RAM at program start. You can use scripts for the OpenPandora that down-sample the music files so that you can run the game with less memory usage. This is most likely the reason you need to use ulimit on OpenBSD. As my systems have enough RAM, I did not try any down-sampling.
I did not try the game with an unzipped installer on Linux. I don't see why it should change anything, but for my system I executed the installer on my desktop pc first and copied the install directory to my Raspberry Pi after that. You will find the game directory from before directly below the install directory.
Stardew Valley is a .Net program, so we will have to install mono first to run it. You can find a version of mono in the default Raspbian repository, but I choose to install the most recent one (currently 18.104.22.168).
sudo apt install apt-transport-https dirmngr gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update sudo apt install mono-runtime
You can try to run the game now via
but you won't have sound and also joining a game hosted on my OpenBSD notebook made the game crash, so we still have work to do.
I fixed the sound issue first by changing the MonoGame.Framework.dll.config to this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <dllmap dll="SDL2.dll" os="osx" target="libSDL2.dylib"/> <dllmap dll="soft_oal.dll" os="osx" target="libopenal.dylib" /> <dllmap dll="SDL2.dll" os="linux" cpu="x86" target="./lib/libSDL2-2.0.so.0"/> <dllmap dll="soft_oal.dll" os="linux" cpu="x86" target="./lib/libopenal.so.1" /> <dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="./lib64/libSDL2-2.0.so.0"/> <dllmap dll="soft_oal.dll" os="linux" cpu="x86-64" target="./lib64/libopenal.so.1" /> <dllmap dll="SDL2.dll" os="linux" cpu="arm" target="/usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0"/> <dllmap dll="soft_oal.dll" os="linux" cpu="arm" target="/usr/lib/arm-linux-gnueabihf/libopenal.so.1" /> </configuration>
The original version contains no definition for Linux on ARM cpus. With that fix, sound was working.
To fix the crashes, I had to make sure that Stardew Valley uses the System assemblies of my mono version. The easiest way to achieve that was to copy them to the game directory:
cp /usr/lib/mono/4.5/System.* .
And this was the last fix that kept us from playing. Happy farming!