Jump to content

Basic Principles Of Modding: Difference between revisions

From WarhammerWorkshop
Created page with "== Space Marine 2 PAK == Game uses PAK files to store all the game assets. PAK file is essentially just ZIP archive you can open or create with any archiver. There are few requirements: * All files inside of PAK must be lower case * Format of file must be ZIP, not RAR or any other archiving format * Compression must be "Store" (No compression) ** You can compress non graphical files, but to avoid confusion and mistakes it is adviced not to use compression Vanilla PAK f..."
 
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Space Marine 2 PAK ==
= How Does Modding Space Marine 2 Work? =
Game uses PAK files to store all the game assets. PAK file is essentially just ZIP archive you can open or create with any archiver. There are few requirements:


* All files inside of PAK must be lower case
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.
* Format of file must be ZIP, not RAR or any other archiving format
* Compression must be "Store" (No compression)
** You can compress non graphical files, but to avoid confusion and mistakes it is adviced not to use compression


Vanilla PAK files are accompanied with a cache file. Cache file is not required for modding.
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.


Client and Server assets are separated. You can find client assets at '''"client_pc/root/paks/client/"''' and server assets at '''"server_pc/root/paks/server/"'''
= How Does Space Marine 2's File System Work? =


=== Resource PAK ===
Space Marine 2 uses a data format known as a '''PAK file''' to store all its assets, including models, textures, and audio.
Both client and server have resource tree metadata stored at "resources.pak". More on resources tree read at [[Resource_System]]
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].


=== Default PAK ===
== File Structure ==
Delfault paks contain all of the base game resources.
[[File:SM2 Directory.png|thumb|403x403px|SM2 Directory]]


* default_other.pak - Space Marine 2 is mainly data driven and most of the parameters, descriptions, defenitions, AI logic and server scenarios are stored there as a text files in Property Section format.
Inside the Space Marine 2 directory, you will find three folders, two executable files, and one INI configuration file.
* default_ssl.pak - this pak contains game's scripts in SSL - Saber Scripting Language. Those scripts are compiled into sslbin files. '''sslbin editing and replacement isn't supported by modding system'''
- The '''EXE''' files launch the game.
* default_pct_x.pak - contains all of the textures
- The '''INI''' file contains settings related to the game executables. 
* default_tpl_x.pak - contains all of the models
- The folders contain all the game data.
* default_td.pak - contains all of the materials


== Local server ==
The folder named '''EasyAntiCheat''' should be avoided. Tampering with anti-cheat files may cause serious issues. 
During modded sessions, game uses local server instead of server hosted by Saber. One of the players will act as a host, running a local server with all server modifications installed on their build. When playing with server mods, ensure that all players have the same server mods installed to avoid problems with server migration.
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 ==
== Virtual File System ==
Space Marine 2 uses Virtual File System for handling resources and assets. Mods use VFS to completely override vanilla files with modded files. Space Marine 2 have no delta-patching, mods can only replace file whole.


=== Local folder ===
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.
You can replace files by putting them in '''"client_pc/root/local"''' folder. You can place client, server and resource files in this local folder.
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.
[[File:Local Folder Example.png|thumb|Example on how Local Folder will look]]
Example: if you want to replace a file with path '''"/ssl/main/user/weapon_loadouts/initial_mastery_infos_library.sso"''' from defaullt_other.pak, you create the same folder structure in your local folder like this: '''"/client_pc/root/local/ssl/main/user/weapon_loadouts/initial_mastery_infos_library.sso"'''


Local folder is mostly used for development, as it can cause performance issues.
= PAK Files =


=== Mods folder ===
Between '''client_pc''' and '''server_pc''', there are over 150 PAK files combined.
Preferred way to install and redistribute mods are mod paks. You simply place your mod pak into '''"client_pc/root/mods"''' folder. Mod Paks do not require cache files, but otherwise the same as regular paks you wil find in default folder. All requirements for pak format apply too:
These store nearly all game data, allowing wide flexibility in modding the game's appearance, sounds, and behavior.


* All files inside of PAK must be lower case
= Default PAKs =
* Format of file must be ZIP, not RAR or any other archiving format
* Compression must be "Store" (No compression)
** You can compress non graphical files, but to avoid confusion and mistakes it is adviced not to use compression


As an example on how to create your mod pak, considering you have a setup in local folder, you just select all your files in local folder (not local folder itself) and use any archiver to create a zip file without compression, then change its extension to '''".pak"'''
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.


Root of your mod pak file must contain folders like "ssl", "tpl", "td" and etc,  like what you'd see in root of default paks or your local folder, not "local"
You can locate them at:
- '''client_pc\root\paks\client\default'''
- '''server_pc\root\paks\server\default'''


It is adviced to name your mod paks in lower case, as you would name internal files, to avoid unexpected problems.
== Default_Other.pak ==


Mod Paks have priority over Derfault paks. Mod Paks are loaded in alphanumerical order and the pak that was loaded first have greated priority over later modpaks. For example, if mod_a and mod_b modify the same file, game will use file from mod_a.
''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 ==
 
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 ==
 
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 ==
 
This file defines material properties such as metal, dirt, and other surface behaviors. 
Material editing is considered an advanced topic.
 
== Default_Sound PAKs ==
 
The game’s sound files are stored here. 
Navigating sound assets is challenging because files are numbered rather than named.
 
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.
 
= 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.
 
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 =
 
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 =
 
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? ==
 
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 ==
 
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 ==
 
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 =
[[File:Paking Mods Tutorial.gif|thumb|416x416px|Tutorial GIF: Click or tap to view animation.]]
 
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.
 
= Local Server =
 
When playing modded, Space Marine 2 uses a local server hosted by the player's machine.
 
== How Do Mods Work on a Local Server? ==
 
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|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.