Just pushed to SVN (3268):
- Fixed (or at least, heavily mitigated) ocean artifacting when new ocean tiles are revealed when viewports are active
This was (at a technical level) quite interesting, and very illustrative of why it's such a pain trying to browbeat the graphics engine into doing what you need it to! It boils down to two functions the game engine provides for use by the DLL, which look related, but turn out not to be as closely related as you would think! These are:
Code:
virtual void RebuildAllPlots() = 0;
virtual void RebuildPlot(int plotX, int plotY, bool bRebuildHeights, bool bRebuildTextures) = 0;
I had asumed that RebuildAllPlots() basically just did a RebuildPlot() on every plot. However, after trial and error it turns out that calling rebuildAllPlots() will regenerate the wave layer that was missing on revealed ocean, whereas RebuildPlot() (even if called on every plot!) will not. RebuildAllPlots() is also about 100 times (literally) faster than calling RebuildPlot on every plot.
Anyway, the net of it all, is that there doesn't seem to be any way to solve the issue without a call to RebuildAllPlots() (which does FAR more work than should be necessary just to cause one plot to be repainted!). Because this is expensive to call (circa 1 second or so for a 40X40 viewport on my machine) I have added a delayed amalgamation mechanism so that when a reveal detects the need for a rebuild it just queues up a request. The request is serviced asyncronously as soon as the latest request is at least a second old - the effect is that one long move (or a continuous sequence of moves, for example by automated units) only results in a single repaint request at the end of the sequence, so you only get one pregnant pause, instead of lots of stuttering. The downside is that the ocean-without-any-waves tile is visible for that second, but it seems like an OK compromise - let me know how it seems for you.