Optimizing Explosions
Article explaining causes of lag in explosions, and how to reduce it!
Last updated
Article explaining causes of lag in explosions, and how to reduce it!
Last updated
This article is for the Explosion feature of WeaponMechanics.
WeaponMechanics uses a custom explosion system; it is completely separate from the Minecraft code (even though it looks very similar!). WeaponMechanics, by default, uses a highly optimized Explosion algorithm. But what if you are still encountering lag?
Falling blocks are visual effects added by . Although they are only visual, the math for calculating their collisions can cause a lot of lag. If you have a large explosion, you should either lower the chances for falling blocks, or completely disable them.
Explosions from WeaponMechanics are calculated the same way explosions from vanilla Minecraft are calculated; by casting rays in all directions. This is expensive on the CPU, especially if you explosion yield is high () or you have lots of explosions at the same time (Like an Airstrike).
This trick only works for Explosion_Shape: DEFAULT
, other explosion shapes will not work.
Using Explosion_Shape: DEFAULT
will always be taxing on the CPU. If you have a server that has 100s of explosions a minute, you should consider switching to a new shape, like SPHERE
.
Using Explosion_Exposure: DEFAULT
casts a lot of rays for each entity in the radius of the explosion. Switching to the optimized exposure can help reduce the number of rays.
For a more draconian route, you can use DISTANCE
to perform almost NO math per entity (At the cost of drastically reducing the features of an explosion).
See for more information.