Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[HOWTO] Optimize Minecraft for Linux


  • Please log in to reply
33 replies to this topic

#1

malagrond
  • Location: USA

Posted 08 February 2011 - 02:42 PM

[HOWTO] Optimize Minecraft for Linux


Introduction

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.

Things Needed

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:

Nvidia Drivers
Open-source ATI/Nvidia Drivers (This is pretty much the best for ATI. R200 cards can use the ATI official driver)

Thanks epikal!

epikal said:

Probably worth saying that the first place to look for proprietary drivers is via the Distro, ie for ATI/Nvidia under Ubuntu/Mint go to:
System->Administration->Additional Drivers
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):
viewtopic.php?f=17&t=145799
Newer 2.7 libraries here:
http://sourceforge.n... ... p/download


3) Optimine
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).

Get Optimine

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.

SimpleCraft

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 :mossystone: 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!

ericdjobs said:

Anyways, there's a couple other things you can do to optimize the running of the minecraft JAR, by optimizing the java VM,  You can also do this with minecraft server for a notable performance increase...

Here are the current optimized launch options I use

Quote

java -Xmx1024M -Xms1024M -XX:+UseFastAccessorMethods -XX:+AggressiveOpts  -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:+UseParallelGC -XX:UseSSE=3 -XX:ParallelGCThreads=(Number of processor cores you have, for me it's 2) -jar /media/storage/minecraft.jar

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 B
Important: 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!

misuisum said:

Here is another optimization hint:
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!).


Afterword

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!

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

Register or log in to remove.

#2

Wrathful
    Wrathful

    Redstone Miner

  • Members
  • 566 posts
  • Location: Athens, GA

Posted 08 February 2011 - 03:14 PM

Awesome guide! I'm glad there are people out there solving these problems. I had given up playing MC on my Linux machines...
If you wish to make an apple pie from scratch, you must first invent the universe.
--Carl Sagan

I am Scjoiner on YouTube. Check out my insane redstone stuff. Scjoiner's Channel

#3

NoMercyJon

Posted 08 February 2011 - 03:36 PM

Some things I didn't even think of, thanks and good job!
Posted Image
Posted ImagePosted ImagePosted Image
    

Posted Image


#4

Neoo
    Neoo

    Lapis Lazuli Collector

  • Members
  • 1035 posts
  • Location: In one of the cars outside your window...

Posted 08 February 2011 - 03:40 PM

Would this work for mac too? I mean they are both running Unix, right?
I let others quote me

#5

Daniel122P
  • Location: Tenerife (Canary Islands, Spain)

Posted 08 February 2011 - 03:41 PM

I actually have MUCH better FPS on Ubuntu (Linux) without any optimisation than on Windows. So, I don't understand why you say it wasn't done for Linux. I mean, it's java. Java runs on Linux. So Minecraft runs on Linux.
Posted Image Posted Image Posted Image Posted Image

#6

Wrathful
    Wrathful

    Redstone Miner

  • Members
  • 566 posts
  • Location: Athens, GA

Posted 08 February 2011 - 03:44 PM

What sort of graphics technology are you using, Daniel? I'm betting that has a lot to do with it, but I could be wrong.
If you wish to make an apple pie from scratch, you must first invent the universe.
--Carl Sagan

I am Scjoiner on YouTube. Check out my insane redstone stuff. Scjoiner's Channel

#7

Daniel122P
  • Location: Tenerife (Canary Islands, Spain)

Posted 08 February 2011 - 04:02 PM

Wrathful said:

What sort of graphics technology are you using, Daniel? I'm betting that has a lot to do with it, but I could be wrong.
Huh, complete specs here. It's a laptop (Acer Aspire 5930G):
Intel Core 2 Duo P7350 2.0 GHz
Nvidia GeForce 9600M GT 512 MB
4 GB RAM
Ubuntu 10.10 64 Bits

Using official Nvidia drivers.
And, yeah, Minecraft will run slower on Linux than on Windows when using an ATI graphics card. Well, Minecraft and any other game. But not becouse of the game. Because of the drivers. ATI drivers for Linux suck :Glass:
Posted Image Posted Image Posted Image Posted Image

#8

xTRICKYxx
  • Location: Vermont

Posted 08 February 2011 - 04:07 PM

Daniel122P said:

Wrathful said:

What sort of graphics technology are you using, Daniel? I'm betting that has a lot to do with it, but I could be wrong.
Huh, complete specs here. It's a laptop (Acer Aspire 5930G):
Intel Core 2 Duo P7350 2.0 GHz
Nvidia GeForce 9600M GT 512 MB
4 GB RAM
Ubuntu 10.10 64 Bits

Using official Nvidia drivers.
And, yeah, Minecraft will run slower on Linux than on Windows when using an ATI graphics card. Well, Minecraft and any other game. But not becouse of the game. Because of the drivers. ATI drivers for Linux suck :cobblestone:

Interesting... Minecraft runs so much smoother for me on Ubuntu 10.10 x64 than Windows 7 x64.
I am using the most up to date drivers for both.
Posted Image

#9

malagrond
  • Location: USA

Posted 08 February 2011 - 08:41 PM

No problem guys :D

@Neoo: It should help. The drivers should be better on Mac, considering it's more mainstream.

The reason I have problems playing on Linux is because I have an ATI Radeon X1200, which is not supported by the official ATI drivers, plus it's rated for "Light Home or Office Use".. Not exactly a gaming beast =p

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

