The mapterrain selection method used in a mission script quite often combines or lumps in together several different types of terrains, eg, by using kAnyPlanet or kAnyBase and so on.
The method takes three parameters as in put, terraintype, planettype and base type. There is 27 different terrain types, 13 different base types and 6 different planet types, making a total of 27*13*6=2,106 maps.
Thats a lot of maps, mostly only about 8 or 10 different maps ever find their way into a script.
So, I decided to make a HUGE MissionMaps.cpp file which indicidually coded for every map. All 2,107 of them. It took awhile, and I had to use the /Zm option to increase the heapsize when compiling (the file was over 64,000 lines), but it did compile.
I created a single player mct file to test out this new mission, and later I would create a map with examples of all the different map types to test them out. I added the mission to the scripts directory and went to load up the game.
3 minutes later I am still waiting for the game to load up, it normally only takes 20-30 seconds on the first load, subsequent loads even less. Finally I get to the single player campaign selector, select the Mission Testing campaign now present from the newly added mct file, and click on start new game.
Again, 3 minutes later, I'm still waiting for the new game to load up. At this point I begin to become concerned something is wrong my computer. Finally I make it into the game... move my ship around till the correct mission is triggered, and select it.
The screen hangs for 3 minutes again, then finally I make it to the briefing screen. I select 'start'... another 3 minutes goes by... and finally I make it into mission.
What is going on here?? I repeated the above several times after a fresh reboot, same result. I turned off everything non-essential as much as I could, still no difference. In desperation, I uninstall OP and reload it with a fresh copy, after repatching, adding in OP+ etc. I load uo the game and success, it load in 20 seconds again. So, I place the mission back in the scripts folder (remember, this is now a clean install, no other junk anywhere), readd the mct file, and go to load up the game.
And then it happens again, I'm waiting 3 minutes for it to load.
The mission script is bigger than usual at 1.2MB, it appears that it is the script that is causing the game to take so long to load. This would only happen if the game is doing something with mission scripts when it starts, perhaps validating them or analysing them or something. The same must happen when a new campaign is started.
The odd thing is, that I have made missions that big before, yet never seen this slowing down effect. I can only conclude that the number of different of maps is having some kind of exponential effect on the processing of the mission script by the game.
I took out the mission script, and the game returned to normal.
So, it appears that while the game does have 2,106 different map combinations, it is not practically feasible to use them all. I'll investigate further to see how many maps canbe used before this slow down effect becomes noticeable.