EmperorFool
Deity
Heh, I forgot to turn on NoCustomAssets in that mod test, so I was still using BUG. Okay, I have verified that the delay is not there without BUG, or at least it's not as severe.
I've now done some timings on the BUG code and found that redrawing the plot list when there are this many units takes roughly 350 ms (compared to 50 ms for stock BTS). It takes 85 ms to hide all the icons and 220 ms to draw them again. The way that PLE (and all Civ4 code) works is that it hides everything and then shows what needs to be shown each time it does an update.
One difference is that stock BTS has 3 items per unit: the icon, the dot, and the health bar. BUG (PLE) adds four: movement bar, upgrade indicator, promotion frame, and mission tag. Disabling these options drops the draw time to 75 ms.
There are two places I can see to improve the time:
1. Avoid hiding and showing an element that isn't changing. This could speed up the process slightly.
2. Add code to detect when the only change is the units that are selected. This could possibly greatly speed up the process because none of the elements would actually be redrawn. Instead, only the icons highlight (yellow frame) would be toggled. The problem is that I have no idea how to do this. Civ4 doesn't have any events for units being selected/deselected. All I get is a "redraw all the unit icons" call with no information as to why I'm being told to redraw them.
Recoding PLE to do (1) would be pretty costly, and I don't know how big the payoff would be. If the slowdown really hurts, turn off some of the PLE features in the late game.
I've now done some timings on the BUG code and found that redrawing the plot list when there are this many units takes roughly 350 ms (compared to 50 ms for stock BTS). It takes 85 ms to hide all the icons and 220 ms to draw them again. The way that PLE (and all Civ4 code) works is that it hides everything and then shows what needs to be shown each time it does an update.
One difference is that stock BTS has 3 items per unit: the icon, the dot, and the health bar. BUG (PLE) adds four: movement bar, upgrade indicator, promotion frame, and mission tag. Disabling these options drops the draw time to 75 ms.
There are two places I can see to improve the time:
1. Avoid hiding and showing an element that isn't changing. This could speed up the process slightly.
2. Add code to detect when the only change is the units that are selected. This could possibly greatly speed up the process because none of the elements would actually be redrawn. Instead, only the icons highlight (yellow frame) would be toggled. The problem is that I have no idea how to do this. Civ4 doesn't have any events for units being selected/deselected. All I get is a "redraw all the unit icons" call with no information as to why I'm being told to redraw them.
Recoding PLE to do (1) would be pretty costly, and I don't know how big the payoff would be. If the slowdown really hurts, turn off some of the PLE features in the late game.