nkzw-tech / athena-crisis

Athena Crisis is an Advance Wars inspired modern-retro turn-based tactical strategy game. Athena Crisis is open core technology.
https://athenacrisis.com/open-source
Other
1.37k stars 105 forks source link

[Performance] Reduce memory usage when rendering Portraits #14

Closed cpojer closed 1 month ago

cpojer commented 1 month ago

The way many sprites are rendered in Athena Crisis will render most of the image, and then cut off everything around it using CSS. This is naive, but works great for most use cases with small images that change often. However, character portraits are about 320 kb in size, and there are 11 variants of them. Rendering many characters on memory-limited devices is not good. This issue is about exploring alternative ways to render character portraits, possibly by slicing them up and rendering them with canvas and drawImage. There are some examples in the Athena Crisis codebase as well, see renderTile.

Steps

Check out the UI Components section for examples of portrait rendering.

Funding

Fund with Polar