Difference between revisions of "Performance Optimization"

From TerraFirmaCraft Plus Wiki
Jump to: navigation, search
Line 61: Line 61:
  
 
''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.''
 
''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.''
 +
 +
== Server JVM Arguments == <!--T:17-->
 +
This section of the wiki is currently a stub. You can help by testing it!
  
 
</translate>
 
</translate>

Revision as of 08:59, 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.

Server JVM Arguments

This section of the wiki is currently a stub. You can help by testing it!