Game Development Community

Is preloading of textures useful?

by Thomas Bang · in General Discussion · 01/20/2010 (11:56 am) · 3 replies

Solution #1:
Loading only textures which are requirded for a level/mission.
Advantage: Game startup is short.
Disadvantage: A texture, needed for several missions, is loaded for each mission again.

Solution #2:
Loading all textures of the game at startup.
Advantage: The time to load a mission is short.
Disadvantage: Game startup takes a longer time.


Which solution would you prefer?

#1
01/20/2010 (12:15 pm)
I'm fairly sure (but not totally) that once a texture is loaded into memory it stays there and does not get reloaded.

So you might as well load them as you need them.
#2
01/20/2010 (12:18 pm)
I thought a texture will be released when no object exists which has a use for the texture.
#3
01/20/2010 (2:42 pm)
Yup, textures are reference-counted and a given texture will be released when no one is using it anymore.

#1 is the correct approach. Textures are GPU resources and GPU resources (like most resource types) should generally be used in a 'resourceful' way :) Sure, texture management will sort this out to a certain degree but still, it is basically tying up resources.

Same goes for SFX. Just creating all SFXProfiles you'll ever need in your game at startup and maybe even set them all to preload is a bad idea.

//Dang... falling into this trap again and again. Was just assuming some newer Torque engine here. No clue how ye olde TGE handled texture management.