#10

malagrond
  • Location: USA

Posted 09 February 2011 - 02:27 PM

Bump for education.

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

#11

misuisum
    misuisum

    Out of the Water

  • Members
  • 4 posts

Posted 09 February 2011 - 02:52 PM

Here is another optimization hint:
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!).

#12

malagrond
  • Location: USA

Posted 09 February 2011 - 03:02 PM

I'll have to look into that O.o In the meantime, I'll add it to the OP. Thanks for the tip! :Notch:

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

#13

okal
    okal

    Glowstone Miner

  • Curse Premium
  • Curse Premium
  • 3497 posts
  • Location: UK

Posted 09 February 2011 - 04:41 PM

Nice post, to clarify a couple of points... :)

Minecraft uses Java and lwjgl libraries for Windows, Linux & OS X, rather than it being ported.
The Windows .exe and OS X .app is just a simple way to launch the .jar (You can download Minecraft.exe to your Linux box, rename it to .jar and run it normally).

ATI have not dropped Linux support, they just no longer provide new drivers for legacy hardware, for your card official Windows support stopped with Vista too.
One solution to this is to run a distro with an older version of X that can use the legacy ATI/AMD drivers. It looks like your last supported X is 7.4(1.5.1), so Debian Lenny may be worth a shot, support only lasts another year but may be worth trying for that year for potentially improved 3D if you have some HDD space to test. The open source drivers may also suck less in a year too!

On more modern hardware you can use essentially the same AMD/Nvidia drivers on both OS and may, like in my case, find it is actually faster under Linux. At least for Nvidia :)

Probably worth saying that the first place to look for proprietary drivers is via the Distro, ie for ATI/Nvidia under Ubuntu/Mint go to:
System->Administration->Additional Drivers
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):
viewtopic.php?f=17&t=145799
Newer 2.7 libraries here:
http://sourceforge.n... ... p/download

Keep up the good work :)

#14

ericdjobs

Posted 09 February 2011 - 04:57 PM

Minecraft runs better in Fedora 14 than Windows for me...

Anyways, there's a couple other things you can do to optimize the running of the minecraft JAR, by optimizing the java VM,  You can also do this with minecraft server for a notable performance increase...

Here are the current optimized launch options I use

Quote

java -Xmx1024M -Xms1024M -XX:+UseFastAccessorMethods -XX:+AggressiveOpts  -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:+UseParallelGC -XX:UseSSE=3 -XX:ParallelGCThreads=(Number of processor cores you have, for me it's 2) -jar /media/storage/minecraft.jar

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)

#15

repkam09
  • Location: New York

Posted 09 February 2011 - 05:38 PM

I've never had any issues playing on Ubuntu 10.10 (64bit)
Always seems to runs faster then when I was using Windows 7.

I never thought of changing the libraries or trying to change priority, might give those a shot. Thanks.  :)

#16

malagrond
  • Location: USA

Posted 09 February 2011 - 05:53 PM

Thanks epikal and ericdjobs! I'll add your information to the first post as well :Pig:

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

#17

apocalypse_r
  • Location: 0x00000000 (Every time you visit, a program dies.)
  • Minecraft: notch

Posted 09 February 2011 - 08:20 PM

Wikipedia said:

A niceness of −20 is the highest priority and 19 or 20 is the lowest priority. The default niceness for processes is inherited from its parent process, usually 0.

Source Source2 Source3

Scheduling order, not scheduling priority.  An order of 19 means that it will get to use the CPU AFTER EVERYTHING ELSE.
an order of 0 means it comes before 1-19, but after -20 - -1.
only negative orders require sudo.

#18

malagrond
  • Location: USA

Posted 09 February 2011 - 08:22 PM

If you double-check my post, you'll see that it's:

sudo renice -A -p -B

Notice the minus sign :Black:

EDIT: I guess the explanation around it was a bit hazy. Fixed :Diamond:

GodofCheeses said:

[Ham]  the joke
[Notch]  your head

  [] [Ham]  [Ham]  [Ham] []
[Ham] []  [Notch] []  [Ham]

riiiiiiight over it

SittenSpynne said:

Notch could replace Minecraft.net with goatse tomorrow and never publish an update again; the only legal recourse I have is to shake my fist at the screen.

#19

Troyburms

Posted 13 February 2011 - 07:26 PM

I tried all of these tips and still cannot make minecraft run over 15 fps in linux.  I am dual booting Linux Mint 10 and Windows 7.  In Windows, I get decent fps on lower settings (around 40 on short/fast) but whenever mobs come near or trees start despawning leaves it starts to lag.  I thought I would try running Minecraft in linux to see if I could increase my performance, but didn't have much luck.  Is there anything else I can do to try to increase my performance in linux?

Edit: Also my system can run 64 bit, but I chose to install the 32 bit version of Linux Mint. Would installing the 64 bit version help my performance at all?

#20

Troyburms

Posted 13 February 2011 - 07:39 PM

Another thing is that I feel like the CPU the limiting factor on my performance.  When I do the command "sudo lshw" the CPU section says...

description: CPU
product: AMD Turion Dual-Core RM-70
vendor: Advanced Micro Devices [AMD]
physical id: 3
bus info: cpu@0
version: 15.3.1
slot: Socket A
size: 500MHz
capacity: 2GHz
width: 64 bits
clock: 133MHz

Is my CPU not running at its full capacity?