Basic Principles Of Modding: Difference between revisions
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
== PAK Files == | == PAK Files == | ||
Between the client_pc and server_pc folders there are just over 150 pak files combined, all dedicated to storing the information for the game. You can open every single one of these pak files and edit all of their information to change how the game looks, sounds, and operates. | |||
== Default Paks == | == Default Paks == |
Revision as of 03:12, 28 April 2025
How does Modding Space Marine 2 Work?
When it comes to modding Space Marine 2 there is zero programming involved. A good understanding of Computer Science will take you quite a long way, but getting into modding the game is fairly straightforward and simple for complete beginners, and this wiki is designed to make it even easier to understand.
Space Marine 2's modding system does not allow us to edit any lines of actual code, but we are allowed to edit the text files that that code refers to in order to function. And while this may sound like a limitation, and it many ways it is, you would be surprised how much you can achieve.
How Does Space Marine 2's File System Work?
Space Marine 2 uses a data format known as a PAK file to store all of its game assets, this includes, models, textures, audio, everything. PAK files store data in an archive using the ZIP compression method. You can open SM2's PAK files with an archiving tool like WinRar or 7zip
File Structure

Inside the Space Marine 2 Directory you will see 3 Folders, 2 EXEs, and an INI file. These EXE files are what launch the game, the INI file is helpful for the protected game EXE, and the folders are where the game data is stored. EasyAntiCheat is a folder you generally want to ignore. Messing with the anti cheat system can screw up some serious things and get you in a lot of trouble. The folders we get free reign over however are the "client_pc" and "server_pc" folders. These folders contain ALL of the data for the game, and a majority of their contents will have information about them somewhere in this wiki.
Virtual File System
Space Marine 2 uses something called a Virtual File System for handling how resources and assets are loaded. Mods use that VFS to completely override Vanilla files with files that were modified. Space Marine 2 does not have Delta-Patching, so mods can only replace an entire file, and not parts of one.
PAK Files
Between the client_pc and server_pc folders there are just over 150 pak files combined, all dedicated to storing the information for the game. You can open every single one of these pak files and edit all of their information to change how the game looks, sounds, and operates.
Default Paks
The game stores all of its main data in what are called "Default Paks." Both the client side and the server side of the game have their own separate Default Paks. Server assets are handled in the server side paks and Client side assets are handled in the client side paks. To find these pak files, navigate to client_pc\root\paks\client\default for client paks, and server_pc\root\paks\server\default for server side paks. You can open these pak files with WinRar.
Default_Other.pak
Space Marine 2 is mainly data driven and almost all of the parameters, descriptions, defenitions, AI logic, and server scenarios are stored in "default_other.pak" This PAK files contain tons of text files written in Property Section format. Default Other is probably the most important PAK file because it contains the majority of the games editable data. If you wanted to make a change to the game, there is a 95% chance the way to do it is a file in this PAK file.
Both client_pc and server_pc, have their own seperate versions of default_other.pak. Client assets will be stored in the client_pc version, and server assets in the server_pc version. There are many instances where a file will be present in both client_pc and server_pc, and when that is the case, the two files will need to be identical to avoid crashes and data issues.
Default_SSL.pak
This pak contains all of the game's scripts in sabers own Scripting Language called "SSL". All of the game's scripts are compiled into sslbin files. As stated before, editing the games code directly is not something we can do, and is actually forbidden by Saber. So editing and replacing SSLbins is not something that is supported, and Saber has no plans to let us edit them in the future. It is best to avoid this pak because messing with it will cause massive issues with your game.
Default_PCT Paks
There are a bunch of pak files titled "default_pct_x.pak" x in this case being a number 0-31. These pak files contain all of the textures(PCT Files) in the game, they can be edited, but changing textures is a lot more involved than simple text editing, and there are better ways of going about replacing textures than doing it in these paks.
Default_TPL Paks
There are bunch of pak files titled "default_tpl_x.pak" x in this case being a number 0-8. These pak files contain all of the models for everything in the game, they can be edited, but changing Models is a lot more involved than simple text editing, and there are better ways of going about replacing them.
Default_TD.pak
default_td.pak contains all of the files needed for objects to be made of the proper materials like metal and dirt. Changing these materials is also a lot more involved than simple text editing, and there are better ways of going about replacing materials than doing it here.
Default_Sound Paks
These pak files contain all of the audio heard in the game, they can be edited but trying to navigate them is a nightmare, and adding, changing, and replacing them even more so. They are listed as strings of numbers without proper definitions and you need a license to a separate program in order to just listen to then. A spreadsheet of sounds was being developed that had information on specific sounds but it has not been updated in a long while.
Cache Files
Every PAK file is accompanied by a Cache file of the same name. The Cache file is what is used to make the data in the PAK files readable by Space Marine 2's internal System. Before the 7.0 Update, modders had to use a tool called "Pakcacher" to cache the PAK files, which would generate a new cache file with the proper information for the edits you made to the PAK file. Now thanks to Saber, after the 7.0 Update of April 2025, the way creating mods changed, and we can all leave Cache files well enough alone.
Resource Paks
Both the client and the server side of the game have resource tree metadata stored in a pak called "resources.pak". It also describes dependencies between assets and the Resource Tree. This file is edited just like any other pak file, but if you REALLY don't know what you're doing, messing with this file is going to break something major. If you'd like to read more about Resource Paks and resources trees, see: Resource_System.
Local Folder
The Local folder is a special folder in your SM2 Directory designed for the development and testing of mods. Its designed to be used while you are creating them so that you do not have to turn everything into a pak file when you want to test something. The Local folder is located in "client_pc\root".
What files can go into a Local Folder?
Any and all files can go into a Local Folder, this includes but is not limited to client side files, server side files, and resource files. The game only requires the pathing to files be correct.
How to use a Local Folder
When you are using a Local Folder to build a mod, you are treating the Local Folder as if it is the default_other.pak. So the pathing to files needs to start where the pathing to files would start in the default_other.pak.
Since Client and Server files share a lot of the same pathing within their respective default_other.pak, both client and server files can be placed in the same place. When the game loads the Folder, it will know to separate client, server, and resource files. Another thing to note is that files that are in both client_pc and server_pc, only need one instance in the local folder. Since they have identical pathing, naming, and require their contents to be identical, the Virtual File System handles the separation, and will replace both instances of a file with the single edited version in the Local Folder.
Performance Issues
While Local Folders take priority in loading assets, they load very slowly, and can cause performance issues if it is the primary way you are playing your mods. It is not recommended to actually use and operate completed versions of mods using the Local Folder. It is intended only for building mods, and generally you should not upload or send the Local folder, or files/folders intended to be put in the local folder to other users as a way of playing a finished product.
Mods Folder
The Mods Folder is a Special folder in your SM2 Directory designed specifically for mods. It is designed for the average user rather than the average mod creator, and intended to be an easy way to install finished and downloaded mods.
What goes into a Mods Folder?
Mods, specifically Mod.paks. The Mods folder will only load files that are formatted as PAK files. If a ZIP or RAR file makes its way into the folder, it will either be ignored or the game will attempt to load it but fail, and you may experience a broken game.

