Archive for January, 2016

Windows Unity-Games on Linux

Wednesday, January 13th, 2016

The fact is, beginning with Unity 4, just about all games run on Linux as well. Unless they’re buggy, explicitly check for the platform or use plugins not available on Linux.

I found this Howto in Russian on how to fix an incomplete Unity runtime so it runs on Linux, could reproduce the effects, and so here’s the writeup in English on how it’s done.

This is how the minimal Unity-runtime for Linux looks:

├── player_Data
│   ├── Mono
│   │   ├── etc
│   │   ├── x86
│   │   │   └── libmono.so
│   │   └── x86_64
│   │   . └── libmono.so
│   ├── Plugins
│   │   ├── x86
│   │   │   └── ScreenSelector.so
│   │   └── x86_64
│   │   . └── ScreenSelector.so
├── player.x86
└── player.x86_64

The word “player” is replaced by the actual name of the game. Note that these files are the same for every game that uses the same Unity version.

Find Version

Within the existing player_Data directory, you’ll find a file named mainData. This contains the Unity version, and you will need to add the correct version of the Linux runtime, so you’ll first need to extract that version:

head mainData | strings | head -1

if this doesn’t get you the version, the game uses a very old Unity, which has the version information towards the end of the file, but for which no Linux support exists anyway.

Get runtime

Now you need to find the correct runtime. You can check mainData of Unity games supported on Linux, and copy the respective files over. Something like this:

find . -name mainData -print0 | xargs --null grep --with-filename "4.5.5f1"

of course, some people already have collections of runtimes, like this: https://cloud.mail.ru/public/6SdA/BBgyg3kjy

if the runtime you need isn’t available on your system, you can extract it from the official releases with 7z. The not-so-nice part is, every release comes as a huge .exe with a size of 1GB or more. And there are a lot of releases:

The useful files within the extracted release are below linuxstandalonesupport/Variations/ you’ll need the files libmono.so, ScreenSelector.so and LinuxPlayer per 32bit/64bit environment.

Find Plugins

After you have all the files from the runtime in the right places, and have renamed them accordingly, you might have noticed, that there are some dll-files in the Plugins directory. You’ll need to add Linux versions for most of these.

Luckily, there are some very well known plugins, they are used all over the place, and some come with the source as well:

The .unitypackage-files can be extracted with tar xvaf, but they consist of a salad of directories. file */asset can tell you what is what, the corresponding filenames are in */pathname.

Fix .unitypackage files

The .unitypackage-files a lot of plugins are delivered in can be extracted with tar xvaf, but they consist of a salad of directories. file */asset can tell you what is what, the corresponding filenames are in */pathname.

This here makes a directory tree from the pathname files:
for i in *; do mkdir -p `dirname $(head -1 $i/pathname)` ; done
And this here moves the assets into it and renames them:
for i in *; do mv $i/asset $(head -1 $i/pathname) ; done

Cosmetics

You now can do some cosmetics. Fix the ScreenSelector background:
convert ScreenSelector.bmp ScreenSelector.png
And the Icon:
wrestool -x --type=14 Game.exe | convert ico:-[6] Game_Data/Resources/UnityPlayer.png

Testing

Start the game with a logfile parameter to get warnings about missing libraries and other problems:
player.x86 -logfile out.log
As mentioned before, “player” needs to be replaced with the actual name of the game, and the binaries named accordingly.

Results

I basically went over my whole collection of not-yet-available for Linux Unity games I have on steam. I annotated the runtime version and troubles they might have.

