NoMansSky:The Modding Basics: Difference between revisions

From Step Mods | Change The Game
mNo edit summary
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTITLE__
{{#set:
{{NMSPage|contentTitle=The Modding Process}}
NMSIndex=Modding
{{TOC_right}}
}}{{PageTitle|logo=nomanssky|title=The Modding Basics}}
{{NMSPage}}
{{TOC}}[[Category:NoMansSky General Guides]]
== Introduction ==
== Introduction ==
This quick guide has the goal of quickly introducing fundamental aspects to modding No Man's Sky without going into many specifics.<br>
This guide will tell you how to access game files to be able to modify and then repack them into a working mod.<br><br>
Primarily this focuses on accessing game files to be able to modify them and then to repack them into a working mod.<br><br>
NMS modding essentialy requires 2 simple tools :
For any NMS modding activity, you will always use the same few tools.<br>
*[https://github.com/monkeyman192/MBINCompiler/releases MBINCompiler] by '''Monkeyman192'''
For this tutorial, you will need to download and unzip :
*[https://github.com/periander/PSArcTool PSARCTool] by '''Periander'''
* [https://github.com/monkeyman192/MBINCompiler/releases MBINCompiler] by '''Monkeyman192'''
* [https://www.nexusmods.com/nomanssky/mods/320 NMS Modding Station] by '''Tub0Crisco'''


== Unpacking the Game Assets ==
==Unpacking the game assets==
No Man's Sky stores all of its assets, from textures to models, shaders code to entity behaviors under the '''No Man's Sky/GAMEDATA/PCBANKS''' folder, in the form of .PAK files.<br>
No Man's Sky stores all of its assets, from textures to models, shaders code to entity behaviors in the form of .pak files.<br>
These .PAK files are compressed using the known [https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC) PSARC Format] initialy designed for PlayStation games and each .PAK files stores a specific part of all the game assets.
These .pak files are compressed using the known Playstation [https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC) PSARC Format] initially and they each stores a specific part of all the game assets.


So in order to extract assets from the archives, you may use either the [https://github.com/periander/PSArcTool PSARCTool] or [https://www.nexusmods.com/nomanssky/mods/320 NMS Modding Station].<br>
The simplest way to extract (and later repack) these files is [https://github.com/periander/PSArcTool PSARCTool].<br>
For this tutorial, we will use '''NMS Modding Station''' as it simplifies some steps : simply download it, unzip anywhere you like, and launch it.
For this tutorial, you simply need to download PSARCTool and unzip it anywhere you like.


Upon double-clicking the .exe it may initially appear dysfunctional, but this is because you first need go to Setup -> Settings.<br>
All the .pak files are located in the game PCBANKS folder but its path is different for Steam and for Gog :  
Indeed in order to begin unpacking, you first have to setup a few directories from the Setup menu:
* '''Unpacked Game Files Path''' - This is the where all the assets will be unpacked. You can create any folder and use it for this task.
* '''MBINCompiler''' - The folder where you placed MBINCompiler you downloaded previously. It is preferable to place this in an easy to access directory as you will come back to this tool very frequently.
* '''Project Path''' - This folder will host all your mod projects. You can create any folder to be your project folder.
{{AlertSmall‏‎|type=notice|text=Avoid to place your project folder nested too deep inside your hard drive. If the path is too long, your mod won't be able to be repacked at the end}}
* '''PCBANKS Path''' - The path to the No Man's Sky .pak source files. Its location differs if you got the game on Steam (\Steam\steamapps\common\No Man's Sky\GAMEDATA\PCBANKS\) or GOG (\GOG Galaxy\Games\No Man's Sky\GAMEDATA\PCBANKS\).
* '''EXML Editor Path''' - This is the path to your prefered text editor. [https://notepad-plus-plus.org/ Notepad++] is still highly recommended.


After you are done with these steps, you can now close the Settings window and launch the unpacking process.<br>
*for Steam : /Steam/steamapps/common/No Man's Sky/GAMEDATA/PCBANKS
To do this, simply select '''Unpack Game Files''' from the Setup dropdown menu in NMS Modding Station and the unpacking will begin.
*for Gog : /GOG Galaxy/Games/No Man's Sky/GAMEDATA/PCBANKS/


{{AlertSmall‏‎|type=warning|text=Be sure to have some free space on your hard drive. As of the 2.61.1 Update, the whole assets occupy 24.1 GB !}}
All you have to do now is to drag and drop any or all the .pak files over the Psarctools executable (for our example here, we would just need to extract NMSARC.globals.pak file) and it will unpack the game assets stored in these files.  
{{AlertSmall‏‎|type=warning|text=The unpacking process usually takes anywhere between 10-15 minutes on a SSD and 15-25 minutes on a standard HDD.}}


== Decompiling MBIN files ==
{{AlertSmall‏‎|type=warning|text=- Be sure to have some free space on your hard drive. As of the 5.12 Update, the whole assets occupy 45 GB !<br>- The unpacking process usually takes anywhere between 2 minutes on a fast NVME SSD and 15-25 minutes on a standard HDD.}}
After '''NMS Modding Station''' has finished unpacking, the '''Unpacked Game Files''' tab should now show a lot of folders and files. These are the game assets.


The most common file type you will see throughout these new folders are .MBIN files.<br>
==Decompiling MBIN files==
These are basically [https://www.w3schools.com/xml/ XML files] containing the bulk of configurations the game reads such as global settings, procedural generation rules, item databases, behaviors of in-game objects, and so on. But in a binary format. So they need a second step to be decompiled into a more human-readable form and this can be done thanks to a tool named [https://github.com/monkeyman192/MBINCompiler/releases MBINCompiler].
Once all the Psarctools command windows will be closed, you might notice a lot of new .MBIN files and folders in the PCBANKS folder. These are the game assets folders.


In '''NMS Modding Station''', to decompile .MBIN files, you just need to right-click one of them and choose "Decompile" to see the creation of the equivalent .EXML file that you can read and edit with any text editor.<br>
The most common file type you will see throughout these new folders are indeed .MBIN files.<br>
When later you will need to convert the file back, just right-click on the .EXML file, click on "Compile" and it will convert the .EXML file back into the .MBIN file.<br>
These are basically compiled [https://www.w3schools.com/xml/ XML files] containing the bulk of configurations the game reads such as global settings, procedural generation rules, item databases, behaviors of in-game objects, and so on. But in a binary format. So they need a second step to be decompiled into a more human-readable form and this can be done thanks to a tool named [https://github.com/monkeyman192/MBINCompiler/releases MBINCompiler].
<br>
If you're not using '''NMS Modding Station''', you can achieve the same following the [https://stepmodifications.org/wiki/NMS:Tutorials/HowToMBINCompiler How to use MBINCompiler page].  


{{AlertSmall‏‎|type=notice|text=Be sure to make a copy of any .MBIN you want to edit in a project folder of your choice before editing them. This way you will keep all the original game files without having to unpack the archives all over again because you once edited them for another project.}}
Once again, you just need to unzip MBINCompiler anywhere and it is ready to use.  


== Creating your first mod project ==
All the details on how to use MBINCompiler are summed up in the [https://stepmodifications.org/wiki/NoMansSky:Tutorials/HowToMBINCompiler How to use MBINCompiler page] but basically, you can just drag and drop any .MBIN file over the MBINCompiler executable and it will convert it into an .EXML file.  
To start with NMS modding, the most impactful files are [https://stepmodifications.org/wiki/NMS:Reference_Guides/Global_Files GLOBALS]. Globals are configuration files storing all the NMS global settings and you will find them all at the root of your unpaked files.<br>
To edit one and create your first mod, select a file with a name that points toward a theme you would like to change in NMS, like SkyGlobals or AISpaceShipGlobals. Then right-click and choose "Copy to project Path". Doing so, you will create a copy of the original .MBIN file and won't edit the original file by mistake.<br>
As this is your first mod project, '''NMS Modding Station''' will ask you to create a new project folder. Name it to your likings and here you are with your own project tab currently hosting the only .MBIN file you chose.
The next step is now to decompile it and it just needs to double-click the file.<br>


== Making changes and create your mod ==  
To start with NMS modding, the most impactful files are [https://stepmodifications.org/wiki/NoMansSky:Reference_Guides/Global_Files GLOBALS]. Globals are configuration files storing all the NMS global settings and you will find them at the root of your unpaked files. In order to create your first mod, convert an .MBIN file with a name pointing toward a theme you would like to change in NMS, like GCSKYGLOBALS.GLOBALS.MBIN or GCSPACESHIPGLOBALS.GLOBALS.MBIN.
Once in .EXML format, you can now explore all the game settings and make the changes you like.<br>
 
To do so, double-click your .EXML file to open it in your text editor. You can now observe the long list of setting names and values and make your first changes.<br>
==Editing files==  
<br>
Once in .EXML format, you can now open the file with a text editor ([https://notepad-plus-plus.org/ Notepad++] is highly recommended).
When you're done, do not forget to recompile the edited .EXML into a .MBIN by right clicking on the .exml and choosing "Recompile".<br>
 
This will convert the .EXML including all your changes into the .MBIN file again.<br>
You can now observe the long list of setting names and values and make your first changes. Don't be shy. Even if there's plenty of them and they are sometimes weirdly labelled, most properties are self-explanatory. Choose one you guessed the effect in game and change its value.
<br>
 
Then right-click in the project window and choose "Pack Mod". This will create a .pak file including all the project files : your first mod is done !<br>
Of course, guesses are not always immeditalety rewarding. The result can sometimes greatly vary from what you initialy guessed so if you see no change in game, be sure to try another change.
<br>
 
Ready for a test ?<br>
==Creating your first mod==
You can now right-click your .pak file and choose "Copy to your MODS folder".
When you're done with your changes, save the .exml file.
The last step is now to launch NMS to test your changes in game !
 
{{NMSPageClose}}
You will now need to do the reversed operations :
[[Category:NoMansSky Tutorials]]
 
* Drag and drop the .EXML file on MBINCompiler will rebuild a .MBIN file
* Drag and drop the .MBIN file over PsarcTool will rebuild a .pak file
 
Note that you don't need to repack all the files you initaly extracted from the .pak. In fact, to get small and compatible mods, it's better to only repack files you needed to edit for the mod (here, a single .MBIN file).
 
Also note that if the edited files are in a game subfolder (like TEXTURES), you will need to keep the folder and drag it over PsarcTools to store the file path. Here again, you only need to include the modified files and the folders that contain them. You can get more details about this on [[NoMansSky:Tutorials/HowToPSARCTool|this page describing PSARCTool]].
==Testing your mod==
A psarc.pak file has appeared in the same folder as the Psarctools executable ?
 
Well done, you created your very first mod ! Just rename it to something more tasty and copy this .pak like any mod in the PCBANKS/MODS folder (and be sure you removed the DISABLEMODS.txt file).
 
It is now time to start the game and check in game if you guessed well and if your changes are impactful. The first of many many tests to come :)

Latest revision as of 09:49, October 20, 2024

Nomanssky flare.png

The Modding Basics

Introduction

This guide will tell you how to access game files to be able to modify and then repack them into a working mod.

NMS modding essentialy requires 2 simple tools  :

Unpacking the game assets

No Man's Sky stores all of its assets, from textures to models, shaders code to entity behaviors in the form of .pak files.
These .pak files are compressed using the known Playstation PSARC Format initially and they each stores a specific part of all the game assets.

The simplest way to extract (and later repack) these files is PSARCTool.
For this tutorial, you simply need to download PSARCTool and unzip it anywhere you like.

All the .pak files are located in the game PCBANKS folder but its path is different for Steam and for Gog :

  • for Steam : /Steam/steamapps/common/No Man's Sky/GAMEDATA/PCBANKS
  • for Gog : /GOG Galaxy/Games/No Man's Sky/GAMEDATA/PCBANKS/

All you have to do now is to drag and drop any or all the .pak files over the Psarctools executable (for our example here, we would just need to extract NMSARC.globals.pak file) and it will unpack the game assets stored in these files.

Warning-Logo.png
WARNING:
- Be sure to have some free space on your hard drive. As of the 5.12 Update, the whole assets occupy 45 GB !
- The unpacking process usually takes anywhere between 2 minutes on a fast NVME SSD and 15-25 minutes on a standard HDD.

Decompiling MBIN files

Once all the Psarctools command windows will be closed, you might notice a lot of new .MBIN files and folders in the PCBANKS folder. These are the game assets folders.

The most common file type you will see throughout these new folders are indeed .MBIN files.
These are basically compiled XML files containing the bulk of configurations the game reads such as global settings, procedural generation rules, item databases, behaviors of in-game objects, and so on. But in a binary format. So they need a second step to be decompiled into a more human-readable form and this can be done thanks to a tool named MBINCompiler.

Once again, you just need to unzip MBINCompiler anywhere and it is ready to use.

All the details on how to use MBINCompiler are summed up in the How to use MBINCompiler page but basically, you can just drag and drop any .MBIN file over the MBINCompiler executable and it will convert it into an .EXML file.

To start with NMS modding, the most impactful files are GLOBALS. Globals are configuration files storing all the NMS global settings and you will find them at the root of your unpaked files. In order to create your first mod, convert an .MBIN file with a name pointing toward a theme you would like to change in NMS, like GCSKYGLOBALS.GLOBALS.MBIN or GCSPACESHIPGLOBALS.GLOBALS.MBIN.

Editing files

Once in .EXML format, you can now open the file with a text editor (Notepad++ is highly recommended).

You can now observe the long list of setting names and values and make your first changes. Don't be shy. Even if there's plenty of them and they are sometimes weirdly labelled, most properties are self-explanatory. Choose one you guessed the effect in game and change its value.

Of course, guesses are not always immeditalety rewarding. The result can sometimes greatly vary from what you initialy guessed so if you see no change in game, be sure to try another change.

Creating your first mod

When you're done with your changes, save the .exml file.

You will now need to do the reversed operations :

  • Drag and drop the .EXML file on MBINCompiler will rebuild a .MBIN file
  • Drag and drop the .MBIN file over PsarcTool will rebuild a .pak file

Note that you don't need to repack all the files you initaly extracted from the .pak. In fact, to get small and compatible mods, it's better to only repack files you needed to edit for the mod (here, a single .MBIN file).

Also note that if the edited files are in a game subfolder (like TEXTURES), you will need to keep the folder and drag it over PsarcTools to store the file path. Here again, you only need to include the modified files and the folders that contain them. You can get more details about this on this page describing PSARCTool.

Testing your mod

A psarc.pak file has appeared in the same folder as the Psarctools executable ?

Well done, you created your very first mod ! Just rename it to something more tasty and copy this .pak like any mod in the PCBANKS/MODS folder (and be sure you removed the DISABLEMODS.txt file).

It is now time to start the game and check in game if you guessed well and if your changes are impactful. The first of many many tests to come :)