How does Mod Load order wok?
Mods are Loaded in Alphanumerical order. Meaning if mod_a and mod_b modify the same file, the game will use the modifications from mod_a, and if mod_a and mod_a1 modify the same file, the game will use the modifications from mod_a.
Stuff to look out for
When naming a modpak it is heavily recommended that you keep all of your letters in the name of the modpak lowercase. Not doing so can sometimes result in loading issues and crashes.
Creating a Modpak

To create a Modpak start by building it in the Local Folder, if you do not know how to do that see Local Folder.
Once you have your mod built and tested, Highlight all of the folders in the Local Folder, and right click. Select the WinRar Option, and select "Add to Archive". From the WinRar menu, you need to select the archive format "ZIP", and change the compression type to "Store".
It is very important the the compression type is set to Store. While non graphical assets can be given compression, In most cases, it is a good idea to make sure mod paks do not have any compression. If an asset that cannot receive compression ends up receiving it without you knowing it can cause crashes, infinite loading, or it may just not load at all.
The name of a pak needs to be all lowercase, but can be whatever you want. It also NEEDS to be a ".pak". The Mods folder will only load files that are formatted as PAK files. If a ZIP or RAR file makes its way into the folder, it will either be ignored or the game will attempt to load it but fail, and you may experience a broken game. (.txt files like the readme.txt will also be completely ignored in this folder)
Once you have paked your mod, it is ready to be placed into the Mods folder in your SM2 Directory. The file is also ready to be uploaded and sent to other users.
Local server
While playing with mods, the game will always force you into a private lobby. During this time, the game uses a Local Server running off of the host's computer instead of a server hosted by Saber.
How do mods work on a Local Server?
When you host a Local Server while playing modded, your mods get loaded onto a server that is being run by the host's computer, meaning in some cases, players who do not have mods installed on their device, or do not have the exact mods as you do on their device, including console players, will be able to experience the mods that you downloaded. However it is always a better idea to make sure all parties playing a modded game have the same mods installed to avoid any issues.
For a Guide on how to install mods, see How to Install Mods.
This Page is incomplete but the Tech Priest(s) who scribed it has exhausted their memory banks on this subject. If you have more information please feel free to complete the page.