Stacked TNT perform insanely redundant calculations
If you have multiple TnT exploding in the same position, they will each perform their calculations of knockback and blocks broken independently. Despite the fact that the effect of their explosions can be combined linearly. This issue relates to MC-260743 and MC-238249. Features such as OptimizedTnT from carpet mod have working implmentantions which do not affect vanilla behviours:
OptimizedTnT is an ideal solution for optimizing TnT because if multiple TnT entities explode at the same location, instead of processing the blast knockback formula independently for each TnT, it simply combines their effects into a single calculation vastly improving performance while maintaining behaviour. This also includes a fix for MC-238249 which eliminates the redundant checks on the blast origin if the TnT is in a state where it does not deal damage to blocks.
As an example here is a world download with a TnT cannon positioned at 4K,4K in the overworld and setup to fire a payload at 0,0:
https://www.mediafire.com/file/vpf6ctq0cvfl0p7/Orbital_Strike_Crash_Test.zip/file
Instructions are as follows:
- Join the world and wait 1 minute
- Press the Button labelled "Start Cannon"
- The player will be teleported to 0,0,0 and the cannon will begin charging
Note the TPS drop significantly due to large quantities of TnT performing inefficient calculations
Note that eventually the game becomes unresponsive due to excessive collision checks as the cannon fires
Note that the cannon works perfectly fine with optimizations running
You can also find the video about the cannon here:
Created Issue:
Stacked TnT Perform Insanely Redundant Calculations
If you have multiple TnT exploding in the same position, they will each perform their calculations of knockback and blocks broken independently. Despite the fact that the effect of their explosions can be combined linearly. This issue relates to MC-260743 and MC-238249. Features such as OptimizedTnT from carpet mod have working implmentantions which do not affect vanilla behviours:
OptimizedTnT is an ideal solution for optimizing TnT because if multiple TnT entities explode at the same location, instead of processing the blast knockback formula independently for each TnT, it simply combines their effects into a single calculation vastly improving performance while maintaining behaviour. This also includes a fix for MC-238249 which eliminates the redundant checks on the blast origin if the TnT is in a state where it does not deal damage to blocks.
As an example here is a world download with a TnT cannon positioned at 4K,4K in the overworld and setup to fire a payload at 0,0:
https://www.mediafire.com/file/vpf6ctq0cvfl0p7/Orbital_Strike_Crash_Test.zip/file
Instructions are as follows:
- Join the world and wait 1 minute
- Press the Button labelled "Start Cannon"
- The player will be teleported to 0,0,0 and the cannon will begin charging
Note the TPS drop significantly due to large quantities of TnT performing inefficient calculations
Note that eventually the game becomes unresponsive due to excessive collision checks as the cannon fires
Note that the cannon works perfectly fine with optimizations running
You can also find the video about the cannon here:
Stacked TnTPerformInsanelyRedundantCalculationsStacked TNT perform insanely redundant calculations
relates to
relates to
relates to
I've removed all the extra information from the summary, leaving only the motion performance issue. The ticket containing the other TNT performance issue that was previously cited here is at MC-260762.
can confirm for 1.20.6, here is the test setup for those who want to replicate: explosion_lag_issue.zip
how to use the setup:
-load the world in 1.20.2 (version before the issue is introduced), press the button on the command block (its near the diamond block), wait till the game unfreezes from lag, check how much server is lagging behind in the console
-load the world in 1.20.6 (version after the issue is introduced), press the button, wait till the game unfreezes from lag and check how much server is lagging behind in the console, it should be roughly twice as much behind as the test in 1.20.2 was.
in my own testing this issue indeed made explosions lag about twice as much compared to how it was before the issue was introduced, exact amount of lag is in the attached screenshots.
It is important to note, that even though this issue is marked as related to two other reports, MC-238249 is about a completely different issue (the one related to block breaking and not entity interaction) and the MC-260762 just being a feature request asking to implement an optimization from a certain mod even though it is not vanilla-preserving (as in it breaks vanilla behavior thus breaking even more explosion related contraptions).
However this report (MC-272414), states that since 23w45a the entire exposure calculation is needlessly done twice which worsens the lag from it even more, this leads to tnt cannons becoming too laggy to use for many players. thus entire field of cannon and tnt related redstone suffers a lot, i (and many others from tnt tech community) really hope this issue gets fixed soon.
It is quite important to note that contrary to what this report claims, the game modification suggested by this report as a potential solution does not preserve vanilla behavior that has existed for a very long time.
Can confirm in 1.21.1