Mission Loading Question: Materials and Datablocks
by Michael Perry · in Torque Game Engine Advanced · 12/12/2006 (9:32 am) · 1 replies
Hello all! I'm playing around with the TGEA demo, and I've come up with a question that I hope someone can help me out with.
Here's the hypothetical scenario:
Let's say I have 5 missions. Creation of these missions and their objects has led to a grand total of 500 materials, 30 shaders and 50 datablocks.
Now, I'm working with a 128 MB ATI card with only Shader 1.4 support, so I don't want to load all 500 materials into memory for the entire duration of the game. What's more, loading of all of those datablocks bogs down the mission start time.
So, how could I go about loading shaders, materials, and datablocks that will be used in the mission, while leaving the rest out?
I have a couple ideas, but they require brute force, so I'd like your opinions.
Thanks in advance.
Here's the hypothetical scenario:
Let's say I have 5 missions. Creation of these missions and their objects has led to a grand total of 500 materials, 30 shaders and 50 datablocks.
Now, I'm working with a 128 MB ATI card with only Shader 1.4 support, so I don't want to load all 500 materials into memory for the entire duration of the game. What's more, loading of all of those datablocks bogs down the mission start time.
So, how could I go about loading shaders, materials, and datablocks that will be used in the mission, while leaving the rest out?
I have a couple ideas, but they require brute force, so I'd like your opinions.
Thanks in advance.
About the author
Programmer.
Jon Wilsdon
Default Studio Name
So that is how we do it, but that might not be the best way for you. (And in fact, if I get some more time I will probably look into trying to get rid of the requirement of having to define a string in each materials.cs file, since it can be a pain if you do it late in the project when lots of material files already exist.) I would still recommend removing the loadMaterials() function call and only loading the materials you need for your menu (if you have one). Then when you are loading a mission, if each of your assets are under specific directories you might want to just change the loadMaterials() function definition to take a string pattern that would only include the directories you want to load the materials from. That doesn't particularly work if you have lots of shared assets however. In the case of lots of assets being shared you will most likely have to have a list of materials files that are needed for each mission and then just go through and exec them. Unless you wanted to try to load them all dynamically which I briefly made a comment on in this thread.