Armour Damage Templates
In VB6 Aurora, the damage templates for each weapon are held in a database table, with one row for each combination of weapon type and damage amount. While this is simple, it mean any new weapon or change to damage model has to be laboriously updated in the table.
For C#, the damage templates are generated in code as needed based on a 'gradient' system. All the damage starts at a single point and is distributed right and left according to the gradient setting. Any column which has damage greater than the gradient, checks left and right. If an adjacent column has a damage amount that is lower than the current column damage minus the gradient, a single point of damage is moved to that column. The adjacent column with lower damage is used first. The code cycles back and forth through the columns until no more adjustments are necessary
For example, missile damage has a 'gradient' of 1. Therefore, there cannot be a gap of 2 damage between adjacent columns. Laser damage has a gradient of 3, so any gap of 4 damage between columns is corrected. Here are some examples for 25 damage:
Gradient 1 (Missile, Carronade, Ramming): 1,2,3,4,5,4,3,2,1
Gradient 2 (Railgun, Particle Torpedo): 1,3,5,7,5,3,1
Gradient 3 (Laser): 3,6,8,5,3
Particle Lances cause damage in a single column, gauss cause only a single point of damage and meson ignore armour.
The template generation takes about a millisecond so there is no performance issue. This means that new weapons with higher gradients can be added very easily.