Posted: Fri Jan 09, 2004 8:24 pm
well, technically, if you were going to go for the resource thread youd do it the following way:
(this is a BIG project mind you, and in a game company would be devoted to _at least one_ hardcore programmer) write a resource manager which takes care of the loading and unloading of resources. this manager is non-blocking (as it uses a seperate thread to load resources, and this thread sleeps when waiting for the hard drive buffer). it would need to return a special type of pointer derived from a generic resource pointer type, this will make sure that the resource is already loaded before accessing it.
if the resource is NOT ready yet, it will either 1) make the caller's thread go to sleep until it is, 2) temporarily use a 'placeholder' or 'impostor' resource in its place, or 3) just not draw/play the resource. (it will do one or the other depending on whether the resource's meta data says its a critical resource or not, and if not it will use the impostor named in the meta data)
In this way, you could have a resource que for your levels, and only load whats neccesary in the first frame before actually starting the level (such as the .bsp, the impostors, and some critical models) . then in the background you could continue to load more resources (such as videos, and background music) and simply assume they'll be there when you need them. If they're not, you'll see/hear an impostor or nothing until the actual resource is loaded.
(this is a BIG project mind you, and in a game company would be devoted to _at least one_ hardcore programmer) write a resource manager which takes care of the loading and unloading of resources. this manager is non-blocking (as it uses a seperate thread to load resources, and this thread sleeps when waiting for the hard drive buffer). it would need to return a special type of pointer derived from a generic resource pointer type, this will make sure that the resource is already loaded before accessing it.
if the resource is NOT ready yet, it will either 1) make the caller's thread go to sleep until it is, 2) temporarily use a 'placeholder' or 'impostor' resource in its place, or 3) just not draw/play the resource. (it will do one or the other depending on whether the resource's meta data says its a critical resource or not, and if not it will use the impostor named in the meta data)
In this way, you could have a resource que for your levels, and only load whats neccesary in the first frame before actually starting the level (such as the .bsp, the impostors, and some critical models) . then in the background you could continue to load more resources (such as videos, and background music) and simply assume they'll be there when you need them. If they're not, you'll see/hear an impostor or nothing until the actual resource is loaded.