The veterancy system as we know it was introduced in 2017. It replaced the vanilla system that only took into account the final blow on a unit. There are some issues with the implementation however and I'd like to discuss that.
The system operates by adding logic when damage is applied to a unit. It performs the following operations:
- Compute the damage, excluding overkill if present.
- Keep track of the damage and the instigator at the receivers end, involving tables.
And when the unit is destroyed it performs the following operations:
- Disperse the damage dealt on a per-instigator basis.
The only logic applied when a unit was damaged pre 2017 was just subtracting the damage and checking whether it should die or not.
There are two problems with this approach:
- When damage is received it involves a table allocation. Tables need memory on the heap. Heap memory is expensive to allocate.
- When a unit dies it disperses the damage, essentially updating random pieces of memory. When performing random calls the item you're looking for is not in the cache. When it isn't in the cache it is expensive.
To provide more rational:
With the veterancy system applied, a 200 on 200 ASF fight will slow down the game from +10 (when the asf are doing nothing) to +5 at the start.Without the veterancy system applied, a 200 on 200 ASF fight will slow down the game from +10 (when the asf are doing nothing) to +8 at the start.
After discussing it the impact is a lot smaller than I originally tested. See also this, this and this post. It is roughly at most 1 sim speed.
Imagine units fighting all over the board in general and don't forget about damage over time (DOT). All of these calculations have a massive impact on the sim - which is exactly why a lot of games at some point run at -1, instead of 0 or 1 and that is the golden threshold of 'this game is slow' and 'nice'.
My question to everyone reading this: is it really worth it?
These are the solutions I propose, but feel free to suggest your own:
- (0) We keep it as is and take the sim loss for granted.
- (1) We keep the system but limit it to only a select few units that get to have veterancy.
- (2) We keep the system but we provide the veterancy when the damage is applied, instead of when the unit dies. This prevents table allocations.
- (3) We go back to the 'on-kill' notion, where the killer takes the mass value of the killee. This prevents table allocations.
- (4) We go back to the original system: one point per kill. This prevents table allocations.
- (5) We remove the system as a whole. No system is no allocations.
Note that option (1) is not a solution, it is a hack. The burden to track who gets veterancy is on the unit that takes damage, not the damage dealer. Therefore all units would still need to check on every damage instance whether they should track the damage dealt and disperse it accordingly when they die. They just 'skip' some units that we think don't matter.
In my opinion (2) is not far off from what we have at the moment. Especially when we tune it down slightly to take into account that a unit can be repaired / regenerated.