NoMansSky:The Modding Basics: Difference between revisions

From Step Mods | Change The Game
Line 32: Line 32:


== Decompiling MBIN files ==
== Decompiling MBIN files ==
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.
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. These are basically [http://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].
The most common file type you will see throughout these new folders are .MBIN files.<br>
These are basically [http://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].


To decompile .MBIN files in '''NMS Modding Station''', just right-click on them and choose "Decompile" to see the creation of the equivalent .EXML file that you can read and edit with any text editor.<br>
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>
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>
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>
<br>
<br>

Revision as of 13:02, August 11, 2020

Template:TOC right

Introduction[edit | edit source]

This quick guide has the goal of quickly introducing fundamental aspects to modding No Man's Sky without going into many specifics.
Primarily this focuses on accessing game files to be able to modify them and then to repack them into a working mod.

For any NMS modding activity, you will always use the same few tools.
For this tutorial, you will need to download and unzip :

Unpacking the Game Assets[edit | edit source]

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.
These .PAK files are compressed using the known PSARC Format initialy designed for PlayStation games and each .PAK files stores a specific part of all the game assets.

So in order to extract assets from the archives, you may use either the PSARCTool or NMS Modding Station.
For this tutorial, we will use NMS Modding Station as it simplifies some steps : simply download it, unzip anywhere you like, and launch it.

Upon double-clicking the .exe it may initially appear dysfunctional, but this is because you first need go to Setup -> Settings.
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.
  • 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. Notepadd++ is still the best text editor as far as we know.

After you are done with these steps, you can now close the Settings window and launch the unpacking process.
To do this, simply select Unpack Game Files from the Setup dropdown menu in NMS Modding Station and the unpacking will begin.

Template:Warning Small Template:Warning Small

Decompiling MBIN files[edit | edit source]

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.
These are basically 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.

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.
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.

If you're not using NMS Modding Station, you can achieve the same following the How to use MBINCompiler page.

Template:Notice Small

Recompiling[edit | edit source]

When creating your mod, you'll need to remember that the files you modified must have the same exact directory structure as you found them originally. For example, if you modified an MBIN file inside a directory called /METADATA/REALITY/TABLES/, you must preserve the same directory structure. You don't need to copy other files in the same directories if you didn't modify them, as this will only increase the size of your mod.

If you copied the directory into another folder such as "MY MOD", your directory will be /MYMOD/METADATA/REALITY/TABLES/ and so on. However, make sure that MYMOD doesn't contain ANY special characters (e.g. ( ) or [ ]), otherwise NMS Modding Station will NOT pack the mod correctly. This is due to an aspect of PSARCTool built into Modding Station, and applies whether you're using PSARCTool.exe or NMS Modding Station to pack your mods.

Packing Mods[edit | edit source]

To create your own PSARC archive, or .pak file, configure a projects folder path in NMS Modding Station via the top left Setup Menu\Settings and set all the paths.

If you don't have any project folder yet, you can create one called something like \My Mod Projects\. Within this folder you would place \MYMOD\[duplicated game directory structure].

Once you have the directory structure sorted out and your recompiled MBINs in the appropriate folders (e.g. BASEBUILDINGTABLE.MBIN in \METADATA\REALITY\TABLES), double-click MYMOD folder in the Project tab of NMS Modding Station, right-click within the MYMOD folder, select [Pack Mod], and you'll find yourself with a .pak called MYMOD.pak. However, feel free to name this file anything you like.

Creating your first mod[edit | edit source]

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 all at the root of your unpaked files.
To edit one and create your first mod, pick 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 "Decompile" to decompile it and double-click it to open your text editor (Notepad++ is recommended). You can now observe the long list of setting names and values and make your first changes.

When you're done, do not forget to recompile the edited .EXML into a .MBIN by right clicking on the .exml and choosing "Recompile".
Then right-click on the .mbin and choose "Pack Mod" to recreate the .pak from the .mbin file.
You can now right-click and choose "Copy to your MODS folder" and launch NMS to test your changes in game !

Template:NMSPageClose