Difference between revisions of "Performance Optimization"

From TerraFirmaCraft Plus Wiki
Jump to: navigation, search
Line 7: Line 7:
 
Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.
 
Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.
  
 +
== Performance Optimization Within Minecraft == <!--T:6-->
 +
Due to the way TFC+ extends the capabilities of Minecraft, it is more difficult to run than vanilla. When playing on weaker computers (minecraft is almost completely CPU dependent) it is recommended to turn smooth lighting to minimum, but never off as this can cause graphical glitches with TFC+ blocks (mainly roof items). You may also benefit from reducing particles, and reducing render distance.
  
== JVM Arguments == <!--T:12-->
+
== Performance Optimization Using JVM Arguments == <!--T:7-->
 +
Minecraft is coded in a programming language called Java. This programming language is different from the ones that you will usually have in the programs of your system. One key feature is the "Java Runtime Environment" which is sort of like an operating system within your operating system (in very simplistic, non-technical terms). It can be configured using what are called 'JVM arguments' in order to change its behaviour.
  
<!--T:13-->
+
<!--T:8-->
'''''Important: Make sure that you delete any existing arguments in the text box before you add the ones below. If you don't, then you will likely have duplicate values for the same parameters, and the game may use the wrong one.'''''
+
For people who do not want to read through a long paragraph, the recommended parameters for systems with 8GB and higher RAM are:
  
<!--T:14-->
+
<!--T:9-->
These arguments are edited by using the profile editor and putting text into the bottom box as well as marking the appropriate checkbox. The following string is a good starting point, but will very likely need to be edited at least partially to work properly with your computer. An explanation of what each part does and what you may need to change it to will be explained below:
+
-Xms2G -Xmx4G -XX:NewSize=1G -XX:MaxNewSize=2G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
  
  <!--T:15-->
+
<!--T:10-->
 +
for systems with 4GB ram, use:
 +
 
 +
  <!--T:11-->
 
-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
 
-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
  
<!--T:16-->
+
''if you are on a 32-bit system, do not use -d64, as this forces Java to run in 64 bit mode and will not work on your system.''
''Note: This string was chosen for use with Java 8. If you are using Java 7 there may be additional arguments that could help increase performance. More information about Java 7 VM arguments can be found [http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html here.]''
+
 
+
 
+
=== Memory Allocation === <!--T:17-->
+
 
+
<!--T:18-->
+
-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G
+
 
+
<!--T:19-->
+
TerraFirmaCraft requires a minimum of 1GB of memory to smoothly run single player without running into obvious issues. If you are using a 32-bit operating system, this is also essentially the maximum amount of memory you will be able to allocate as well. If you are using a 64-bit operating system, and are properly using a 64-bit version of java, you will be able to set your maximum higher. -Xms is used to set the minimum memory, and -Xmx is used to set the maximum memory allocation. -XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx respectively.
+
 
