Closed SirPannbiff closed 6 years ago
ive been told vector math is very intensive for some reason. just creating vectors in general can cause lag when done very frequently. volvo just didnt do something right when they implemented vectors in lua.
the creator of crumbling island arena implemented their own vector system because of this
so maybe try to cut back on your vector math in the OnAttack function, might help a bit.
Edit: for instance, you calculate the same direction multiple times, you could just make a local variable for it once.
Good suggestions, thanks! Unfortunately, since the latest client update (7.08) the game consistently freezes for me during the first 3 minutes of gameplay, so I'm not sure if I can implement any fixes anytime soon 😞
After quite a lot of testing, I've concluded that the new item is responsible for the reported lag. That said, I cannot pinpoint the exact cause, although it seems to be connected to the OnProjectileHit function, rather than OnAttack. It's hard to get consistent results, but the lag is easiest to trigger with very high attack speed and with the projectiles hitting many enemies at the same time.