The objective is to minimize Instruction Latency ($L_{inst}$) and force the game to prioritize the Main Render Thread over background asset loading.
File Path & Setup
- Locate config.json:
%USERPROFILE%\Documents\My Games\Terraria\tModLoader\config.json. - Locate runtimeconfig.json: This is found in your Steam install folder:
..\steamapps\common\tModLoader\tModLoader.runtimeconfig.json. - Critical Rule: Always close the game and the Steam client before editing these files to prevent “Value Reset” errors.
Optimized “Calamity-Ready” Configuration Table
| Parameter (config.json) | Recommended Value | Technical Purpose |
LightingMode | 1 (Retro) | The FPS King. Drastically reduces CPU-side light calculations. |
Parallax | 0 | Disables background scrolling math to save GPU compute. |
Support4K | true | Allows the UI to scale without blurry sub-pixel rendering. |
FilterLimit | 16 | Limits the number of active screen filters/shaders. |
MultiplayerNPCSmoothingRange | 300 | Reduces “rubber-banding” lag in modded boss fights. |
HowTo: Engineering the TModLoader Runtime
Follow these GameEngineer.net technical steps to unlock the full potential of 64-bit execution:
- The Stack Size Hack: Open
tModLoader.runtimeconfig.json. UnderconfigProperties, find or add"DEFAULT_STACK_SIZE": "6400000". This increases the memory allocated per thread from the standard 1MB to 6.4MB, which is essential for deep modded logic calculations ($C_{logic}$). - Forcing OpenGL: In Steam Launch Options, add
/gldevice:OpenGL. In 2026, many modders have found that the .NET 6/8 environment used by tML handles OpenGL calls with lower driver overhead than DirectX 11. - Low Latency Launch String: Add these arguments to your Steam Launch Options:
-high -malloc=system -USEALLAVAILABLECORES - Disabling “Blood and Gore”: In
config.json, ensureShowGoreis set tofalse. In modded Terraria, a single boss kill can spawn 500+ gore particles, creating a massive spike in draw calls ($D_{call}$). - Memory Integrity Check: If you have 32GB of RAM, set your Shader Cache Size in the NVIDIA/AMD panel to Unlimited. Modded Terraria compiles thousands of unique projectile shaders; keeping them in the cache prevents “Frame Freezes” during bullet-hell phases.
Technical Explanation: Thread Stack and Mod Complexity ($M_{comp}$)
In 32-bit Terraria, the stack size was strictly limited, causing crashes when mods tried to calculate complex AI paths.
$$Performance \approx \frac{Stack\_Size}{Active\_Mods} \times CPU\_Clock$$
By engineering the DEFAULT_STACK_SIZE to 6400000, you provide a “buffer” for the 64-bit address space to process large data arrays without hitting a StackOverflowException. This doesn’t necessarily increase your average FPS, but it fundamentally eliminates the “Random Crashes” and “Game Speed Slowdown” that occur when the engine is waiting for a thread to clear its memory queue.