Working Games

  • 1954 Alcatraz (4.0.1f2)
  • Coldfire Keep (4.3.4f1)
  • Dead Bits (4.1.3f3)
  • DeadEffect (4.6.0f3)
  • Depths of Fear Knossos (4.6.1f1)
  • Final Dusk (4.6.1f1)
  • Gravi (4.5.5f1)
  • Huntsman The Orphanage (4.2.2f1 needs LD_LIBRARY_PATH for libsteam.api.so)
  • Last Inua (4.2.2f1)
  • Lifeless Planet (4.6.7f1)
  • Once Bitten, Twice Dead! (4.6.1f1)
  • Overcast – Walden and the Werewolf (4.1.3f3)
  • PaperSorcerer (4.1.5f1)
  • Red Lake (4.3.4f1)
  • StickItToTheMan (4.3.2f1)
  • The Dead Linger (4.6.0b20 Some black textures)
  • The Hat Man Shadow Ward (4.3.4f1)
  • Train Town (4.5.0f6)
  • Urja (4.5.4f1)
  • YearWalk (4.5.5f1)

Games Having Trouble

Most of these run, but are also unplayable. Some are playable, but not enjoyable because of missing textures or missing sound.

  • Air Buccaneer (4.2.0f4 can’t connect to network?)
  • BridgeProject (4.5.3f3 x86 crashes, x86_64 does not accept input)
  • Dead Island Epidemic (4.6.1f1 libs missing, among them http://www.squaretangle.com/FMODUnity.html)
  • Deus Ex The Fall (4.3.4f1 needs LD_LIBRARY_PATH for libsteam.api.so; Wwise sound engine wrong version, playable)
  • Empyrion – Galactic Survival (5.2.3f1 hanging?)
  • Joe Dever’s Lone Wolf (4.5.4f1 self-written plugins)
  • Melissa K and the Heart of Gold (4.5.3f3 hanging?)
  • Might & Magic X – Legacy (4.2.2f1 hanging?)
  • realMyst Masterpiece Edition (4.5.5p4 broken menu, needs uWebKit)
  • Slender – The Arrival (4.5.1p3 Texture problems, playable)

Shader Problems

The following games all have shader problems. Which basically means you would need to decompile Managed/Assembly-CSharp.dll and replace the shaders to use there, or to extract the .asset-files and create them anew. Some of these games are playable as they are, but certain things will show up pink.

  • Astral Terra (5.1.2f1 Shader Problems)
  • Avenging Angel (5.1.0f3 Shader problems)
  • Godus Wars (5.2.2f1 Shader problems)
  • GunsNZombies (5.2.2f1 Shader problems, crashes)
  • Reign Of Kings (5.1.1p2 Shader problems, needs LD_LIBRARY_PATH for libsteam.api.so)
  • StarForge (4.5.5f1 Shader problems, needs LD_LIBRARY_PATH for libsteam.api.so)
  • The Forest (5.1.3p3 Shader problems)
  • The Tower (5.1.2f1 Shader problems)
  • Treeker – The Lost Glasses (5.1.2f1 Shader problems, playable)

Broken on Purpose

  • BlockStory (4.6.8f1 Steam-Error: “Not available on your current platform”)
  • Magnetic Cage Closed (4.3.4f1 Steam-Error: “Not available on your current platform”)
  • Republique (5.2.2p4 Steam-Error: “Not available on your current platform”)
  • Stranded Deep (5.2.2f1 Steam-Error: “Not available on your current platform”)
  • Subnautica (5.2.3f1 Steam-Error: “Not available on your current platform”)

Unsupported

  • Blackguards (3.5.6f4)
  • Cognition (3.5.7f6)
  • Commander Jack (3.5.7f6)
  • creavures (3.4.2f2)
  • Dementium 2 (3.5.7f6)
  • Dungeonland (3.5.6f4)
  • DysanTheShapeshifter (3.4.2f2)
  • Seamulator 2009 (2.1.0f5)
  • ShadO (3.5.2f2)
  • Shelter (3.5.7f6)
  • Theatre Of The Absurd (3.5.0f5)
  • Them – The Summoning (3.4.2f2)
  • The Witcher Enhanced Edition (3.5.2f2)
  • Truffle Saga (3.5.7f6)
  • UnearthedEpisode1 (3.5.7b1)