Optimization: CE Ammo
This mod was the byproduct of research leading into why Rimworld takes as long as it does to load. With the realization that a large amount of definitions is the culprit, I set my eye on Combat Extended’s ammo feature.
If you’re like me and you only use the vanilla weapons, this mod removes 87 different types of unused ammo from loading, as well as their sub-types (HP, AP, FMJ, etc.) and their projectiles fx. Combined with the removal of their recipes, abstracts, ammo sets and categories, somewhere in the neighborhood of 750 defs are omitted from the time-consuming process of definition resolving that makes up the bulk of the game’s startup time. This amounts to 5,649 fewer def resolutions (about half the size of all of CE).
Personally, the result was reducing my load time from 3:20 to 2:44. Or about an 18% gain.
This optimization patch will skip over the removal of any ammo types that it detects is actually being used by any non-vanilla guns you may have added. Do note that if you use a large number of weapon mod packs that take advantage of all that extra ammo variety in CE, this mod may not serve much purpose.
This optimization method, as it currently stands, will not work with gun mods that introduce mixed ammo sets. The patch relies on a 1:1 between ammo and the sets they belong to, as is often the case. The patch will check if any guns are using a set, and if not, delete the ammo defs belonging to it. But if that ammo belongs to another, mixed set that is being used… well, that’s how you get red text errors!
Note to CE modders: hit me up on the Rimworld discord if you’d like to know how you can work around this problem. But in short, you can create a dummy abstract that is not used for anything, where this abstract merely claims it uses a mixed ammo set. That way, the patch will be tricked into thinking those ammos are actually being used by something.
The load order may not really matter, but just in case, I would recommend this:
Should be, yes. If you get any errors, it is most likely just the game complaining about your stockpile configurations not finding the removed ammo categories anymore. These are harmless errors, and if they persist, they can be addressed by just updating your stockpile filter configs.
Please don’t hesitate to post any issues you may find. This patch uses some rather experimental PatchOperation methods that you won’t find much anywhere else in the rimworld mod collective. As far as I can tell, it’s working well and good, but with so many mods out there, who knows!
- Optimization: Meats
- Want even less? Try my Simplified CE ammo patch.