How to make a mod?

Nerf Craft

Well-Known Member
Joined
Sep 6, 2018
Messages
103
Likes
198
Points
145
#1
I'm quite new to modding TerraTech, but I'm already getting interested in making my own mods, so if anyone could help me get started that would be very much appreciated.
All I know is that I need to look at the .dll files and I have learned how to do that so you don't need to tell me that step.
Also, if anyone can point me to a beginner's guide to Blender that would also be welcome, I can never seem to work it, despite using the online guide.
 

WhitePaw2002

Modding Husky
Joined
Jan 7, 2016
Messages
931
Likes
1,990
Points
505
Age
17
Location
North-east America
Website
github.com
#2
How to Mod
A brief guide

  • User Content

    • There are some mods that allow community members to make content (depending on the content mod).

    • This could be a faster way to make things without the hassle of creating an actual mod project, and easily share wherever dedicated to.

    • Instructions on how to make this user content should usually be on the mod's Github or Forum page.

  • C# Mods

    • If you would like to make more functional content, you would need to give it that functionality. All mods in TTMM are made with C#, as is the code in the game itself.

    • Assembly Hacks:

      • This is simply decompiling and recompiling parts of game code. A very good way to start! (This is how I started modding with little experience)

        • Decompiling is a great way to learn about how certain things in the game work, and depending on the tool can allow for prototyping through recompiling.

        • Recompiling is a fast way to test changes to the decompiled code as part of better understanding or experimentation.

      • One of the best tools for this is an open source program called DnSpy, that allows you to decompile & recompile compiled code files.

      • The file that will be modded is a file called "Assembly-CSharp.dll", under your game's Installation Folder > TerraTech*_Data > Managed

      • Note:

        • Changes to the assembly will be lost if the game's version is changed. An assembly of one version cannot be used in a different game version.

        • You cannot distribute the code file due to legal reasons. Be responsible and no open sharing!

        • Assembly mods cannot be stacked (without manually stitching the changes in the assemblies to one)

    • Harmony Mods:

      • This is what the mods on TTMM are. These are .dll files that are loaded by the patch installed by TTMM when the game loads, and add or change things without changing the game's code directly. Woah! Stackable mods!

      • For this, Visual Studio Community is preferable for building .dll files (Class Library projects)

        • There is a certain template you would have to follow, involving adding a "mod.json" file to the build folder that gives information on loading the .dll . I'd recommend looking at this handy template mod

      • Included for your mods to use is the Harmony library, that can be used to attach scripts to functions, or even change them. (You can also use System.Reflection if you are willing to grasp it)

      • Adding your mod to TTMM:

        • TTMM finds mods on Github, which are under the "ttqmm" topic

        • There must be a folder on your repository holding your built mod files, in a sub-folder (Should be changed in the near future to only require path to build files)

        • There must be a "LINKS.txt" folder pointing to the build folder, that holds your subfolder with the built files, in your repository (A full URL link)

          • This file can also have dependency mods listed underneath per-line, usually in the format of "Author/Mod-Name"

      • Note:

        • It may be good to look at how other mods on Github do this for more clarity

        • Any change to the repository would mark the mod with an available update on TTMM

        • Making full harmony mods may be difficult. You can ask for guidance on the official TerraTech Discord.
 
Last edited:

Draxiss314

New Member
Joined
Jul 9, 2019
Messages
8
Likes
0
Points
2
#5
While I could probably get Visual Studio Community to work under Linux with Wine, I'd rather use the Linux-native Visual Studio Code. Are the differences between the two significant enough that I should try to get Community working?