Hi guys, I have run into a problem with my fighting game and I will need an advice.
There have been several threads describing the same or similar problems, but I decided to make a new one, since no actual solutions were provided so I wanted to try my luck, with hopefully some more fresh ideas.
Here's the problem. I recently implemented in my game Enhanced Animations and Ninja Mat's normal map shader. I use a large amount of animations and some textures are in very high resolution, so I suppose that my game now is using a Lot of memory (ok ,it is not a guess, it does).
So this is when the problem started. While the game is running now, DBpro will randomly choose not to load a media file of any type, and in most cases the program crushes.
Ok, some people will probably speculate that it is a problem related to bad media management in my code, so let me offer some details.
First thing I did is to make sure that I am providing the correct file paths in my code. I moved ALL media files in 1 folder. Every load command uses an absolute path "C:\...". Also this is a problem that happens randomly, sometimes it will happen and sometimes it will not. Also it happens in pre-textured objects, sometimes the object will load without their texture (both objects and textures are in the same folder). So this is not a problem related to bad media management.
This is how my game works. At the beginning of a match, 2 fighters and 1 background will be loaded. When the fight is over, the objects loaded will be deleted and the next ones will be loaded for the next match, and so on...
I am doing this because at the final version of the game I will be using a large amount of fighters and backgrounds so I will not be able to keep everything loaded in memory at the same time. And this has worked well so far, until this problem started.
Here is an example. Yesterday I tried the game for more than 30 minutes. All game media files were loaded successfully, I had other programs running at the same time too, no problems happened. But today I booted up my PC, started my game (nothing else was running) and at the second fight all background textures did not show up. Only the normal maps.

See the snowy look?

I closed the program, started it again, chose the exact same fighters and backgrounds in the same order, and this time everything was loaded successfully.
So I think that it happens randomly. When DBpro fails to load an image or an object the game crushes. If a texture from a pre-textured object is not loaded the object appears white. When an animation is not loaded the game crushes and an Enh. Animations error report is created.
Now the problem starts to happen after I delete the first loaded objects. So I tried something. I loaded all available fighters and backgrounds at the beginning of my program. Everything was loaded successfully every time that I restarted the game, no problems, so this is not a problem related to memory limitations. But this is not a very efficient solution. Now I have 7 fighters and 5 backgrounds available but the final version will have more than 20 fighters and 10 backgrounds all of them with many texture variations. I can't have all media files Loaded at the beginning of the program, I am afraid that I will hit a memory limit.
So I am stuck now, any advice will be very appreciated guys.
Thanks in advance.