Topic: Haste code re-write
As some of you may be aware, When I first wrote the haste code, I was forced to do all the math on the fly, each and every game tick. "What's a "game tick" ?".... Well, there are about 5 game ticks a second, so just to get it into perspective, 10+ players, fighting 10+ mobs doing about 80+ calucualtions a tick so about 400+ calculations a second wasted when the host could be pushing out packets, thus creating lag.
I was fully aware of how bad and slow the code was going to be. At the time, I wasn't able to increase memory for each player/mob to hold the extra info needed.
Well, Today, I done away with several 100 lines of opcodes I wrote, and done it properly.
To make it efficient, haste needed only be calculated on ship calibration. This happens when an item is moved, or buff/debuff is cast or expires, as well as a few other events. This drastically reduces the CPU cycles watsed doing math to a mere fraction of the old way. Now, the host reads the modified weapon speed values, rather than modifying it every tick.
So instead of 400+ wasted calcualtions, it's about 4...
yea 4...
If that.
Whilst I was going over all the awful haste code, I did come accross a few errors, that could be contributing to the server instability, so this is also good news.
So, not only will the server be responding better to clients, it will also be yet more stable.
Supaz