Jump to content

Basic Principles Of Modding: Difference between revisions

From WarhammerWorkshop
HAPPYMAN5 (talk | contribs)
No edit summary
No edit summary
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
== How does Modding Space Marine 2 Work? ==
= How Does Modding Space Marine 2 Work? =
Modding Space Marine 2 isn't like Modding Minecraft. There's 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 files do 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 do.
When it comes to modding ''Space Marine 2'', no programming is required. A strong understanding of computer science principles will help, but getting started is straightforward even for complete beginners. This wiki is designed to make the process even easier to understand.
 
Space Marine 2's modding system does not allow direct editing of the game's compiled code. Instead, it allows us to modify text-based configuration files that the game’s code references. While this may seem like a limitation, you would be surprised at how much can still be accomplished through text editing.


= How Does Space Marine 2's File System Work? =
= How Does Space Marine 2's File System Work? =
Space Marine 2 uses a compression format known as a PAK file to store all of its game assets, this includes, models, textures, audio, everything. PAK files are a format of compression archive like a ZIP  or RAR file. You can open SM2's PAK files with any archiving tool, but we suggest [https://www.win-rar.com/download.html?&L=0 WinRar].


=== File Structure ===
Space Marine 2 uses a data format known as a '''PAK file''' to store all its assets, including models, textures, and audio. 
PAK files are compressed archives using the standard ZIP compression method. 
You can open Space Marine 2's PAK files using [https://www.win-rar.com/download.html WinRAR] or [https://www.7-zip.org/download.html 7-Zip].
 
== File Structure ==
[[File:SM2 Directory.png|thumb|403x403px|SM2 Directory]]
[[File:SM2 Directory.png|thumb|403x403px|SM2 Directory]]
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 ===
Inside the Space Marine 2 directory, you will find three folders, two executable files, and one INI configuration file. 
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 [[wikipedia:Delta_update|Delta-Patching]], so mods can only replace an entire file, and not parts of one.
- The '''EXE''' files launch the game. 
- The '''INI''' file contains settings related to the game executables. 
- The folders contain all the game data.
 
The folder named '''EasyAntiCheat''' should be avoided. Tampering with anti-cheat files may cause serious issues. 
The folders modders are permitted to explore are '''client_pc''' and '''server_pc'''. These contain all client and server-side data for the game, much of which is described in this wiki.
 
== Virtual File System ==
 
Space Marine 2 uses a '''Virtual File System (VFS)''' to manage asset loading. Mods override vanilla files using the VFS by supplying altered versions of the same files.
Since Space Marine 2 does not use [[wikipedia:Delta_update|Delta Patching]], mods must replace the entire file rather than patching only parts of one.
 
= PAK Files =
 
Between '''client_pc''' and '''server_pc''', there are over 150 PAK files combined. 
These store nearly all game data, allowing wide flexibility in modding the game's appearance, sounds, and behavior.
 
= Default PAKs =
 
Space Marine 2 organizes core data into "Default PAKs":
- Client-side assets are found in client default PAKs.
- Server-side assets are found in server default PAKs.
 
You can locate them at:
- '''client_pc\root\paks\client\default'''
- '''server_pc\root\paks\server\default'''
 
== Default_Other.pak ==
 
''default_other.pak'' is one of the most important PAK files. It contains:
- Game parameters
- Descriptions
- Definitions
- AI logic
- Server scenarios
 
These are stored as text files written in Property Section format.
 
Both '''client_pc''' and '''server_pc''' have their own versions of ''default_other.pak''. 
If a file exists in both locations, '''the two copies must be identical''' to avoid crashes and desyncs.
 
== Default_SSL.pak ==
 
