Texture loading optimalization

This is sub-layout for documentation pages


1 Introduction

Texture loading is the main source of long loading times for the game. Any optimalization for loading / reducing file sizes reduces loading time greatly.
This sums up all techniques used to fight the large texture sheets and loading times

2 Reduce texture sizes

Straightforward idea. Simply put, do not load texture of size \(20px * 20px\), if the texture will be drawn at size \(10px * 10px\).
This applies heavily to the spritesheets.

Backups of the high quality versions shall be made, if needed, but the game client should always load texture version which matches the drawn size exactly (or smaller texture, if upsizing is done...)

The following techniques are not yet implemented in project!

3 Loading in background

Textures are loaded in background, for example, while user is allowed to fill in login credentials, or during the actual gameplay.
In that case, some heuristics is needed to choose what texture to choose to preload...

4 Dynamic loading

Dynamic loading is the best choice how to optimize texture loading, but extremelly complicated for implementation.
The basic idea is, that client upon start loads only the minimum of textures, and textures, that are needed always (such as player texture sheets).
when client receives map data, it also receives list of identifiers of textures, that are needed to draw the map (items, monsters...).
Then starts loading the textures, and once this is done, the would can be drawn.

The loaded textures are kept in cache for future use, and it only depends how big the cache is allowed to be...