[HOWTO] Optimize Minecraft for Linux
First off, I would like to say that Minecraft was not created for Linux or Mac. It was developed on Windows for Windows. It just so happens that an App and Jar were developed for we Unix users. Because of this afterthought-appropriation, there are a few performance issues inherent with these ports. I have done a lot of research to improve my person gameplay experience, and I believe you could all benefit from it as I have.
You will need a few things to ensure Minecraft runs smoothly.
1) Sun Java - Latest JRE
This is important, as a lot of Linux distros are shipping with OpenJDK's JRE. This is fine in most situtations, but it actually seems to make Minecraft slower. Sun's JRE is a bit better as far as speed goes.
How to Install Sun Java on Linux
2) The latest drivers for your graphics card
It should be noted that Linux uses graphics drivers just like Windows. The main difference is how they're installed. Linux is pretty great at automatically detecting and using almost any device you plug into it. However, some mainstream brands have dropped linux support, an example being ATI. They have unfortunately stopped supporting several cards with Linux drivers. You can still download their latest Catalyst Control Center and generic driver, but there are LOTS of compatability issues with the cards they've stopped officially supporting. Here are some resources to help you out:
Open-source ATI/Nvidia Drivers (This is pretty much the best for ATI. R200 cards can use the ATI official driver)
Or for non-legacy ATI/AMD you can try their drivers first rather than bleeding-edge open source:
http://support.amd.c... ... linux.aspx
Following on from what misuisum says, there is also an issue with keys sticking under Linux, you can resolve this and his issue (distro agnostic):
Newer 2.7 libraries here:
http://sourceforge.n... ... p/download
This was the best and most notable speed improvement out of everything I'd done so far. I went from <1fps in multiplayer towns to about 12fps (which is a huge boost and enough to let me play) plus a major speedboost outside of towns (about 20-30fps).
4) A simple texture pack
I know some people don't like the simplistic, minimal texture packs, but they reduce the amount of work being done by the graphics card. I'm currently using SimpleCraft, but any minimal pack will do. Look for textures that use 1-3 colors per block, at most. Solid colors are best.
5) Use a shell script to add switches
Java lets you use switches to modify the environment variables. This is the shell script I use to launch Minecraft:
java -Dsun.java3d.opengl=true -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame
The first switch, "-Dsun.java3d.opengl=true", allows Minecraft to use OpenGL for rendering. I think it's enabled by default, but just to be safe.. The next two bump up the amount of memory that Minecraft is going to use. This code (sans the OpenGL switch) can be found on the download page of Minecraft.net All you have to do is save that as minecraft.sh (or whatever you want, but always .sh). Then right-click, Properties, Permissions, Mark as executable (Ubuntu) or via terminal:
sudo chmod 755 minecraft.sh
Which is probably more portable between distros.
More switches Thanks ericdjobs!
Here are the current optimized launch options I use
This uses the aggressive optimizations, parallel garbage collector, and some other tuning options. This will significantly increase performance in linux AND windows. You can adjust the memory to whatever your system is capable of (I'd wager about 33% of ram unless your sole purpose is to be playing minecraft)
Note: Be sure to edit the bolded portions of the code-block immediately above this note to fit your system. The first bolded item is, as explained, the number of cores you have. The second is the path to your minecraft.jar launcher, not the one in your ~/.minecraft/bin folder.
6) Modify the priority
Minecraft runs MUCH better at a higher priority. The easiest way to do this is to use your native "System Monitor" which lists your computer's processes. Find "java" and give it maximum priority (possibly via the right-click menu, I'm only used to Ubuntu..)
You can also do this via the terminal:
sudo pidof java sudo renice -A -p BImportant: Replace B with the number returned by the first command. Replace A with a number from -11 to -20, -20 being the highest priority. (You can actually use -1 to -20, but anything from 0-20 will take the priority down..) I recommend -20, as it gives the most processing power to Minecraft.
7) Set your CPU to run for performance
You can find utilities for Linux to modify your CPU's running speed. On Ubuntu, there is a pre-installed applet for your panels called "CPU Frequency Scaling Monitor" that allows you to choose your processor's general or specific speed (to a point).
There may be other tools for different distros, but I have no experience with such things.
8) Update libraries - Thanks to misuisum!
I experienced sound issues and fps drops in linux (ubuntu 10.10 x64). However, I was able to fix those problems by replacing the outdated shipped libraries with current ubuntu libraries. The libraries required can be found in ~/.minecraft/bin/natives. I just installed the corresponding packages and set symlinks to /usr/lib/"libname" (Don't forget a backup!).
I hope this has helped you in some way. I've been able to enjoy Minecraft much more since making these changes, and I wanted to share these wonderful discoveries with you all. Happy Mining!