This PAK contains the game's compiled scripts, written in Saber Interactive’s proprietary '''Saber Scripting Language (SSL)'''. 
Scripts are compiled into '''sslbin''' files.
 
Editing SSL files is '''not supported''' and explicitly forbidden. Tampering with them can cause major game issues and is strongly discouraged.
 
== Default_PCT PAKs ==


== PAK Files ==
Files like ''default_pct_0.pak'' to ''default_pct_31.pak'' contain all game textures (PCT files). 
Inside of the client_pc and server_pc folders are a hundreds of pak files 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.
Texture editing is possible but more complex than text editing.


== Default Paks ==
== Default_TPL 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 ===
Files like ''default_tpl_0.pak'' to ''default_tpl_8.pak'' store all 3D models.
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.  
Model editing requires specialized knowledge and tools.


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_TD.pak ==


=== Default_SSL.pak ===
This file defines material properties such as metal, dirt, and other surface behaviors.
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. 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 really mess your game up.
Material editing is considered an advanced topic.


=== Default_PCT Paks ===
== Default_Sound 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 ===
The game’s sound files are stored here.
There are bunch of pak files titled "default_tpl_x.pak" x in this case being a number 1-6. 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.
Navigating sound assets is challenging because files are numbered rather than named.


=== Default_TD.pak ===
A [https://docs.google.com/spreadsheets/d/1KH8KhYk-Q_PQdi0GG8zdc0JkM0NeX8xV-z1DXekPjJ4/edit?gid=0#gid=0 spreadsheet] of sound mappings was being developed but is currently outdated.
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 ===
= Cache Files =
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 [https://docs.google.com/spreadsheets/d/1KH8KhYk-Q_PQdi0GG8zdc0JkM0NeX8xV-z1DXekPjJ4/edit?gid=0#gid=0 spreadsheet of sounds] was being developed that had information on specific sounds but it has not been updated in a long while.


== Cache Files ==
Each PAK file is paired with a Cache file of the same name. Cache files allow the game to quickly index and load asset data.
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. In the land of long ago, Cave Men Modders would use a magical 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 ==
Before Update 7.0 (April 2025), modders needed a tool called '''Pakcacher''' to manually rebuild Cache files.
Both the client and the server side of the game have resource tree metadata stored in a pak called "resources.pak". 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]].
After Update 7.0, Saber enabled automatic cache handling, and manual intervention is no longer required.


== Local Folder ==
= Resource PAKs =
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? ===
Both client and server sides use a '''resources.pak''' to manage metadata about asset dependencies and the Resource Tree.
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 ===
Incorrect edits can severely break the game. 
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.  
For more details, see: [[Resource_System]].


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.
= Local Folder =


=== Performance Issues ===
The '''Local''' folder is a special area inside ''client_pc\root'' designed for development and testing of mods.
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 ==
== What Files Can Go Into a Local 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? ===
Any client-side, server-side, or resource file can be placed into the Local folder, provided the folder path structure matches the game’s originals.
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? ===
== How to Use the Local Folder ==
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_a1 and mod_a modify the same file, the game will use the modifications from mod_a1.


=== Stuff to look out for ===
Treat the Local folder like an unpacked version of '''default_other.pak'''. 
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.
File and folder structures must match the originals exactly.
 
Files present in both '''client_pc''' and '''server_pc''' only need one copy in the Local folder. 
The Virtual File System will correctly map them.
 
== Performance Issues ==
 
The Local folder loads more slowly than packed PAK files and may cause performance degradation. 
It is recommended for development and testing only, not for playing completed mods.
 
= Mods Folder =
 
The '''Mods''' folder is meant for distributing and loading finalized mods.
 
== What Goes into the Mods Folder? ==
 
Only properly packed '''.pak''' files should be placed here. 
ZIP, RAR, and text files will either be ignored or cause loading failures.
 
[[File:Mod Load order.png|thumb|Alphanumerical Load Order (Top to Bottom)]]
 
== How Does Mod Load Order Work? ==
 
Mods are loaded in '''alphanumerical order'''. 
If two mods modify the same file:
- The alphabetically first mod will take precedence.
 
== Important Naming Advice ==
 
Always use '''lowercase letters''' when naming PAK files.
Capitalization errors can lead to crashes or broken mods.


= Creating a Modpak =
= Creating a Modpak =
[[File:Paking Mods Tutorial.gif|thumb|416x416px]]
[[File:Paking Mods Tutorial.gif|thumb|416x416px|Tutorial GIF: Click or tap to view animation.]]
To create a Modpak start by building it in the Local Folder, if you do not know how to do that see [[Basic Principles Of Modding#Local folder|Local Folder]].
 
To create a Modpak:
# Build and test your mod inside the '''Local''' folder. (See [[Basic Principles Of Modding#Local Folder|Local Folder]])
# Select all modified folders/files.
# Right-click and choose "Add to Archive" via WinRAR.
# Set:
* Archive format: '''ZIP'''
* Compression method: '''Store'''
 
'''Important''': Using compression other than Store may cause the game to crash or hang.
 
Ensure:
- The file is named in all lowercase.
- The file has a ''.pak'' extension.
 
Place the resulting PAK into the Mods folder for use or distribution.


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".
= Local Server =


It is very important the the compression type is set to Store. Mod Paks cannot have any amount of compression or they will cause crashes, infinite loading, or they will just not load at all.  
When playing modded, Space Marine 2 uses a local server hosted by the player's machine.


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.
== How Do Mods Work on a Local Server? ==


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.
Hosting a game with mods allows:
- Players without the mod to experience some modded content.
- However, mismatched or missing mods between players may cause issues.


== Local server ==
It is recommended that all players install the same mod set when playing together.
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. This method is called [[wikipedia:Peer-to-peer|Peer-to-Peer (P2P).]]


=== How do mods work on a Local Server? ===
For installation instructions, see [[How To Install Mods|How to Install Mods]].
When you host a Local Server while playing modded, your mods get loaded onto the server, 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|How to Install Mods]].
<blockquote>This page is incomplete. The Tech Priest(s) responsible have exhausted their memory banks. Please contribute additional information if available.</blockquote>

Latest revision as of 13:11, 29 April 2025

How Does Modding Space Marine 2 Work?[edit | edit source]

When it comes to modding Space Marine 2, no programming is required. A strong understanding of computer science principles will help, but getting started is straightforward even for complete beginners. This wiki is designed to make the process even easier to understand.

Space Marine 2's modding system does not allow direct editing of the game's compiled code. Instead, it allows us to modify text-based configuration files that the game’s code references. While this may seem like a limitation, you would be surprised at how much can still be accomplished through text editing.

How Does Space Marine 2's File System Work?[edit | edit source]

Space Marine 2 uses a data format known as a PAK file to store all its assets, including models, textures, and audio. PAK files are compressed archives using the standard ZIP compression method. You can open Space Marine 2's PAK files using WinRAR or 7-Zip.

File Structure[edit | edit source]

SM2 Directory

Inside the Space Marine 2 directory, you will find three folders, two executable files, and one INI configuration file. - The EXE files launch the game. - The INI file contains settings related to the game executables. - The folders contain all the game data.

The folder named EasyAntiCheat should be avoided. Tampering with anti-cheat files may cause serious issues. The folders modders are permitted to explore are client_pc and server_pc. These contain all client and server-side data for the game, much of which is described in this wiki.

Virtual File System[edit | edit source]

Space Marine 2 uses a Virtual File System (VFS) to manage asset loading. Mods override vanilla files using the VFS by supplying altered versions of the same files. Since Space Marine 2 does not use Delta Patching, mods must replace the entire file rather than patching only parts of one.

PAK Files[edit | edit source]

Between client_pc and server_pc, there are over 150 PAK files combined. These store nearly all game data, allowing wide flexibility in modding the game's appearance, sounds, and behavior.

Default PAKs[edit | edit source]

Space Marine 2 organizes core data into "Default PAKs": - Client-side assets are found in client default PAKs. - Server-side assets are found in server default PAKs.

You can locate them at: - client_pc\root\paks\client\default - server_pc\root\paks\server\default

Default_Other.pak[edit | edit source]

default_other.pak is one of the most important PAK files. It contains: - Game parameters - Descriptions - Definitions - AI logic - Server scenarios

These are stored as text files written in Property Section format.

Both client_pc and server_pc have their own versions of default_other.pak. If a file exists in both locations, the two copies must be identical to avoid crashes and desyncs.

Default_SSL.pak[edit | edit source]

This PAK contains the game's compiled scripts, written in Saber Interactive’s proprietary Saber Scripting Language (SSL). Scripts are compiled into sslbin files.

Editing SSL files is not supported and explicitly forbidden. Tampering with them can cause major game issues and is strongly discouraged.

Default_PCT PAKs[edit | edit source]

Files like default_pct_0.pak to default_pct_31.pak contain all game textures (PCT files). Texture editing is possible but more complex than text editing.

Default_TPL PAKs[edit | edit source]

Files like default_tpl_0.pak to default_tpl_8.pak store all 3D models. Model editing requires specialized knowledge and tools.

Default_TD.pak[edit | edit source]

This file defines material properties such as metal, dirt, and other surface behaviors. Material editing is considered an advanced topic.

Default_Sound PAKs[edit | edit source]

The game’s sound files are stored here. Navigating sound assets is challenging because files are numbered rather than named.

A spreadsheet of sound mappings was being developed but is currently outdated.

Cache Files[edit | edit source]

Each PAK file is paired with a Cache file of the same name. Cache files allow the game to quickly index and load asset data.

Before Update 7.0 (April 2025), modders needed a tool called Pakcacher to manually rebuild Cache files. After Update 7.0, Saber enabled automatic cache handling, and manual intervention is no longer required.

Resource PAKs[edit | edit source]

Both client and server sides use a resources.pak to manage metadata about asset dependencies and the Resource Tree.

Incorrect edits can severely break the game. For more details, see: Resource_System.

Local Folder[edit | edit source]

The Local folder is a special area inside client_pc\root designed for development and testing of mods.

What Files Can Go Into a Local Folder?[edit | edit source]

Any client-side, server-side, or resource file can be placed into the Local folder, provided the folder path structure matches the game’s originals.

How to Use the Local Folder[edit | edit source]

Treat the Local folder like an unpacked version of default_other.pak. File and folder structures must match the originals exactly.

Files present in both client_pc and server_pc only need one copy in the Local folder. The Virtual File System will correctly map them.

Performance Issues[edit | edit source]

The Local folder loads more slowly than packed PAK files and may cause performance degradation. It is recommended for development and testing only, not for playing completed mods.

Mods Folder[edit | edit source]

The Mods folder is meant for distributing and loading finalized mods.

What Goes into the Mods Folder?[edit | edit source]

Only properly packed .pak files should be placed here. ZIP, RAR, and text files will either be ignored or cause loading failures.

Alphanumerical Load Order (Top to Bottom)

How Does Mod Load Order Work?[edit | edit source]

Mods are loaded in alphanumerical order. If two mods modify the same file: - The alphabetically first mod will take precedence.

Important Naming Advice[edit | edit source]

Always use lowercase letters when naming PAK files. Capitalization errors can lead to crashes or broken mods.

Creating a Modpak[edit | edit source]

Tutorial GIF: Click or tap to view animation.

To create a Modpak:

  1. Build and test your mod inside the Local folder. (See Local Folder)
  2. Select all modified folders/files.
  3. Right-click and choose "Add to Archive" via WinRAR.
  4. Set:
  • Archive format: ZIP
  • Compression method: Store

Important: Using compression other than Store may cause the game to crash or hang.

Ensure: - The file is named in all lowercase. - The file has a .pak extension.

Place the resulting PAK into the Mods folder for use or distribution.

Local Server[edit | edit source]

When playing modded, Space Marine 2 uses a local server hosted by the player's machine.

How Do Mods Work on a Local Server?[edit | edit source]

Hosting a game with mods allows: - Players without the mod to experience some modded content. - However, mismatched or missing mods between players may cause issues.

It is recommended that all players install the same mod set when playing together.

For installation instructions, see How to Install Mods.

This page is incomplete. The Tech Priest(s) responsible have exhausted their memory banks. Please contribute additional information if available.