Dynamic Turret Mgmt (aka optimize turrets plz)

[uRxP]DrChocolate shared this feedback 10 months ago

Obviously, everyone wants more turrets. Also, a lot of people want higher range weaponry. Currently, turrets are very expensive in PCU and CPU, and increasing their range dramatically increases their CPU cost.

The last time I took a deep look at SE's code, I remember finding that the main reason turrets were so CPU-expensive was because each turret had to check for nearby enemies in its range every few frames, and octree bounds checks take time. This is especially true when increasing the range, which has a n^2 effect on the size of the bounds.

Numerous modders have attempted to combat this problem in the past with something called "Dynamic Turret management", which basically means doing a single check for nearby enemies at a point on the grid that would capture the results of any other checks - if this fails, none of the turrets need to run their checks. These higher-level checks would sometimes also have back-off timers as well, so areas without conflict would be checked less often. I would love to have this feature in the base game.

Another thing modders have done to improve turret performance is to not just share target detection, but acquisition logic as well. Once an enemy has been found, instead of each turret trying to find a block to target on that enemy (or a different one) given their configuration, all the turrets within range fire at the higher priority area. This saves each turret a significant amount of logic every few frames. This feature gets a little tricky when you have weapons with different ranges, or incoming PD targets (missiles, etc) that need to be prioritized first, but it can be done.

Thanks for reading!

Comments (3)


Turrets are in desperate need of improvement- it amazes me that modders are able to identify issues slowing down performance, share that into, yet nothing is done ( over 5 years... ) to implement improvements besides KSH proclaiming to have fixed turrets, onyl to watch them suffer exactly the same issues as before ( hitting own grid, targeting friendly grids/ same faction due to simple ownership issues that make zero sense- if a different grid is in the same faction, then it is friendly, turrets should not be targeting it FFS ).


Rather than every turret scaning the same area for itself create a scanner or a radar block to do the scaning for an antire grid and send info to the turrets who do the targeting and shooting. That way only one block would get high CPU usage rather than each turret. Than maybe if the radar block gets destroyed mid battle the turrets can switch back to their own scaning.


I think it's an obvious solution. Even for someone who is not a programmer like me.Complementing your idea, you create a block called a computer shot (or radar), a more reinforced computer, and more than one contact side on the grid. It would be possible for adm (and the player) to set the priority of the functional blocks as soon as they were in the VISION field of the nearest tower. No x-rays like all the towers do today.