I also went back and optimized how often entity sprites reloaded themselves. It was something I was planning on redoing for a while now. Tomorrow I plan to being implementing resizable entities. Rather than simply rescaling the size of the sprite (which resulted in a blurred/distorted final appearance), these entities will copy certain rects from a larger source texture, tiling them appropriately within the sprite itself.
I have spent the last few days reworking my worlds such that the larger ones are divided into evenly-sized segments. Here's a very simple example of what I mean:
Let's assume the following grid represents our entire world:
Not quite as daunting now! With our world divided up as such, we are able to only load the relevant segments of the map; said segments being the ones that are visible by the camera. In order to guarantee a smooth transition between world segments, we would need at least 4 chunks loaded at a time assuming our camera size is smaller than the size of a segment. Consider below:
The red rectangle represents our camera position and size, and the purple area represents what is currently loaded into memory (including what the red area covers). Everything within the camera's view is being drawn every frame. We load these relevant tiles in a spiral, starting as close as possible to the camera's centre.
We can see how imperative it is that our first 6 tiles load before the game itself begins. Afterwards, we can have the spiral load the remaining purple tiles on a second execution thread and the game can begin!