Linux

From PZwiki
Jump to: navigation, search
Geographylogo.pngLanguage: English  • français


This article or section may be outdated. Editors are encouraged to update this section with new information.


Contents

PZ version 2.9.00008b

Project Zomboid has been made to run on Linux. However, as Sun's official Java and the Java browser plugin do not come pre-installed, if you do not already then you shall have to download and install Java yourself.

To run the 2.9.00008b version (currently 12/6/13 the newest version) you need to log into your Desura account (see here for explanation: http://www.theindiestone.com/community/viewtopic.php?f=39&t=14215) and download the latest Linux version.

Now you have to edit some files:

Edit: media/lua/OptionScreens/MainOptions.lua

And add on top of the file:

require "ISUI/ISScrollingListBox"

Edit: media/lua/Camping/BuildingObjects/campingCampfire.lua,

media/lua/Camping/BuildingObjects/campingTent.lua and

media/lua/Farming/BuildingObjects/farmingPlot.lua

And add on top of the files:

require "BuildingObjects/ISBuildingObject"

Next edit: media/lua/Reloading/ISReloadUtil.lua

and add on top of the file after require "ISBaseObject":

require "Reloading/ISReloadableMagazine"
require "Reloading/ISSemiAutoWeapon"
require "Reloading/ISShotgunWeapon"

Also you need to rename some files in media/sound:

batswing.ogg - needs to be named -> batSwing.ogg
Bathit.ogg --> bathit.ogg
ambientOutsideDaybirds.ogg --> ambientOutsideDayBirds.ogg

Now you can start the game with the projectzomboid.sh script.

./projectzombied.sh

PZ version 0.1.5d

Project Zomboid has been made to run on Linux. However, as Sun's official Java and the Java browser plugin do not come pre-installed, if you do not already then you shall have to download and install yourself.

Ubuntu

You need to enable the "partner" repository in "Software Sources" and then see the Ubuntu wiki page about Java

Gentoo

There are instructions to run the demo on gentoo box. The demo does not have native libraries distributed with it, so you need to install them manually. You need to add overlay "java-overlay" layman -a java-overlay then emerge -av lwjgl. Create a script in the directory you've extracted the demo having following lines in it:

#!/bin/sh
exec java -Xmx512m -Djava.library.path=/usr/lib/lwjgl-2.7/:/usr/lib/jinput/ -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true \
-Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false -cp .:zombie.jar:lwjgl.jar:lwjgl_util.jar zombie.FrameLoader

Running outside the browser

There are at least two reasons why you would want to play the standalone rather than in-browser. First, Java and Linux don't mix that well and is quite unstable in any browser. Second, there is a focus problem with the game inside a browser currently which does not occur in the standalone version.

At any rate, you need to first login inside a browser to download the game. This only works once you have first logged in with your account and downloaded.

Create a file which has these three lines in it:

#!/bin/sh
DATA=$HOME/.java/deployment/cache/lwjglcache/cloud.projectzomboid.com/ProjectZomboid
java -Djava.library.path=$DATA/natives -cp $DATA/zombie.jar:$DATA/lwjgl.jar:$DATA/lwjgl_util.jar zombie.GameWindow

Call it "projectzomboid" or whatever you want. Make it executable (chmod +x projectzomboid) and run it (./projectzomboid).

Worth noting is that the standalone is currently limited to one resolution only, 1440x900, and is NOT officially supported and does not have auto-update feature in it. You always need to use the browser to update the game.

Alternate Method

I didn't have much success with the above script, so I improvised. First I installed liblwjgl-java. I then copied

cp /usr/share/java/lwjgl{,_util}.jar ./

over top of the included lwjgl files - replacing them. Running was then the simple matter of

java -cp zombie.jar zombie.GameWindow.

I ended up throwing in a -Xms1024m -Xmx1024m as well. Good Luck.

Manual install

First, go here and download java. You want the normal Linux file, NOT the RPM. If you have a 64-bit computer, get the x64 version. You must now extract the file. The easiest way to do this is to take the downloaded file, place it in the home directory, rename it to "java.bin", and open the terminal and type in "bash java.bin". This will install Java.

Now, you need to install the Java plugin. Oracle's installation instructions say thusly, and these instructions work, but only on a 32-bit computer.

This is a problem for those of us who have a 64-bit computer, as the 32-bit plugin path is different from the 64-bit path. Be sure that you downloaded the x64 version if you have a 64 bit computer.

So, once java is installed, pull up the terminal again. cd to your firefox plugin directory, unless you moved it the command will be: cd /usr/lib/mozilla/plugins

Then you need to create a symbolic link to the java plugin. In that same terminal window, now type one of the following depending on the type of computer you have:

If you have a 32-bit computer:

close firefox, then type:

sudo ln -s /home/<username>/<Java installation directory>/lib/i386/libnpjp2.so

Filling in the appropriate blanks. For example, to install, the author of this page wrote:

sudo ln -s /home/peter/jre1.6.0_24/lib/i386/libnpjp2.so

Be sure to check your installation directory, it will change depending on the version of java you have.

If you have a 64-bit computer:

close firefox, then type:

sudo ln -s /home/<username>/<Java installation directory>/lib/amd64/libnpjp2.so

Filling in the appropriate blanks. For example, to install, the author of this page wrote:

sudo ln -s /home/peter/jre1.6.0_24/lib/amd64/libnpjp2.so

Be sure to check your installation directory, it will change depending on the version of java you have.

To Double Check

Then, open a file explorer window, and go to usr/lib/mozilla/plugins, and be sure that the link is in the proper place. If it is, you should be all set. Head off to the website. If it isn't, delete it. You may need to use the terminal to do so, the command will be: sudo rm <filepath> Then check your steps and try again. If you continue to have trouble, go to the forums and send a pm to rdsqc22. Also try google.

PZ version 0.2.0x

Tested on 0.2.0q

See this thread at the developer's forum.

Method 1

The method is essentially the same as method 2 for running on Macs, with the only difference being in step 4.

Kawo wrote: 1. Download latest PZ pre-version (http://theindiestone.com/community/viewforum.php?f=21), unrar wherever you want.

2. Download lwjgl library (http://sourceforge.net/projects/java-game-lib/files/Official%20Releases/LWJGL%202.8.3/) and unzip it.

3. In lwjgl-xxx/jar, copy "lwjgl.jar" and "lwjgl_util.jar" and paste them in PZ directory (eg. zomboid020 folder).

4. In "lwjgl-xxx/native/linux, copy all 3 files and paste them in PZ directory again

5. Open your favorite text editor (TextEdit will be fine) and copy/paste ONE of the following code:

For High preset:

#!/bin/bash
PWD=`dirname "${0}"`
java -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Xms1024m -Xmx1024m -Dsun.java2d.opengl=false -
Dsun.java2d.pmoffscreen=false -Djava.net.preferIPv4Stack=true -Djava.security.policy=applet.policy -XX:+AggressiveOpts -
XX:+ScavengeBeforeFullGC -XX:+TieredCompilation -XX:Tier2CompileThreshold=30000 -XX:CompileThreshold=1500 -XX:+UnlockExperimentalVMOptions -
XX:+UseG1GC -XX:MaxGCPauseMillis=3 -XX:+UseAdaptiveSizePolicy -Dorg.lwjgl.util.NoChecks=true -Djava.library.path="${PWD}" -cp 
"lwjgl.jar:lwjgl_util.jar:minlog-1.2.jar:reflectasm-1.01.jar:asm-3.3.1.jar:./" zombie.FrameLoader

For Medium preset:

#!/bin/bash
PWD=`dirname "${0}"`
java -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Xms1024m -Xmx1024m -Dsun.java2d.opengl=false -
Dsun.java2d.pmoffscreen=false -Djava.net.preferIPv4Stack=true -Dgraphiclevel=3 -Djava.security.policy=applet.policy -XX:+AggressiveOpts -
XX:+ScavengeBeforeFullGC -XX:+TieredCompilation -XX:Tier2CompileThreshold=30000 -XX:CompileThreshold=1500 -XX:+UnlockExperimentalVMOptions -
XX:+UseG1GC -XX:MaxGCPauseMillis=3 -XX:+UseAdaptiveSizePolicy -Dorg.lwjgl.util.NoChecks=true -Djava.library.path="${PWD}" -cp 
"lwjgl.jar:lwjgl_util.jar:minlog-1.2.jar:reflectasm-1.01.jar:asm-3.3.1.jar:./" zombie.FrameLoader

For Low preset:

#!/bin/bash
PWD=`dirname "${0}"`
java -Dgraphiclevel=0 -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -
Dsun.java2d.pmoffscreen=false -Djava.net.preferIPv4Stack=true -Djava.security.policy=applet.policy -XX:+AggressiveOpts -
XX:+ScavengeBeforeFullGC -XX:+TieredCompilation -XX:Tier2CompileThreshold=30000 -XX:CompileThreshold=1500 -XX:+UnlockExperimentalVMOptions -
XX:+UseG1GC -XX:MaxGCPauseMillis=3 -XX:+UseAdaptiveSizePolicy -Dorg.lwjgl.util.NoChecks=true -Djava.library.path="${PWD}" -
Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Xms1024m -Xmx1024m -Dsun.java2d.opengl=false -
Dsun.java2d.pmoffscreen=false -Djava.net.preferIPv4Stack=true -Djava.security.policy=applet.policy -cp "lwjgl.jar:lwjgl_util.jar:minlog-
1.2.jar:reflectasm-1.01.jar:kryonet-1.04.jar:kryo-1.04.jar:asm-3.3.1.jar:./" zombie.FrameLoader

6. Save this file, in plain text, inside your PZ directory with ".sh" extension (eg. "launch_high.sh").

7. Open Terminal.app and navigate to PZ folder:

cd path/to/pz/folder

8. Then launch the script:

bash launch_high.sh

You will have a black screen for some seconds (30sec average) but it's ok.


Notes: This tutorial makes you download the latest lwjgl library (2.8.3), but you can download the version of your choice. Just make sure to follow steps 3 and 4. It's critical. If you want to match the lwjgl version shipped with PZ 0.2.x, you can download 2.8.2 version.


Method 2

1. Install OpenJDK if you don't have it already. Might also work with Oracle/Sun JVM, haven't tested.

2. The PZ package doesn't include the LWJGL natives. Get the LWJGL package from lwjgl.org or Sourceforge, and extract the natives (the .so files under native/linux dir) somewhere, for example in the PZ directory.

3. Download this example .sh file and put it into your PZ directory.

4. Adapt the -Djava.library.path parameter of the example .sh (near the bottom) to match the location you extracted the natives to.

5. Make the script executable (chmod u+x zomboid.sh).

6. Run the script (./zomboid.sh).