Creating a Cache
What is a Cache File?[edit | edit source]
** These instructions apply to Supreme Ruler 2020, Cold War, 1936, Ultimate and Great War
Instead of compiling all the Data Files every launch of the game, Supreme Ruler creates "cache files" with the needed data already compiled. If you make changes to the Data Files that are "baked into" the cache for a particular map (scenario, campaign, sandbox or multiplayer), you will need to rebuild the cache file for that map. Cache files are found in the /Cache directory (/CacheGC for Global Crisis maps).
Cache File Creation Outline[edit | edit source]
Supreme Ruler Ultimate and Supreme Ruler Great War[edit | edit source]
These titles include an option in Scenario Settings - Force Recache for Modding. When set, the game will rebuild the cache for the launched map and place the file in the proper folder with the proper name. Deleting the cache will also force the game to recache the file into the proper folder with the proper name.
Legacy Supreme Ruler Titles[edit | edit source]
The game engine is used to create cache files. Any time it launches a map in single player, if the cache file is not found, it will build a new cache in the /savegame folder. In Multiplayer mode, the engine will not create caches. Multiplayer caches must be created in single player by copying the needed files to the appropriate locations.
These instructions are for Suprme Ruler 2020 version 5.6.2. All folders listed are found inside the game's installed directory with the possible exception of the savegame folder which Windows Vista places in a unique location on the system. If you are using Global Crisis the following folders are used instead;
- \ScenarioGC, \CampaignGC or \MultiplayerGC
Repeat these steps for each cache file you need to build
- Look in the .Scenario file for the "savfile" name of the map you want to rebuild. This is the name of the cache file.
- \Scenario, \Campaign or \Multiplayer
- Remove the old cache file from the Cache folder
- Start game, Reset all game options in the main menu.
- select the map, Launch the game. Do not adjust game settings. Selected region does not matter.
- Wait. If the map is building a cache that includes units, it may take as much as 90mins
- Once the game returns to the main menu, this indicates that the cache file creation is complete. The final step is to restore it to it's proper location.
- In Windows, copy the saved game file from your Savegame folder to the Cache folder
- Rename the file to match the name found in the .Scenario but keep the extenstion of .SAV
- Remove the CACHED - from the front of the file name
- There are nine characters to delete: <c> <a> <c> <h> <e> <d> <space> <dash> <space>
- Remove -GC from the end if using Global Crisis
This is the complete process, once the above steps have been completed, the map is ready to be reviewed for the changes made to the data files. If further changes are made, simply repeat the process.
Cache File Tips[edit | edit source]
- Multiple maps may use the same cache file
- Different cache files can have all, some or no data files in common.
- Any .SAV file can be used as a cache file
- Some data in the .Scenario or the accompanying .CSV file can be used as overrides of cached data
- When testing changes to a cache file, disable the .OOB file by adding "// " in front of that line in the .scenario to reduce cache build time to less than 5mins
- Some cache files have relations listed in the .CSV "baked in" during cache creation such that the .CSV file is no longer needed (else the overrides would be applied twice)
Cache File Creation Verbose Walk-Through[edit | edit source]
In this walkthrough I will tell you the steps involved to give Virginia a little extra cash in the Shattered World - no units scenario. I will be using the no units scenario because making the cache files with units can take a long time. The previous post on this page said it would take an hour. I have not tried to compile with units (yet). It does take a good 30 seconds without units on my PC. Your mileage may vary. Once you have made the changes you like you can easily add units using the same file.
The following walk-through assumes you can copy files and folders without detailed explanation. Also, I expect you can open files that have unknown extensions and you know where you installed the game and can get there. Please have a text editor and know how to use it.
Ok, first thing we need to do is save us from ourselves. By this, I mean we need to make backups of the files we will be changing so we can have an undo button. I made copies of the folders I would be playing with. I copied both the INI and the Maps folders. Also, in the Cache and the Savegamefolders I created a new folder in each one. I then moved all the cache and savegame files into the new folders. You can also make copies of the Campaign and the Scenario folders. However, I find it easier to make copies of the individual scenario I will be editing as I will show you next.
Second, we will be editing a scenario in the Scenario folder (Yes, there are Scenario's in the Campaign folder too). The file is called Shattered World - No Units.Scenario. Make a copy of this file and rename it to Virginia - No Units.Scenario. This is a small file and can easily be opened in notepad. On line seven you will find the following code: #include "World2020.CVP", "MAPS\". Because we will be making our changes to a different file, we will change this line to read: #include "Virginia.CVP", "MAPS\". For this walk-through we will only be changing data in these two files (The one we are in now and the Virginia.CVP file).
Third, we will take a short stroll through this file and make one more easy change. Line 62 shows this code: difficulty: 2, 2, 2. This sets the default difficuly at Normal. A five is Very Hard and a zero is Very Easy. I changed mine to difficulty: 0, 0, 0. One last look at this code. This step is important. Line 35 shows this code: //#include "ShatteredWorld.OOB", "MAPS\ORBATS\". This is the line of code which tells the game not to compile with units. Once you have made every other feature of your scenario just right you can remove the two // (forward slashes) to have the game recompile with units. Remember, you will have to remove the cache files and recompile to get units. Save and close this file.
Next, we will create the Virginia.CVP file we pointed to earlier. It is in the Maps folder. Make a copy of the World2020.CVP file and rename it to Virginia.CVP. This file can also be opened in Notepad, but it has over 40,000 lines of code. So, I suggest you open it in a program that shows line numbers. I like Notepad. To find the Virginia data we will need to do a search on Virginia. The first hit will be on line 38,460. Find the next one as we are looking for Virginia not West Virginia. Virginia starts on line 38,583. On that line you will notice the number associated with this region. This is important to know if you decide to edit the region's troop count file located in Maps\ORBATS folder. If Virginia is ever going to dominate the world it will need just a tad more cash. Just a few lines down you will see treasury on line 38,595. I am really not sure anyone can conquer the world on an empty tank. Let just throw a few more in there. Make this be 999999999999 (twelve nine's). A trillion dollars should kick start the Virginia battle plan! For me there are a few other lines of interest in here.
If you want you can skip this paragraph (if so Save and close this file) as I talk about a couple tips I have learned while toying around in this file. Changing your refpopulation can cause negative results. If you already don't produce enough petroleum, food, water or electrical energy to satisfy your poeple, raising this number can be very bad for you. I tried a trick with the natioaldebtgdp. I made it negative in the hopes it would then become a source of income. It did not. It made my total dollars go negative. I changed it back and was was once again super-rich. Lowering it close to zero made it very easy to pay off. The techlevel is nice to play with. Setting it to 200 shows you many more techs than does the 103 default. This does not give you the technology; you still have to researchAdvanced So-and-So. I changed the tourismrating to .99, but I didn't see any change in income. It may be because I don't have any tourist buildings. The gdpc may seem like great fun at first, but it is closely tied with consumption. If you crank up the gdpc your population will want to comsume more. I made mine so high I would never be able to produce enough petroleum for Virginia if I had all the oil wells in the world! However, if you make the number low like 1 you will have a jump start on your consumption. It will raise slowly day by day to approach the correct number as per your population should. You should get about one month where you people won't need much water or consumer goods before it gets back in line with the proper gdpc. Make the edits you want then Save and close.
If you have followed all the steps you should have the following:
- A file in the Maps folder called: Virginia.CVP
- A file in the Scenario folder called: Virginia - No Units.Scenario
- No files in the Cache folder
- The files already in here will not interfer with our scenario ONLY if you have copied and renamed the above two scenario files.
- No files in the Savegame folder
- This is only so that you will know which cached save file to use.
With our changes made and our file structure ready it is time to load the game. Select Single Player then Scenario. Scroll down to find Virginia - No Units and click Launch Game. There is no need to select Virginia as you home country. If there is no cache file the game will set your home as Egypt. At this point the game will appear to freeze. However, the music will play and if you have the patience it will load. As I said, my PC takes about 30 seconds to compile and load. Once the game fully loads press escape and select quit. Select quit from the main menu to exit back to Windows.
Now, we must copy over the compiled cache file. It is in the Savegame folder. It will be calledCACHED - Virginia - No Units.SAV. Copy this file and paste it into the Cache folder. Rename the file. Delete the CACHED - . Once again there are nine characters to delete: C A C H E D (space) (dash) (space)
You can now load the game like normal and select Virginia from the list. You will start the game as Virginia and save the world ... from everyone else!
To make additional changes you will need to remove the file Virginia - No Units.SAV from theCache folder and re-compile the Cache file (Do all this over again).