Difference between revisions of "Modding"

From Linux Gaming
Jump to navigation Jump to search
 
(38 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Game mods modify games in some way. A good source for mods is https://www.nexusmods.com. Sometimes they work in the same way as on Windows, but that's not always the case. [[Reshade|Res?hade]] is an example for a modding tool.
Game mods modify games in some way. A good source for mods is https://www.nexusmods.com. Sometimes they work in the same way as on Windows, but that's not always the case. [[Reshade]] is an example for a modding tool. If you're using Steam, [[Steam#Steam Tinker Launch|Steam Tinker Launch]] may make your life a lot easier.


== Mod Manager ==
== Mod Manager ==
You can try installing mod Managers from [[Lutris]], if there is an install script. There are scripts (for older versions of) Vortex and NMM.
Mod managers that are not native will not set dll overrides. If the installed mod uses dlls, you have to [[Installing dlls#DLL overrides|set the overrides manually]].


Otherwise, you can try installing them in the same wine prefix. You could do this for example the following way:
=== Install mod managers with Wine ===
You can try installing mod managers from [[Lutris]], if there is an install script. For example there are scripts (for older versions of) Vortex and NMM.
 
Otherwise, you can try installing them in the same wine prefix. You could do this for example in the following way:


* Copy the executable into the wine prefix of your game: <code>~/Games/<your_game>/drive_c/users/<your_name>/Downloads/</code>
* Copy the executable into the wine prefix of your game: <code>~/Games/<your_game>/drive_c/users/<your_name>/Downloads/</code>
* In Lutris, click your game, then click on the arrow next to the wine bottle on the bottom of the window. Click <code>Run EXE inside Wine prefix</code>
*Run it in the same prefix as your game:
* Locate the exe, and run it.
** Lutris: Click your game, then click on the arrow next to the wine bottle on the bottom of the window. Click <code>Run EXE inside Wine prefix</code>. Locate the exe, and run it.
**Bottles: todo
**Steam: Use ProtonTricks to run EXE files in the same prefix as your game and install or run the mod manager from there.
**Heroic: todo
* If it works, you can locate the executable of the installed mod manager, and run it in this way. Otherwise, you can also create a new "game" in the same wine prefix and select the executable there. TODO: describe how.
* If it works, you can locate the executable of the installed mod manager, and run it in this way. Otherwise, you can also create a new "game" in the same wine prefix and select the executable there. TODO: describe how.
*You can also install the mod manager in a different prefix, and symlink the game folder into the prefix
=== Install mod managers in a VM ===
If a mod manager is not working well with wine, you can install Windows in VirtualBox, share your game folder with the VM, and install the mod manager inside the VM. You need to install the guest additions for it to work. The folder will be mounted as network drive Z. This will not work with every mod manager and every mod. For example it will not work with MO2 (however, MO2 is working in Wine<ref>https://github.com/Modorganizer2/modorganizer/issues/372</ref>).
If you want to mod a Linux native game, you can try creating a fake .exe in order for the mod manager to detect the game.
In more detail:
# Install the game on Linux, for example with Lutris, Heroic, or Steam.
# Install Windows in a VM
# Share the game folder with the Windows VM
# Install a mod manager in the Windows VM
# Use the mod manager to install a mod
# Play the game that is now modded (on Linux, without VM)
Optional: Disable internet access for the VM, and enable drag/drop to copy files easily to the VM. This way, Windows can not send telemetry data, or do unnecessary updates that just take space and processing time. You might even use older (and lighter) versions like Windows 7 if the mod manager is compatible. In this case, you will have to manually download mods, though.


== Manual Installation ==
== Manual Installation ==
=== DLL overrides ===
The game can either use ''native'' dlls that come with the game, or use ''builtin'' dlls that come with wine. It (sometimes?/usually?) uses only the ''builtin'' dlls.


On Windows, the game would do it the other way around, and first use ''all'' dlls in the game directory, and only if the dll is not there, look somewhere else.
=== Installing "normal" mods ===
For many games, you need to place a mod file in a certain folder, like <code>game_folder/mods</code>. If you installed your game with wine or proton, the same exact folder also exists on Linux, however it is located inside your wine/proton prefix. Where this is, depends on how you installed your game: [[Lutris#Where are save games and other game files?|Lutris]], [[Steam#File Locations|Steam]], [[Heroic#File locations|Heroic]], [[Bottles#File Locations|Bottles]].
 
=== Installing dlls ===
In many cases (for example reshade, specialK) you just need a dll in your game folder. Just download the exe, extract it, and [[Installing dlls#Manual|manually install the dll]].  


Now if you put a different dll from a mod inside the game directory, this will not (not always?) work.
You might have to rename it, for example to


That's why you have to tell wine, that it should use the dll from the mod.
* <code>d3d9.dll</code> if your game uses Directx9 (this is more likely for older games)
* <code>dxgi.dll</code> if your game uses Directx11 (this is more likely for newer games)


==== Example ====
or something like that.  
For example, if you want to tell wine to use the ''d3dcompiler_47.dll'' that's in your game folder, and only use the builtin dll if it can't find any dll in the game folder, you would do the following:


Open Lutris, click your game, on the bottom, click the up-arrow right next to the wine bottle icon, click <code>Wine configuration</code>, click <code>Libraries</code>, and
Also note that you should use a dll that has the architecture of your game, so if the game is 32 bit, you might need to choose another dll than if your game is 64 bit (often indicated by a 32 or a 64 in the dll filename).
*insert the name of the dll (without the .dll) <code>d3dcompiler_47</code> in the text box under <code>New override for library</code>.
*select it in the list, click <code>Edit</code> and select <code>native, then builtin</code>
Alternatively, you could also set <code>WINEDLLOVERRIDES="d3dcompiler_47=n,b"</code> as an environment variable.


=== Path names ===
=== Path names ===
Linux paths are case sensitive, while Windows paths are not. This leads to mod developers using different folder names when referring to the same folder, for example ''folderName'' and ''Foldername''. If your mod doesn't work, this might be the issue, and you can try changing the names so that they are consistent.
Linux paths are case sensitive, while Windows paths are not. This leads to mod developers using different folder names when referring to the same folder, for example ''textures'' and ''Textures''.  
 
Wine knows that, and is able to handle it accordingly. However, if you manually copy the mod to it's destination with your Linux file manager, you might get problems if you create an additional folder. There are a couple options to avoid these problems:
 
* If you encounter a problem, look at the file structures to detect problems. You can use <code>find . -type d | tr "[A-Z]" "[a-z]" | sort | uniq -c | grep -v " 1 "</code> to find conflicts. <ref>https://www.reddit.com/r/linux_gaming/comments/1091xud/comment/j3wgz4a/?context=3</ref>
*Use a mod manager that you install with wine.
* Use ext4 with [https://www.collabora.com/news-and-blog/blog/2020/08/27/using-the-linux-kernel-case-insensitive-feature-in-ext4/ case folding]. (The SteamDeck uses ext4 with case folding by default.)
* Install 7zip for Windows and use that to extract and move the mod to it's destination. 7zip also comes with a file manager that you can use. You could also use any other Windows file manager. It just needs access to the game folder. Either install it in the same prefix, or use it's own prefix and symlink the game folder.


== Trainer ==
== Trainer ==
You can use [https://github.com/leaty/tuxtrain tuxtrain] or [https://github.com/korcankaraokcu/PINCE PINCE].
{{Needs work|Problem=I didn't test any of these, and just copied some links from answers to reddit posts asking about this kind of stuff. Maybe some are redundant or not working well. Please edit this if you have any idea what these tools do}}
*[https://github.com/leaty/tuxtrain tuxtrain]
* [https://github.com/korcankaraokcu/PINCE PINCE]
* [https://github.com/scanmem/scanmem scanmem]
* [https://linuxhint.com/use-gameconqueror-cheat-engine-linux/ gameconqueror]
* [https://github.com/evg-zhabotinsky/libspeedhack libspeedhack]


== Linux native modding tools ==
== Linux native modding tools ==
There are some game specific Linux native modding tools, you may find a list [[Game specific modding tools|here]].
There are some game specific Linux native modding tools, you may find a list [[Game specific modding tools|here]].

Latest revision as of 09:06, 3 June 2024

Game mods modify games in some way. A good source for mods is https://www.nexusmods.com. Sometimes they work in the same way as on Windows, but that's not always the case. Reshade is an example for a modding tool. If you're using Steam, Steam Tinker Launch may make your life a lot easier.

Mod Manager

Mod managers that are not native will not set dll overrides. If the installed mod uses dlls, you have to set the overrides manually.

Install mod managers with Wine

You can try installing mod managers from Lutris, if there is an install script. For example there are scripts (for older versions of) Vortex and NMM.

Otherwise, you can try installing them in the same wine prefix. You could do this for example in the following way:

  • Copy the executable into the wine prefix of your game: ~/Games/<your_game>/drive_c/users/<your_name>/Downloads/
  • Run it in the same prefix as your game:
    • Lutris: Click your game, then click on the arrow next to the wine bottle on the bottom of the window. Click Run EXE inside Wine prefix. Locate the exe, and run it.
    • Bottles: todo
    • Steam: Use ProtonTricks to run EXE files in the same prefix as your game and install or run the mod manager from there.
    • Heroic: todo
  • If it works, you can locate the executable of the installed mod manager, and run it in this way. Otherwise, you can also create a new "game" in the same wine prefix and select the executable there. TODO: describe how.
  • You can also install the mod manager in a different prefix, and symlink the game folder into the prefix

Install mod managers in a VM

If a mod manager is not working well with wine, you can install Windows in VirtualBox, share your game folder with the VM, and install the mod manager inside the VM. You need to install the guest additions for it to work. The folder will be mounted as network drive Z. This will not work with every mod manager and every mod. For example it will not work with MO2 (however, MO2 is working in Wine[1]).

If you want to mod a Linux native game, you can try creating a fake .exe in order for the mod manager to detect the game.

In more detail:

  1. Install the game on Linux, for example with Lutris, Heroic, or Steam.
  2. Install Windows in a VM
  3. Share the game folder with the Windows VM
  4. Install a mod manager in the Windows VM
  5. Use the mod manager to install a mod
  6. Play the game that is now modded (on Linux, without VM)

Optional: Disable internet access for the VM, and enable drag/drop to copy files easily to the VM. This way, Windows can not send telemetry data, or do unnecessary updates that just take space and processing time. You might even use older (and lighter) versions like Windows 7 if the mod manager is compatible. In this case, you will have to manually download mods, though.

Manual Installation

Installing "normal" mods

For many games, you need to place a mod file in a certain folder, like game_folder/mods. If you installed your game with wine or proton, the same exact folder also exists on Linux, however it is located inside your wine/proton prefix. Where this is, depends on how you installed your game: Lutris, Steam, Heroic, Bottles.

Installing dlls

In many cases (for example reshade, specialK) you just need a dll in your game folder. Just download the exe, extract it, and manually install the dll.

You might have to rename it, for example to

  • d3d9.dll if your game uses Directx9 (this is more likely for older games)
  • dxgi.dll if your game uses Directx11 (this is more likely for newer games)

or something like that.

Also note that you should use a dll that has the architecture of your game, so if the game is 32 bit, you might need to choose another dll than if your game is 64 bit (often indicated by a 32 or a 64 in the dll filename).

Path names

Linux paths are case sensitive, while Windows paths are not. This leads to mod developers using different folder names when referring to the same folder, for example textures and Textures.

Wine knows that, and is able to handle it accordingly. However, if you manually copy the mod to it's destination with your Linux file manager, you might get problems if you create an additional folder. There are a couple options to avoid these problems:

  • If you encounter a problem, look at the file structures to detect problems. You can use find . -type d | tr "[A-Z]" "[a-z]" | sort | uniq -c | grep -v " 1 " to find conflicts. [2]
  • Use a mod manager that you install with wine.
  • Use ext4 with case folding. (The SteamDeck uses ext4 with case folding by default.)
  • Install 7zip for Windows and use that to extract and move the mod to it's destination. 7zip also comes with a file manager that you can use. You could also use any other Windows file manager. It just needs access to the game folder. Either install it in the same prefix, or use it's own prefix and symlink the game folder.

Trainer

This page needs work, for the following reason(s): I didn't test any of these, and just copied some links from answers to reddit posts asking about this kind of stuff. Maybe some are redundant or not working well. Please edit this if you have any idea what these tools do.

Linux native modding tools

There are some game specific Linux native modding tools, you may find a list here.