+
<!--T:20-->
+
For single player, or clients that are connecting to a server, a maximum of 2GB is recommended, but you are encouraged to adjust as necessary. The best way to see what will likely be a good maximum for you is to turn on the [http://minecraft.gamepedia.com/Debug_screen Minecraft Debug] overlay using F3. In the upper-right corner you'll see what percentage of memory is currently used. Generally speaking, you should aim for keeping that number below 75%, and ideally it should average around 50%. Allocating too much memory to Minecraft can surprisingly cause just as many issues with lag spikes as not allocating enough.
+
 
+
 
+
==== 32-bit Systems ==== <!--T:21-->
+
 
+
<!--T:22-->
+
If you are using a 32-bit operating system, the most you can generally allocate is the following string:
+
 
+
<!--T:23-->
+
-Xms1G -Xmx1G -XX:NewSize=256M -XX:MaxNewSize=512M
+
 
+
 
+
=== Garbage Collection === <!--T:24-->
+
 
+
<!--T:25-->
+
-XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
+
 
+
<!--T:26-->
+
One of the best ways to increase performance is to use JVM arguments to help with garbage collection. This will help prevent the large lag spikes and freezes that often occur while doing resource intensive things such as generating new terrain.
+
  
<!--T:27-->
+
==== Explaining The Options ==== <!--T:12-->
*-XX:SurvivorRatio=2 : Ratio of eden/survivor space size
+
''This part of the page is quite technical, and will delve into Sun Java documentation at times. Knowledge of this section is not necessary to continue through the guide, and you may skip it.''
*-XX:+DisableExplicitGC : Disables calls to System.gc()
+
*-d64 : Forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.
+
*-XX:+UseConcMarkSweepGC : Use concurrent mark-sweep collection for the old generation.
+
*-XX:+AggressiveOpts
+
  
<!--T:28-->
+
The main functions of JVM arguments are 2 things, to allocate RAM to the JRE (in this case, running minecraft) and the control the garbage collection of Java. Garbage collection is the technical term referring to the cleaning of unused items that are in the allocated RAM to free them up for other uses. In most other programs of your computer (often written in the language of C or C++) this RAM allocation to functions are handled manually or semi-manually. In Java, the garbage collector will run to automatically handle it, at the cost of momentarily stopping or slowing the program down as the GC moves through the list checking their usefulness. This greatly reduces development time and potential bugs, but can cause stuttering issues in a game (where a frame is ideally drawn every 16.67ms).
PermSize-related arguments and -XX:+CMSIncrementalPacing are intentionally not in this string, as they are deprecated in Java 8 and will be ignored.
+
  
 +
-Xms, -Xmx, -XX:NewSize=, -XX:NewSize= handle the allocation of RAM.
  
== Forge Version == <!--T:29-->
+
-Xms is used to set the minimum memory, and -Xmx is used to set the maximum memory allocation.
  
<!--T:30-->
+
-XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx respectively.  
You should always be using the version of [http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.7.10.html Forge] that TerraFirmaCraft was built on. If the current recommended version is newer than the version that TFC was built on, it ''should'' be safe to use that instead, but there is no guarantee.  
+
  
 +
G notates Gigabytes, M notates Megabytes in arguments. Due to Minecraft (1.7.10) not being coded to handle arbitary sizes of RAM, it isn't recommended allocate all of your system ram to it. This can actually cause it to slow down. You can check the level of usage in the top right of the F3 menu. Use of modpacks that include TFC+ may need more RAM allocation. Try to keep the usage between %60-%80.
  
== Install FastCraft == <!--T:31-->
 
  
<!--T:32-->
+
-XX:SurvivorRatio=, -XX:+DisableExplicitGC, -d64, -XX:+UseConcMarkSweepGC, XX:+AggressiveOpts are related to the Garbage Collection.  
FastCraft is a mod created by the IC2 coder, Player, that is designed to help performance with Minecraft. This mod is optional, and can be installed on both clients and servers to help resolve some performance issues that are in vanilla Minecraft's code.
+
  
<!--T:33-->
+
-XX:SurvivorRatio= denotes the ratio between survivor space and eden space after GC is run. Eden space is the pool from which memory is initially allocated for most objects.
FastCraft is located [https://www.curseforge.com/minecraft/mc-mods/fastcraft here].
+
  
 +
-XX:+DisableExplicitGC disables calls to System.gc() in order to reduce how often GC must be run.
  
== Install/Uninstall Optifine == <!--T:34-->
+
-d64 forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.
  
<!--T:35-->
+
-XX:+UseConcMarkSweepGC denotes the type of GC that should be used. This type has been deprecated in Java 9 (Minecraft 1.7.10 runs in Java 8). Do not use this argument for 1.12 or newer, it explicitly does not work in version 1.17.
As counter-intuitive as it may sound, Optifine has been known in the past to cause more lag than it fixes when it comes to modded Minecraft. Your results may vary, but we still encourage that you try playing both with and without Optifine to see for yourself which way gets better performance on your system. Optifine may also cause graphical glitches such as floating trees and missing water; use at your own risk.
+
  
<!--T:36-->
+
== Performance Optimization Using Mods == <!--T:13-->
The official Optifine website can be found [http://optifine.net/downloads here].
+
There are mods that have been made to optimize minecrafts code and extend it. This is especially useful in older versions like 1.7.10 that do not have the recent optimizations done in newer versions.
  
 +
==== Fastcraft ==== <!--T:14-->
 +
[https://www.curseforge.com/minecraft/mc-mods/fastcraft Fastcraft] is a mod that optimizes the mathematical functions that minecraft uses in order to increase FPS. Since this guide will also walk you through installing Optifine (and setting it up to work with TFC) it recommends that you use version 1.25 (latest as of last check). Simply place the mod in your mods folder.
  
== Smooth Lighting == <!--T:37-->
+
==== Optifine ==== <!--T:15-->
 +
By default, Optifine can cause graphical issues with TFC+ due to the rendering methods used. Without proper configuration most performance functions cannot be used. Firstly, [https://optifine.net/downloads download optifine]. Make sure to get the 1.7.10 version OptiFine HD U E7 (latest 1.7.10 version). You'll need to click show all versions. You'll now want to download [https://github.com/Rexhunter99/TFC-Basic-Shaders Basic TFC+ Shaders] also available in [[addons]]. Starting the game up with optifine installed will let it create the folders it needs. You should now see \AppData\Roaming\.minecraft\tfc\shaderpacks. Unzip the shader into this folder, as a single folder (and not as loose files). You'll want to start minecraft and open the settings to select the basic TFC shaders for optifine, and then configure certain settings. Specifically set 'Advanced OpenGL: Fancy', 'Chunk-Loading: Multi-Core', 'Smooth FPS: On', 'Smooth World: Off', 'Fast Math: On'. More information is available on the shader github page.
  
<!--T:38-->
+
''For users of Nvidia graphics cards, especially on laptops, there is an extra step. You must go into the Nvidia control panel and set Java JRE/Minecraft to use the Nvidia graphics card. This is easier when minecraft is running as it'll go up to the top. You'll know it is set correctly when the optifine shader selection screen displays the name of your dedicated graphics card.''
Turning off Smooth Lighting -especially in areas with a lot of trees or roofs -may increase your FPS.
+
  
 
</translate>
 
</translate>

Revision as of 08:58, 3 August 2021

Other languages:
English • ‎русский

Overview

Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.

Performance Optimization Within Minecraft

Due to the way TFC+ extends the capabilities of Minecraft, it is more difficult to run than vanilla. When playing on weaker computers (minecraft is almost completely CPU dependent) it is recommended to turn smooth lighting to minimum, but never off as this can cause graphical glitches with TFC+ blocks (mainly roof items). You may also benefit from reducing particles, and reducing render distance.

Performance Optimization Using JVM Arguments

Minecraft is coded in a programming language called Java. This programming language is different from the ones that you will usually have in the programs of your system. One key feature is the "Java Runtime Environment" which is sort of like an operating system within your operating system (in very simplistic, non-technical terms). It can be configured using what are called 'JVM arguments' in order to change its behaviour.

For people who do not want to read through a long paragraph, the recommended parameters for systems with 8GB and higher RAM are:

-Xms2G -Xmx4G -XX:NewSize=1G -XX:MaxNewSize=2G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts

for systems with 4GB ram, use:

-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts

if you are on a 32-bit system, do not use -d64, as this forces Java to run in 64 bit mode and will not work on your system.

Explaining The Options

This part of the page is quite technical, and will delve into Sun Java documentation at times. Knowledge of this section is not necessary to continue through the guide, and you may skip it.

The main functions of JVM arguments are 2 things, to allocate RAM to the JRE (in this case, running minecraft) and the control the garbage collection of Java. Garbage collection is the technical term referring to the cleaning of unused items that are in the allocated RAM to free them up for other uses. In most other programs of your computer (often written in the language of C or C++) this RAM allocation to functions are handled manually or semi-manually. In Java, the garbage collector will run to automatically handle it, at the cost of momentarily stopping or slowing the program down as the GC moves through the list checking their usefulness. This greatly reduces development time and potential bugs, but can cause stuttering issues in a game (where a frame is ideally drawn every 16.67ms).

-Xms, -Xmx, -XX:NewSize=, -XX:NewSize= handle the allocation of RAM.

-Xms is used to set the minimum memory, and -Xmx is used to set the maximum memory allocation.

-XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx respectively.

G notates Gigabytes, M notates Megabytes in arguments. Due to Minecraft (1.7.10) not being coded to handle arbitary sizes of RAM, it isn't recommended allocate all of your system ram to it. This can actually cause it to slow down. You can check the level of usage in the top right of the F3 menu. Use of modpacks that include TFC+ may need more RAM allocation. Try to keep the usage between %60-%80.


-XX:SurvivorRatio=, -XX:+DisableExplicitGC, -d64, -XX:+UseConcMarkSweepGC, XX:+AggressiveOpts are related to the Garbage Collection.

-XX:SurvivorRatio= denotes the ratio between survivor space and eden space after GC is run. Eden space is the pool from which memory is initially allocated for most objects.

-XX:+DisableExplicitGC disables calls to System.gc() in order to reduce how often GC must be run.

-d64 forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.

-XX:+UseConcMarkSweepGC denotes the type of GC that should be used. This type has been deprecated in Java 9 (Minecraft 1.7.10 runs in Java 8). Do not use this argument for 1.12 or newer, it explicitly does not work in version 1.17.

Performance Optimization Using Mods

There are mods that have been made to optimize minecrafts code and extend it. This is especially useful in older versions like 1.7.10 that do not have the recent optimizations done in newer versions.

Fastcraft

Fastcraft is a mod that optimizes the mathematical functions that minecraft uses in order to increase FPS. Since this guide will also walk you through installing Optifine (and setting it up to work with TFC) it recommends that you use version 1.25 (latest as of last check). Simply place the mod in your mods folder.

Optifine

By default, Optifine can cause graphical issues with TFC+ due to the rendering methods used. Without proper configuration most performance functions cannot be used. Firstly, download optifine. Make sure to get the 1.7.10 version OptiFine HD U E7 (latest 1.7.10 version). You'll need to click show all versions. You'll now want to download Basic TFC+ Shaders also available in addons. Starting the game up with optifine installed will let it create the folders it needs. You should now see \AppData\Roaming\.minecraft\tfc\shaderpacks. Unzip the shader into this folder, as a single folder (and not as loose files). You'll want to start minecraft and open the settings to select the basic TFC shaders for optifine, and then configure certain settings. Specifically set 'Advanced OpenGL: Fancy', 'Chunk-Loading: Multi-Core', 'Smooth FPS: On', 'Smooth World: Off', 'Fast Math: On'. More information is available on the shader github page.

For users of Nvidia graphics cards, especially on laptops, there is an extra step. You must go into the Nvidia control panel and set Java JRE/Minecraft to use the Nvidia graphics card. This is easier when minecraft is running as it'll go up to the top. You'll know it is set correctly when the optifine shader selection screen displays the name of your dedicated graphics card.