Quote from livinskullAug 15, 2026 - 09:22:40
You cannot properly cache a sprite sheet, clientside, as any change to any country flag (or, a new one, or removing one) would have to invalidate it.
But country flags don't need to be changed/added/removed often nowadays as far as I know.
So it would probably still be worth it because cache invalidations would be few and far between.
A further refinement would be to split country flags into N groups in alphabetical order (in English) and create a sprite for each group.
Instead of one big sprite, we now have N smaller sprites.
Then, when a country flag changes/is removed/is added, most of the times only the cache for 1 sprite corresponding to that country's group would get invalidated, or at most 2 in case that country changes its name (the sprite corresponding to the group it leaves and the one corresponding to the group it joins).
Country groups must be allowed to grow/shrink freely for this to be possible.
This means group size differences would accumulate over time, meaning some groups could get big enough that their probability of invalidation could become significantly higher than the others due to increased membership alone.
Also, there is of course the matter of tuning the N parameter.
However, again, countries don't change all that often, I don't think it's a problem if it becomes necessary to regenerate all the groups in 100+ years

.
By taking into account more data about actual countries (stability, geopolitical connection, ...), sprite groups can be created in smarter ways so as to optimize for different aspects of cache performance.
OK, enough rambling now
