Understand LibGDX image rendering and texture binding
masterUnciv uses LibGDX for rendering. Images are displayed via a SpriteBatch which binds textures to memory.
Key Performance Concept:
- Texture Binding: The process of loading textures into memory is slow, while the actual rendering is fast.
- Optimization Strategy: To minimize performance hits, the game minimizes texture rebinds (swapping between different categories). This is achieved by compiling images into large PNGs using
ImagePacker.packImages(). - Texture Limits: Due to chipset limitations, textures are capped at
2048*2048pixels. Images are therefore categorized (e.g.,Images.Flags,Images.Tech) and compiled into separate PNG files in theandroid/assetsfolder to balance proximity and size.